From 1eb3c64ea4ae4badbb71c92245de194b7fe7e1c4 Mon Sep 17 00:00:00 2001 From: fardragon Date: Fri, 5 Jun 2026 17:24:29 +0200 Subject: [PATCH] cleanup autoconf_at --- .../{autoconf_at.txt => autoconf_at.h} | 62 ++++++++++++------- .../autoconf_at/autoconf_at.h.in | 62 +++++++++++++++++++ .../autoconf_at/autoconf_at.txt.in | 48 -------------- test/standalone/config_header/build.zig | 4 +- 4 files changed, 102 insertions(+), 74 deletions(-) rename test/standalone/config_header/autoconf_at/{autoconf_at.txt => autoconf_at.h} (50%) create mode 100644 test/standalone/config_header/autoconf_at/autoconf_at.h.in delete mode 100644 test/standalone/config_header/autoconf_at/autoconf_at.txt.in diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.txt b/test/standalone/config_header/autoconf_at/autoconf_at.h similarity index 50% rename from test/standalone/config_header/autoconf_at/autoconf_at.txt rename to test/standalone/config_header/autoconf_at/autoconf_at.h index e35cb5f822ab889e727d0fd13fe263fedb8b24cd..a4bdeff7af89c8b3c8b14d19abfae016692a2249 100644 --- a/test/standalone/config_header/autoconf_at/autoconf_at.txt +++ b/test/standalone/config_header/autoconf_at/autoconf_at.h @@ -1,49 +1,63 @@ /* This file was generated by ConfigHeader using the Zig Build System. */ +/* Some Comment */ +int foo(); // empty strings are preserved // line with misc content is preserved -no substitution +#define KEPT_VALUE no substitution + // empty @ sigils are preserved -@ -@@ -@@@ -@@@@ +#define AT_SIGIL_1 @ +#define AT_SIGIL_2 @@ +#define AT_SIGIL_3 @@@ +#define AT_SIGIL_4 @@@@ + // simple substitution +#define SIMPLE_UNDEFINED +#define SIMPLE_DEFINED +#define SIMPLE_BOOL_TRUE 1 +#define SIMPLE_BOOL_FALSE 0 +#define SIMPLE_INTEGER 42 +#define SIMPLE_STRING text - -1 -0 -42 -text // double packed substitution -texttext +#define DOUBLE_PACKED texttext + // triple packed substitution -text42text +#define TRIPLE_PACKED text42text + // double separated substitution -42.42 +#define DOUBLE_SEPARATED 42.42 + // triple separated substitution -42.1.42 +#define TRIPLE_SEPARATED 42.1.42 + // misc prefix is preserved -false is 0 +#define MISC_PREFIX false is 0 + // misc suffix is preserved -1 is true +#define MISC_SUFFIX 1 is true + // surrounding content is preserved -what is 6*7? 42! +#define SURROUNDING what is 6*7? 42! + // incomplete key is preserved -@undefined +#define INCOMPLETE_KEY @undefined + // @-vars resolved only when they wrap valid characters, otherwise considered literals -@text@ +#define DOUBLE_WRAPPED @text@ + // expanded variables are considered strings after expansion -@string@ +#define EXPANDED_STRING @string@ // variable name with underscores -value +#define UNDERSCORED_VAR value // backslash before at-sigil does not prevent resolution -\text +#define BACKSLASH_AT \text // value that is an at-sign itself -@ +#define AT_SIGN_VALUE @ // incomplete key mid-line is preserved, trailing content kept -@incomplete trailing content +#define INCOMPLETE_MID @incomplete trailing content diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.h.in b/test/standalone/config_header/autoconf_at/autoconf_at.h.in new file mode 100644 index 0000000000000000000000000000000000000000..3c7967a61eba0ba3e2276cd19eedf12bb466f118 --- /dev/null +++ b/test/standalone/config_header/autoconf_at/autoconf_at.h.in @@ -0,0 +1,62 @@ +/* Some Comment */ +int foo(); +// empty strings are preserved + +// line with misc content is preserved +#define KEPT_VALUE no substitution + +// empty @ sigils are preserved +#define AT_SIGIL_1 @ +#define AT_SIGIL_2 @@ +#define AT_SIGIL_3 @@@ +#define AT_SIGIL_4 @@@@ + +// simple substitution +#define SIMPLE_UNDEFINED @undefined@ +#define SIMPLE_DEFINED @defined@ +#define SIMPLE_BOOL_TRUE @boolean_true@ +#define SIMPLE_BOOL_FALSE @boolean_false@ +#define SIMPLE_INTEGER @integer@ +#define SIMPLE_STRING @string@ + +// double packed substitution +#define DOUBLE_PACKED @string@@string@ + +// triple packed substitution +#define TRIPLE_PACKED @string@@integer@@string@ + +// double separated substitution +#define DOUBLE_SEPARATED @integer@.@integer@ + +// triple separated substitution +#define TRIPLE_SEPARATED @integer@.@boolean_true@.@integer@ + +// misc prefix is preserved +#define MISC_PREFIX false is @boolean_false@ + +// misc suffix is preserved +#define MISC_SUFFIX @boolean_true@ is true + +// surrounding content is preserved +#define SURROUNDING what is 6*7? @integer@! + +// incomplete key is preserved +#define INCOMPLETE_KEY @undefined + +// @-vars resolved only when they wrap valid characters, otherwise considered literals +#define DOUBLE_WRAPPED @@string@@ + +// expanded variables are considered strings after expansion +#define EXPANDED_STRING @string_at@ + +// variable name with underscores +#define UNDERSCORED_VAR @underscored_var@ + +// backslash before at-sigil does not prevent resolution +#define BACKSLASH_AT \@string@ + +// value that is an at-sign itself +#define AT_SIGN_VALUE @at_sign@ + +// incomplete key mid-line is preserved, trailing content kept +#define INCOMPLETE_MID @incomplete trailing content diff --git a/test/standalone/config_header/autoconf_at/autoconf_at.txt.in b/test/standalone/config_header/autoconf_at/autoconf_at.txt.in deleted file mode 100644 index 77d15622e8223e3e51ccc66889deb2b0d79b563b..0000000000000000000000000000000000000000 --- a/test/standalone/config_header/autoconf_at/autoconf_at.txt.in +++ /dev/null @@ -1,48 +0,0 @@ -// empty strings are preserved - -// line with misc content is preserved -no substitution -// empty @ sigils are preserved -@ -@@ -@@@ -@@@@ -// simple substitution -@undefined@ -@defined@ -@boolean_true@ -@boolean_false@ -@integer@ -@string@ -// double packed substitution -@string@@string@ -// triple packed substitution -@string@@integer@@string@ -// double separated substitution -@integer@.@integer@ -// triple separated substitution -@integer@.@boolean_true@.@integer@ -// misc prefix is preserved -false is @boolean_false@ -// misc suffix is preserved -@boolean_true@ is true -// surrounding content is preserved -what is 6*7? @integer@! -// incomplete key is preserved -@undefined -// @-vars resolved only when they wrap valid characters, otherwise considered literals -@@string@@ -// expanded variables are considered strings after expansion -@string_at@ - -// variable name with underscores -@underscored_var@ - -// backslash before at-sigil does not prevent resolution -\@string@ - -// value that is an at-sign itself -@at_sign@ - -// incomplete key mid-line is preserved, trailing content kept -@incomplete trailing content diff --git a/test/standalone/config_header/build.zig b/test/standalone/config_header/build.zig index 95daf60c28ea3aa5032377c7cb5c14f082a622a9..84439ba34cd7d97ae6cef9c9df99e2e0e9df5cd3 100644 --- a/test/standalone/config_header/build.zig +++ b/test/standalone/config_header/build.zig @@ -30,7 +30,7 @@ pub fn build(b: *std.Build) void { }); const config_header_autoconf_at = b.addConfigHeader( - .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.txt.in") } }, + .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.h.in") } }, .{ .undefined = null, .defined = {}, @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { }, ); const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{ - .expected_exact = @embedFile("autoconf_at/autoconf_at.txt"), + .expected_exact = @embedFile("autoconf_at/autoconf_at.h"), }); test_step.dependOn(&check_config_header.step); -- 2.54.0