authorgravatar for michaldrozd@protonmail.chfardragon <michaldrozd@protonmail.ch> 2026-06-05 23:06:41+02:00
committergravatar for michaldrozd@protonmail.chfardragon <michaldrozd@protonmail.ch> 2026-06-05 21:07:37+00:00
logcae8952548518c9504ca40f5212cafa79622f04b
tree39d8b57987573a5fcf581556f612aaacf4ca3487
parent1eb3c64ea4ae4badbb71c92245de194b7fe7e1c4

Work around multiline string literals weirdness


2 files changed, 5 insertions(+), 14 deletions(-)

lib/compiler/Maker/Step/ConfigHeader.zig+4-8
...@@ -392,17 +392,13 @@ fn renderBlank(...@@ -392,17 +392,13 @@ fn renderBlank(
392 };392 };
393393
394 try w.print(394 try w.print(
395 \\#ifndef {[0]f}395 "#ifndef {[0]f}{[1]s}#define {[0]f}{[1]s}",
396 \\#define {[0]f}396 .{ include_guard_fmt, os_newline },
397 \\397 );
398 , .{include_guard_fmt});
399398
400 for (value_map.keys(), value_pairs) |name, pair| try renderValueC(conf, w, os_newline, name, pair.index);399 for (value_map.keys(), value_pairs) |name, pair| try renderValueC(conf, w, os_newline, name, pair.index);
401400
402 try w.print(401 try w.print("#endif /* {f} */{s}", .{ include_guard_fmt, os_newline });
403 \\#endif /* {f} */
404 \\
405 , .{include_guard_fmt});
406}402}
407403
408const IncludeGuardFmt = struct {404const IncludeGuardFmt = struct {
test/standalone/config_header/build.zig+1-6
...@@ -16,18 +16,17 @@ pub fn build(b: *std.Build) void {...@@ -16,18 +16,17 @@ pub fn build(b: *std.Build) void {
16 .SOME_ENUM = @as(enum { foo, bar }, .foo),16 .SOME_ENUM = @as(enum { foo, bar }, .foo),
17 .SOME_ENUM_LITERAL = .@"test",17 .SOME_ENUM_LITERAL = .@"test",
18 .SOME_STRING = "test",18 .SOME_STRING = "test",
19
20 .PREFIX_SPACE = null,19 .PREFIX_SPACE = null,
21 .PREFIX_TAB = null,20 .PREFIX_TAB = null,
22 .POSTFIX_SPACE = null,21 .POSTFIX_SPACE = null,
23 .POSTFIX_TAB = null,22 .POSTFIX_TAB = null,
24
25 .SOME_UNDERSCORED = true,23 .SOME_UNDERSCORED = true,
26 },24 },
27 );25 );
28 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{26 const check_config_header = b.addCheckFile(config_header.getOutputFile(), .{
29 .expected_exact = @embedFile("autoconf_undef/config.h"),27 .expected_exact = @embedFile("autoconf_undef/config.h"),
30 });28 });
29 test_step.dependOn(&check_config_header.step);
3130
32 const config_header_autoconf_at = b.addConfigHeader(31 const config_header_autoconf_at = b.addConfigHeader(
33 .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.h.in") } },32 .{ .style = .{ .autoconf_at = b.path("autoconf_at/autoconf_at.h.in") } },
...@@ -39,7 +38,6 @@ pub fn build(b: *std.Build) void {...@@ -39,7 +38,6 @@ pub fn build(b: *std.Build) void {
39 .integer = 42,38 .integer = 42,
40 .string = "text",39 .string = "text",
41 .string_at = "@string@",40 .string_at = "@string@",
42
43 .underscored_var = "value",41 .underscored_var = "value",
44 .at_sign = "@",42 .at_sign = "@",
45 },43 },
...@@ -47,8 +45,6 @@ pub fn build(b: *std.Build) void {...@@ -47,8 +45,6 @@ pub fn build(b: *std.Build) void {
47 const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{45 const check_config_header_autoconf_at = b.addCheckFile(config_header_autoconf_at.getOutputFile(), .{
48 .expected_exact = @embedFile("autoconf_at/autoconf_at.h"),46 .expected_exact = @embedFile("autoconf_at/autoconf_at.h"),
49 });47 });
50
51 test_step.dependOn(&check_config_header.step);
52 test_step.dependOn(&check_config_header_autoconf_at.step);48 test_step.dependOn(&check_config_header_autoconf_at.step);
5349
54 const config_header_blank = b.addConfigHeader(50 const config_header_blank = b.addConfigHeader(
...@@ -109,7 +105,6 @@ fn addCmakeChecks(b: *std.Build, test_step: *std.Build.Step) void {...@@ -109,7 +105,6 @@ fn addCmakeChecks(b: *std.Build, test_step: *std.Build.Step) void {
109 .ONEVAL = 1,105 .ONEVAL = 1,
110 .TENVAL = 10,106 .TENVAL = 10,
111 .STRINGVAL = "test",107 .STRINGVAL = "test",
112
113 .BOOLNOVAL = {},108 .BOOLNOVAL = {},
114 .BOOLTRUEVAL = true,109 .BOOLTRUEVAL = true,
115 .BOOLFALSEVAL = false,110 .BOOLFALSEVAL = false,