authorgravatar for skewb1kunix@gmail.comskewb1k <skewb1kunix@gmail.com> 2025-11-03 03:29:16+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2025-11-05 14:07:30+02:00
log26db54d69b9a7f58a45897bb9523f95e3b8dd054
tree259fa6ddcdb874d3054ad76c3715361037b8109e
parenta6d444c2714f24b7232895cf15282e2287fe445e

zig fmt: fix extra whitespace in StructInit with multiline strings

68d2f68ed introduced special handling for StructInit fields containing multiline strings to prevent inserting whitespace after =. However, this logic didn't handle cases without a trailing comma, which resulted in unwanted trailing whitespace.

4 files changed, 102 insertions(+), 91 deletions(-)

lib/std/zig/Ast/Render.zig+2-1
...@@ -2056,7 +2056,8 @@ fn renderStructInit(...@@ -2056,7 +2056,8 @@ fn renderStructInit(
2056 const init_token = tree.firstToken(field_init);2056 const init_token = tree.firstToken(field_init);
2057 try renderToken(r, init_token - 3, .none); // .2057 try renderToken(r, init_token - 3, .none); // .
2058 try renderIdentifier(r, init_token - 2, .space, .eagerly_unquote); // name2058 try renderIdentifier(r, init_token - 2, .space, .eagerly_unquote); // name
2059 try renderToken(r, init_token - 1, .space); // =2059 const space_after_equal: Space = if (tree.nodeTag(field_init) == .multiline_string_literal) .none else .space;
2060 try renderToken(r, init_token - 1, space_after_equal); // =
2060 try renderExpressionFixup(r, field_init, .comma_space);2061 try renderExpressionFixup(r, field_init, .comma_space);
2061 }2062 }
2062 }2063 }
lib/std/zig/parser_test.zig+10
...@@ -5719,6 +5719,16 @@ test "zig fmt: no space before newline before multiline string" {...@@ -5719,6 +5719,16 @@ test "zig fmt: no space before newline before multiline string" {
5719 \\ ,5719 \\ ,
5720 \\ };5720 \\ };
5721 \\ _ = s2;5721 \\ _ = s2;
5722 \\ const s3 = .{ .text =
5723 \\ \\hello
5724 \\ \\world
5725 \\ , .comment = "test" };
5726 \\ _ = s3;
5727 \\ const s4 = .{ .comment = "test", .text =
5728 \\ \\hello
5729 \\ \\world
5730 \\ };
5731 \\ _ = s4;
5722 \\}5732 \\}
5723 \\5733 \\
5724 );5734 );
test/link/elf.zig+12-12
...@@ -480,7 +480,7 @@ fn testComdatElimination(b: *Build, opts: Options) *Step {...@@ -480,7 +480,7 @@ fn testComdatElimination(b: *Build, opts: Options) *Step {
480fn testCommentString(b: *Build, opts: Options) *Step {480fn testCommentString(b: *Build, opts: Options) *Step {
481 const test_step = addTestStep(b, "comment-string", opts);481 const test_step = addTestStep(b, "comment-string", opts);
482482
483 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = 483 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
484 \\pub fn main() void {}484 \\pub fn main() void {}
485 });485 });
486486
...@@ -495,7 +495,7 @@ fn testCommentString(b: *Build, opts: Options) *Step {...@@ -495,7 +495,7 @@ fn testCommentString(b: *Build, opts: Options) *Step {
495fn testCommentStringStaticLib(b: *Build, opts: Options) *Step {495fn testCommentStringStaticLib(b: *Build, opts: Options) *Step {
496 const test_step = addTestStep(b, "comment-string-static-lib", opts);496 const test_step = addTestStep(b, "comment-string-static-lib", opts);
497497
498 const lib = addStaticLibrary(b, opts, .{ .name = "lib", .zig_source_bytes = 498 const lib = addStaticLibrary(b, opts, .{ .name = "lib", .zig_source_bytes =
499 \\export fn foo() void {}499 \\export fn foo() void {}
500 });500 });
501501
...@@ -866,7 +866,7 @@ fn testDsoUndef(b: *Build, opts: Options) *Step {...@@ -866,7 +866,7 @@ fn testDsoUndef(b: *Build, opts: Options) *Step {
866fn testEmitRelocatable(b: *Build, opts: Options) *Step {866fn testEmitRelocatable(b: *Build, opts: Options) *Step {
867 const test_step = addTestStep(b, "emit-relocatable", opts);867 const test_step = addTestStep(b, "emit-relocatable", opts);
868868
869 const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes = 869 const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes =
870 \\const std = @import("std");870 \\const std = @import("std");
871 \\extern var bar: i32;871 \\extern var bar: i32;
872 \\export fn foo() i32 {872 \\export fn foo() i32 {
...@@ -878,7 +878,7 @@ fn testEmitRelocatable(b: *Build, opts: Options) *Step {...@@ -878,7 +878,7 @@ fn testEmitRelocatable(b: *Build, opts: Options) *Step {
878 });878 });
879 a_o.root_module.link_libc = true;879 a_o.root_module.link_libc = true;
880880
881 const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes = 881 const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes =
882 \\#include <stdio.h>882 \\#include <stdio.h>
883 \\int bar = 42;883 \\int bar = 42;
884 \\void printBar() {884 \\void printBar() {
...@@ -891,7 +891,7 @@ fn testEmitRelocatable(b: *Build, opts: Options) *Step {...@@ -891,7 +891,7 @@ fn testEmitRelocatable(b: *Build, opts: Options) *Step {
891 c_o.root_module.addObject(a_o);891 c_o.root_module.addObject(a_o);
892 c_o.root_module.addObject(b_o);892 c_o.root_module.addObject(b_o);
893893
894 const exe = addExecutable(b, opts, .{ .name = "test", .zig_source_bytes = 894 const exe = addExecutable(b, opts, .{ .name = "test", .zig_source_bytes =
895 \\const std = @import("std");895 \\const std = @import("std");
896 \\extern fn printFoo() void;896 \\extern fn printFoo() void;
897 \\extern fn printBar() void;897 \\extern fn printBar() void;
...@@ -1925,7 +1925,7 @@ fn testInitArrayOrder(b: *Build, opts: Options) *Step {...@@ -1925,7 +1925,7 @@ fn testInitArrayOrder(b: *Build, opts: Options) *Step {
1925 });1925 });
1926 g_o.root_module.link_libc = true;1926 g_o.root_module.link_libc = true;
19271927
1928 const h_o = addObject(b, opts, .{ .name = "h", .c_source_bytes = 1928 const h_o = addObject(b, opts, .{ .name = "h", .c_source_bytes =
1929 \\#include <stdio.h>1929 \\#include <stdio.h>
1930 \\__attribute__((destructor)) void fini2() { printf("8"); }1930 \\__attribute__((destructor)) void fini2() { printf("8"); }
1931 });1931 });
...@@ -2447,7 +2447,7 @@ fn testLinkingZig(b: *Build, opts: Options) *Step {...@@ -2447,7 +2447,7 @@ fn testLinkingZig(b: *Build, opts: Options) *Step {
2447fn testLinksection(b: *Build, opts: Options) *Step {2447fn testLinksection(b: *Build, opts: Options) *Step {
2448 const test_step = addTestStep(b, "linksection", opts);2448 const test_step = addTestStep(b, "linksection", opts);
24492449
2450 const obj = addObject(b, opts, .{ .name = "main", .zig_source_bytes = 2450 const obj = addObject(b, opts, .{ .name = "main", .zig_source_bytes =
2451 \\export var test_global: u32 linksection(".TestGlobal") = undefined;2451 \\export var test_global: u32 linksection(".TestGlobal") = undefined;
2452 \\export fn testFn() linksection(".TestFn") callconv(.c) void {2452 \\export fn testFn() linksection(".TestFn") callconv(.c) void {
2453 \\ TestGenericFn("A").f();2453 \\ TestGenericFn("A").f();
...@@ -2540,7 +2540,7 @@ fn testMergeStrings(b: *Build, opts: Options) *Step {...@@ -2540,7 +2540,7 @@ fn testMergeStrings(b: *Build, opts: Options) *Step {
2540fn testMergeStrings2(b: *Build, opts: Options) *Step {2540fn testMergeStrings2(b: *Build, opts: Options) *Step {
2541 const test_step = addTestStep(b, "merge-strings2", opts);2541 const test_step = addTestStep(b, "merge-strings2", opts);
25422542
2543 const obj1 = addObject(b, opts, .{ .name = "a", .zig_source_bytes = 2543 const obj1 = addObject(b, opts, .{ .name = "a", .zig_source_bytes =
2544 \\const std = @import("std");2544 \\const std = @import("std");
2545 \\export fn foo() void {2545 \\export fn foo() void {
2546 \\ var arr: [5:0]u16 = [_:0]u16{ 1, 2, 3, 4, 5 };2546 \\ var arr: [5:0]u16 = [_:0]u16{ 1, 2, 3, 4, 5 };
...@@ -2549,7 +2549,7 @@ fn testMergeStrings2(b: *Build, opts: Options) *Step {...@@ -2549,7 +2549,7 @@ fn testMergeStrings2(b: *Build, opts: Options) *Step {
2549 \\}2549 \\}
2550 });2550 });
25512551
2552 const obj2 = addObject(b, opts, .{ .name = "b", .zig_source_bytes = 2552 const obj2 = addObject(b, opts, .{ .name = "b", .zig_source_bytes =
2553 \\const std = @import("std");2553 \\const std = @import("std");
2554 \\extern fn foo() void;2554 \\extern fn foo() void;
2555 \\pub fn main() void {2555 \\pub fn main() void {
...@@ -2797,7 +2797,7 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step {...@@ -2797,7 +2797,7 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step {
2797 ,2797 ,
2798 });2798 });
2799 obj2.root_module.link_libcpp = true;2799 obj2.root_module.link_libcpp = true;
2800 const obj3 = addObject(b, opts, .{ .name = "obj3", .cpp_source_bytes = 2800 const obj3 = addObject(b, opts, .{ .name = "obj3", .cpp_source_bytes =
2801 \\#include <iostream>2801 \\#include <iostream>
2802 \\#include <stdexcept>2802 \\#include <stdexcept>
2803 \\extern int try_again();2803 \\extern int try_again();
...@@ -2909,7 +2909,7 @@ fn testRelocatableEhFrameComdatHeavy(b: *Build, opts: Options) *Step {...@@ -2909,7 +2909,7 @@ fn testRelocatableEhFrameComdatHeavy(b: *Build, opts: Options) *Step {
2909fn testRelocatableMergeStrings(b: *Build, opts: Options) *Step {2909fn testRelocatableMergeStrings(b: *Build, opts: Options) *Step {
2910 const test_step = addTestStep(b, "relocatable-merge-strings", opts);2910 const test_step = addTestStep(b, "relocatable-merge-strings", opts);
29112911
2912 const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 2912 const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
2913 \\.section .rodata.str1.1,"aMS",@progbits,12913 \\.section .rodata.str1.1,"aMS",@progbits,1
2914 \\val1:2914 \\val1:
2915 \\.ascii "Hello \0"2915 \\.ascii "Hello \0"
...@@ -3075,7 +3075,7 @@ fn testStrip(b: *Build, opts: Options) *Step {...@@ -3075,7 +3075,7 @@ fn testStrip(b: *Build, opts: Options) *Step {
3075fn testThunks(b: *Build, opts: Options) *Step {3075fn testThunks(b: *Build, opts: Options) *Step {
3076 const test_step = addTestStep(b, "thunks", opts);3076 const test_step = addTestStep(b, "thunks", opts);
30773077
3078 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 3078 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
3079 \\void foo();3079 \\void foo();
3080 \\__attribute__((section(".bar"))) void bar() {3080 \\__attribute__((section(".bar"))) void bar() {
3081 \\ return foo();3081 \\ return foo();
test/link/macho.zig+78-78
...@@ -111,7 +111,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {...@@ -111,7 +111,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
111fn testDeadStrip(b: *Build, opts: Options) *Step {111fn testDeadStrip(b: *Build, opts: Options) *Step {
112 const test_step = addTestStep(b, "dead-strip", opts);112 const test_step = addTestStep(b, "dead-strip", opts);
113113
114 const obj = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = 114 const obj = addObject(b, opts, .{ .name = "a", .cpp_source_bytes =
115 \\#include <stdio.h>115 \\#include <stdio.h>
116 \\int two() { return 2; }116 \\int two() { return 2; }
117 \\int live_var1 = 1;117 \\int live_var1 = 1;
...@@ -192,13 +192,13 @@ fn testDeadStrip(b: *Build, opts: Options) *Step {...@@ -192,13 +192,13 @@ fn testDeadStrip(b: *Build, opts: Options) *Step {
192fn testDuplicateDefinitions(b: *Build, opts: Options) *Step {192fn testDuplicateDefinitions(b: *Build, opts: Options) *Step {
193 const test_step = addTestStep(b, "duplicate-definitions", opts);193 const test_step = addTestStep(b, "duplicate-definitions", opts);
194194
195 const obj = addObject(b, opts, .{ .name = "a", .zig_source_bytes = 195 const obj = addObject(b, opts, .{ .name = "a", .zig_source_bytes =
196 \\var x: usize = 1;196 \\var x: usize = 1;
197 \\export fn strong() void { x += 1; }197 \\export fn strong() void { x += 1; }
198 \\export fn weak() void { x += 1; }198 \\export fn weak() void { x += 1; }
199 });199 });
200200
201 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = 201 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
202 \\var x: usize = 1;202 \\var x: usize = 1;
203 \\export fn strong() void { x += 1; }203 \\export fn strong() void { x += 1; }
204 \\comptime { @export(&weakImpl, .{ .name = "weak", .linkage = .weak }); }204 \\comptime { @export(&weakImpl, .{ .name = "weak", .linkage = .weak }); }
...@@ -223,7 +223,7 @@ fn testDuplicateDefinitions(b: *Build, opts: Options) *Step {...@@ -223,7 +223,7 @@ fn testDuplicateDefinitions(b: *Build, opts: Options) *Step {
223fn testDeadStripDylibs(b: *Build, opts: Options) *Step {223fn testDeadStripDylibs(b: *Build, opts: Options) *Step {
224 const test_step = addTestStep(b, "dead-strip-dylibs", opts);224 const test_step = addTestStep(b, "dead-strip-dylibs", opts);
225225
226 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 226 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
227 \\#include <objc/runtime.h>227 \\#include <objc/runtime.h>
228 \\int main() {228 \\int main() {
229 \\ if (objc_getClass("NSObject") == 0) {229 \\ if (objc_getClass("NSObject") == 0) {
...@@ -272,7 +272,7 @@ fn testDeadStripDylibs(b: *Build, opts: Options) *Step {...@@ -272,7 +272,7 @@ fn testDeadStripDylibs(b: *Build, opts: Options) *Step {
272fn testDylib(b: *Build, opts: Options) *Step {272fn testDylib(b: *Build, opts: Options) *Step {
273 const test_step = addTestStep(b, "dylib", opts);273 const test_step = addTestStep(b, "dylib", opts);
274274
275 const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = 275 const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes =
276 \\#include<stdio.h>276 \\#include<stdio.h>
277 \\char world[] = "world";277 \\char world[] = "world";
278 \\char* hello() {278 \\char* hello() {
...@@ -286,7 +286,7 @@ fn testDylib(b: *Build, opts: Options) *Step {...@@ -286,7 +286,7 @@ fn testDylib(b: *Build, opts: Options) *Step {
286 check.checkNotPresent("PIE");286 check.checkNotPresent("PIE");
287 test_step.dependOn(&check.step);287 test_step.dependOn(&check.step);
288288
289 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 289 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
290 \\#include<stdio.h>290 \\#include<stdio.h>
291 \\char* hello();291 \\char* hello();
292 \\extern char world[];292 \\extern char world[];
...@@ -347,7 +347,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step {...@@ -347,7 +347,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step {
347347
348 const empty = addObject(b, opts, .{ .name = "empty", .c_source_bytes = "" });348 const empty = addObject(b, opts, .{ .name = "empty", .c_source_bytes = "" });
349349
350 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 350 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
351 \\#include <stdio.h>351 \\#include <stdio.h>
352 \\int main() {352 \\int main() {
353 \\ printf("Hello world!");353 \\ printf("Hello world!");
...@@ -377,7 +377,7 @@ fn testEmptyZig(b: *Build, opts: Options) *Step {...@@ -377,7 +377,7 @@ fn testEmptyZig(b: *Build, opts: Options) *Step {
377fn testEntryPoint(b: *Build, opts: Options) *Step {377fn testEntryPoint(b: *Build, opts: Options) *Step {
378 const test_step = addTestStep(b, "entry-point", opts);378 const test_step = addTestStep(b, "entry-point", opts);
379379
380 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 380 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
381 \\#include<stdio.h>381 \\#include<stdio.h>
382 \\int non_main() {382 \\int non_main() {
383 \\ printf("%d", 42);383 \\ printf("%d", 42);
...@@ -599,7 +599,7 @@ fn testHeaderpad(b: *Build, opts: Options) *Step {...@@ -599,7 +599,7 @@ fn testHeaderpad(b: *Build, opts: Options) *Step {
599fn testHeaderWeakFlags(b: *Build, opts: Options) *Step {599fn testHeaderWeakFlags(b: *Build, opts: Options) *Step {
600 const test_step = addTestStep(b, "header-weak-flags", opts);600 const test_step = addTestStep(b, "header-weak-flags", opts);
601601
602 const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 602 const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
603 \\.globl _x603 \\.globl _x
604 \\.weak_definition _x604 \\.weak_definition _x
605 \\_x:605 \\_x:
...@@ -661,7 +661,7 @@ fn testHeaderWeakFlags(b: *Build, opts: Options) *Step {...@@ -661,7 +661,7 @@ fn testHeaderWeakFlags(b: *Build, opts: Options) *Step {
661 }661 }
662662
663 {663 {
664 const exe = addExecutable(b, opts, .{ .name = "main3", .asm_source_bytes = 664 const exe = addExecutable(b, opts, .{ .name = "main3", .asm_source_bytes =
665 \\.globl _main, _x665 \\.globl _main, _x
666 \\_x:666 \\_x:
667 \\667 \\
...@@ -686,7 +686,7 @@ fn testHeaderWeakFlags(b: *Build, opts: Options) *Step {...@@ -686,7 +686,7 @@ fn testHeaderWeakFlags(b: *Build, opts: Options) *Step {
686fn testHelloC(b: *Build, opts: Options) *Step {686fn testHelloC(b: *Build, opts: Options) *Step {
687 const test_step = addTestStep(b, "hello-c", opts);687 const test_step = addTestStep(b, "hello-c", opts);
688688
689 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 689 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
690 \\#include <stdio.h>690 \\#include <stdio.h>
691 \\int main() { 691 \\int main() {
692 \\ printf("Hello world!\n");692 \\ printf("Hello world!\n");
...@@ -710,7 +710,7 @@ fn testHelloC(b: *Build, opts: Options) *Step {...@@ -710,7 +710,7 @@ fn testHelloC(b: *Build, opts: Options) *Step {
710fn testHelloZig(b: *Build, opts: Options) *Step {710fn testHelloZig(b: *Build, opts: Options) *Step {
711 const test_step = addTestStep(b, "hello-zig", opts);711 const test_step = addTestStep(b, "hello-zig", opts);
712712
713 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = 713 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
714 \\const std = @import("std");714 \\const std = @import("std");
715 \\pub fn main() void {715 \\pub fn main() void {
716 \\ std.fs.File.stdout().writeAll("Hello world!\n") catch @panic("fail");716 \\ std.fs.File.stdout().writeAll("Hello world!\n") catch @panic("fail");
...@@ -731,7 +731,7 @@ fn testLargeBss(b: *Build, opts: Options) *Step {...@@ -731,7 +731,7 @@ fn testLargeBss(b: *Build, opts: Options) *Step {
731 // linker I tried misbehave in different ways. This only happened on arm64. I thought that731 // linker I tried misbehave in different ways. This only happened on arm64. I thought that
732 // maybe S_GB_ZEROFILL section is an answer to this but it doesn't seem supported by dyld732 // maybe S_GB_ZEROFILL section is an answer to this but it doesn't seem supported by dyld
733 // anymore. When I get some free time I will re-investigate this.733 // anymore. When I get some free time I will re-investigate this.
734 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 734 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
735 \\char arr[0x1000000];735 \\char arr[0x1000000];
736 \\int main() {736 \\int main() {
737 \\ return arr[2000];737 \\ return arr[2000];
...@@ -748,7 +748,7 @@ fn testLargeBss(b: *Build, opts: Options) *Step {...@@ -748,7 +748,7 @@ fn testLargeBss(b: *Build, opts: Options) *Step {
748fn testLayout(b: *Build, opts: Options) *Step {748fn testLayout(b: *Build, opts: Options) *Step {
749 const test_step = addTestStep(b, "layout", opts);749 const test_step = addTestStep(b, "layout", opts);
750750
751 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 751 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
752 \\#include <stdio.h>752 \\#include <stdio.h>
753 \\int main() {753 \\int main() {
754 \\ printf("Hello world!");754 \\ printf("Hello world!");
...@@ -938,7 +938,7 @@ fn testLinkingStaticLib(b: *Build, opts: Options) *Step {...@@ -938,7 +938,7 @@ fn testLinkingStaticLib(b: *Build, opts: Options) *Step {
938fn testLinksection(b: *Build, opts: Options) *Step {938fn testLinksection(b: *Build, opts: Options) *Step {
939 const test_step = addTestStep(b, "linksection", opts);939 const test_step = addTestStep(b, "linksection", opts);
940940
941 const obj = addObject(b, opts, .{ .name = "main", .zig_source_bytes = 941 const obj = addObject(b, opts, .{ .name = "main", .zig_source_bytes =
942 \\export var test_global: u32 linksection("__DATA,__TestGlobal") = undefined;942 \\export var test_global: u32 linksection("__DATA,__TestGlobal") = undefined;
943 \\export fn testFn() linksection("__TEXT,__TestFn") callconv(.c) void {943 \\export fn testFn() linksection("__TEXT,__TestFn") callconv(.c) void {
944 \\ TestGenericFn("A").f();944 \\ TestGenericFn("A").f();
...@@ -969,7 +969,7 @@ fn testLinksection(b: *Build, opts: Options) *Step {...@@ -969,7 +969,7 @@ fn testLinksection(b: *Build, opts: Options) *Step {
969fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {969fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {
970 const test_step = addTestStep(b, "merge-literals-x64", opts);970 const test_step = addTestStep(b, "merge-literals-x64", opts);
971971
972 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 972 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
973 \\.globl _q1973 \\.globl _q1
974 \\.globl _s1974 \\.globl _s1
975 \\975 \\
...@@ -994,7 +994,7 @@ fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {...@@ -994,7 +994,7 @@ fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {
994 \\ .quad l._s1994 \\ .quad l._s1
995 });995 });
996996
997 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes = 997 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes =
998 \\.globl _q2998 \\.globl _q2
999 \\.globl _s2999 \\.globl _s2
1000 \\.globl _s31000 \\.globl _s3
...@@ -1024,7 +1024,7 @@ fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {...@@ -1024,7 +1024,7 @@ fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {
1024 \\ .quad l._s31024 \\ .quad l._s3
1025 });1025 });
10261026
1027 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 1027 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
1028 \\#include <stdio.h>1028 \\#include <stdio.h>
1029 \\extern double q1();1029 \\extern double q1();
1030 \\extern double q2();1030 \\extern double q2();
...@@ -1085,7 +1085,7 @@ fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {...@@ -1085,7 +1085,7 @@ fn testMergeLiteralsX64(b: *Build, opts: Options) *Step {
1085fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {1085fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {
1086 const test_step = addTestStep(b, "merge-literals-arm64", opts);1086 const test_step = addTestStep(b, "merge-literals-arm64", opts);
10871087
1088 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 1088 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
1089 \\.globl _q11089 \\.globl _q1
1090 \\.globl _s11090 \\.globl _s1
1091 \\1091 \\
...@@ -1110,7 +1110,7 @@ fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {...@@ -1110,7 +1110,7 @@ fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {
1110 \\ .quad l._s11110 \\ .quad l._s1
1111 });1111 });
11121112
1113 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes = 1113 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes =
1114 \\.globl _q21114 \\.globl _q2
1115 \\.globl _s21115 \\.globl _s2
1116 \\.globl _s31116 \\.globl _s3
...@@ -1140,7 +1140,7 @@ fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {...@@ -1140,7 +1140,7 @@ fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {
1140 \\ .quad l._s31140 \\ .quad l._s3
1141 });1141 });
11421142
1143 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 1143 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
1144 \\#include <stdio.h>1144 \\#include <stdio.h>
1145 \\extern double q1();1145 \\extern double q1();
1146 \\extern double q2();1146 \\extern double q2();
...@@ -1205,7 +1205,7 @@ fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {...@@ -1205,7 +1205,7 @@ fn testMergeLiteralsArm64(b: *Build, opts: Options) *Step {
1205fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {1205fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {
1206 const test_step = addTestStep(b, "merge-literals-arm64-2", opts);1206 const test_step = addTestStep(b, "merge-literals-arm64-2", opts);
12071207
1208 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 1208 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
1209 \\.globl _q11209 \\.globl _q1
1210 \\.globl _s11210 \\.globl _s1
1211 \\1211 \\
...@@ -1225,7 +1225,7 @@ fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {...@@ -1225,7 +1225,7 @@ fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {
1225 \\ .double 1.23451225 \\ .double 1.2345
1226 });1226 });
12271227
1228 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes = 1228 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes =
1229 \\.globl _q21229 \\.globl _q2
1230 \\.globl _s21230 \\.globl _s2
1231 \\.globl _s31231 \\.globl _s3
...@@ -1248,7 +1248,7 @@ fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {...@@ -1248,7 +1248,7 @@ fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {
1248 \\ .double 1.23451248 \\ .double 1.2345
1249 });1249 });
12501250
1251 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 1251 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
1252 \\#include <stdio.h>1252 \\#include <stdio.h>
1253 \\extern double q1();1253 \\extern double q1();
1254 \\extern double q2();1254 \\extern double q2();
...@@ -1279,7 +1279,7 @@ fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {...@@ -1279,7 +1279,7 @@ fn testMergeLiteralsArm642(b: *Build, opts: Options) *Step {
1279fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {1279fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {
1280 const test_step = addTestStep(b, "merge-literals-alignment", opts);1280 const test_step = addTestStep(b, "merge-literals-alignment", opts);
12811281
1282 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 1282 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
1283 \\.globl _s11283 \\.globl _s1
1284 \\.globl _s21284 \\.globl _s2
1285 \\1285 \\
...@@ -1291,7 +1291,7 @@ fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {...@@ -1291,7 +1291,7 @@ fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {
1291 \\ .asciz "str2"1291 \\ .asciz "str2"
1292 });1292 });
12931293
1294 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes = 1294 const b_o = addObject(b, opts, .{ .name = "b", .asm_source_bytes =
1295 \\.globl _s31295 \\.globl _s3
1296 \\.globl _s41296 \\.globl _s4
1297 \\1297 \\
...@@ -1303,7 +1303,7 @@ fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {...@@ -1303,7 +1303,7 @@ fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {
1303 \\ .asciz "str2"1303 \\ .asciz "str2"
1304 });1304 });
13051305
1306 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 1306 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
1307 \\#include <assert.h>1307 \\#include <assert.h>
1308 \\#include <stdint.h>1308 \\#include <stdint.h>
1309 \\#include <stdio.h>1309 \\#include <stdio.h>
...@@ -1358,7 +1358,7 @@ fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {...@@ -1358,7 +1358,7 @@ fn testMergeLiteralsAlignment(b: *Build, opts: Options) *Step {
1358fn testMergeLiteralsObjc(b: *Build, opts: Options) *Step {1358fn testMergeLiteralsObjc(b: *Build, opts: Options) *Step {
1359 const test_step = addTestStep(b, "merge-literals-objc", opts);1359 const test_step = addTestStep(b, "merge-literals-objc", opts);
13601360
1361 const main_o = addObject(b, opts, .{ .name = "main", .objc_source_bytes = 1361 const main_o = addObject(b, opts, .{ .name = "main", .objc_source_bytes =
1362 \\#import <Foundation/Foundation.h>;1362 \\#import <Foundation/Foundation.h>;
1363 \\1363 \\
1364 \\extern void foo();1364 \\extern void foo();
...@@ -1376,7 +1376,7 @@ fn testMergeLiteralsObjc(b: *Build, opts: Options) *Step {...@@ -1376,7 +1376,7 @@ fn testMergeLiteralsObjc(b: *Build, opts: Options) *Step {
1376 \\}1376 \\}
1377 });1377 });
13781378
1379 const a_o = addObject(b, opts, .{ .name = "a", .objc_source_bytes = 1379 const a_o = addObject(b, opts, .{ .name = "a", .objc_source_bytes =
1380 \\#import <Foundation/Foundation.h>;1380 \\#import <Foundation/Foundation.h>;
1381 \\1381 \\
1382 \\void foo() {1382 \\void foo() {
...@@ -1461,7 +1461,7 @@ fn testMhExecuteHeader(b: *Build, opts: Options) *Step {...@@ -1461,7 +1461,7 @@ fn testMhExecuteHeader(b: *Build, opts: Options) *Step {
1461fn testNoDeadStrip(b: *Build, opts: Options) *Step {1461fn testNoDeadStrip(b: *Build, opts: Options) *Step {
1462 const test_step = addTestStep(b, "no-dead-strip", opts);1462 const test_step = addTestStep(b, "no-dead-strip", opts);
14631463
1464 const exe = addExecutable(b, opts, .{ .name = "name", .c_source_bytes = 1464 const exe = addExecutable(b, opts, .{ .name = "name", .c_source_bytes =
1465 \\__attribute__((used)) int bogus1 = 0;1465 \\__attribute__((used)) int bogus1 = 0;
1466 \\int bogus2 = 0;1466 \\int bogus2 = 0;
1467 \\int foo = 42;1467 \\int foo = 42;
...@@ -1545,7 +1545,7 @@ fn testNeededLibrary(b: *Build, opts: Options) *Step {...@@ -1545,7 +1545,7 @@ fn testNeededLibrary(b: *Build, opts: Options) *Step {
1545fn testObjc(b: *Build, opts: Options) *Step {1545fn testObjc(b: *Build, opts: Options) *Step {
1546 const test_step = addTestStep(b, "objc", opts);1546 const test_step = addTestStep(b, "objc", opts);
15471547
1548 const lib = addStaticLibrary(b, opts, .{ .name = "a", .objc_source_bytes = 1548 const lib = addStaticLibrary(b, opts, .{ .name = "a", .objc_source_bytes =
1549 \\#import <Foundation/Foundation.h>1549 \\#import <Foundation/Foundation.h>
1550 \\@interface Foo : NSObject1550 \\@interface Foo : NSObject
1551 \\@end1551 \\@end
...@@ -1602,7 +1602,7 @@ fn testObjcpp(b: *Build, opts: Options) *Step {...@@ -1602,7 +1602,7 @@ fn testObjcpp(b: *Build, opts: Options) *Step {
1602 );1602 );
1603 };1603 };
16041604
1605 const foo_o = addObject(b, opts, .{ .name = "foo", .objcpp_source_bytes = 1605 const foo_o = addObject(b, opts, .{ .name = "foo", .objcpp_source_bytes =
1606 \\#import "Foo.h"1606 \\#import "Foo.h"
1607 \\@implementation Foo1607 \\@implementation Foo
1608 \\- (NSString *)name1608 \\- (NSString *)name
...@@ -1615,7 +1615,7 @@ fn testObjcpp(b: *Build, opts: Options) *Step {...@@ -1615,7 +1615,7 @@ fn testObjcpp(b: *Build, opts: Options) *Step {
1615 foo_o.root_module.addIncludePath(foo_h.dirname());1615 foo_o.root_module.addIncludePath(foo_h.dirname());
1616 foo_o.root_module.link_libcpp = true;1616 foo_o.root_module.link_libcpp = true;
16171617
1618 const exe = addExecutable(b, opts, .{ .name = "main", .objcpp_source_bytes = 1618 const exe = addExecutable(b, opts, .{ .name = "main", .objcpp_source_bytes =
1619 \\#import "Foo.h"1619 \\#import "Foo.h"
1620 \\#import <assert.h>1620 \\#import <assert.h>
1621 \\#include <iostream>1621 \\#include <iostream>
...@@ -1679,7 +1679,7 @@ fn testPagezeroSize(b: *Build, opts: Options) *Step {...@@ -1679,7 +1679,7 @@ fn testPagezeroSize(b: *Build, opts: Options) *Step {
1679fn testReexportsZig(b: *Build, opts: Options) *Step {1679fn testReexportsZig(b: *Build, opts: Options) *Step {
1680 const test_step = addTestStep(b, "reexports-zig", opts);1680 const test_step = addTestStep(b, "reexports-zig", opts);
16811681
1682 const lib = addStaticLibrary(b, opts, .{ .name = "a", .zig_source_bytes = 1682 const lib = addStaticLibrary(b, opts, .{ .name = "a", .zig_source_bytes =
1683 \\const x: i32 = 42;1683 \\const x: i32 = 42;
1684 \\export fn foo() i32 {1684 \\export fn foo() i32 {
1685 \\ return x;1685 \\ return x;
...@@ -1689,7 +1689,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step {...@@ -1689,7 +1689,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step {
1689 \\}1689 \\}
1690 });1690 });
16911691
1692 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 1692 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
1693 \\extern int foo();1693 \\extern int foo();
1694 \\extern int bar();1694 \\extern int bar();
1695 \\int main() {1695 \\int main() {
...@@ -1708,7 +1708,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step {...@@ -1708,7 +1708,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step {
1708fn testRelocatable(b: *Build, opts: Options) *Step {1708fn testRelocatable(b: *Build, opts: Options) *Step {
1709 const test_step = addTestStep(b, "relocatable", opts);1709 const test_step = addTestStep(b, "relocatable", opts);
17101710
1711 const a_o = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = 1711 const a_o = addObject(b, opts, .{ .name = "a", .cpp_source_bytes =
1712 \\#include <stdexcept>1712 \\#include <stdexcept>
1713 \\int try_me() {1713 \\int try_me() {
1714 \\ throw std::runtime_error("Oh no!");1714 \\ throw std::runtime_error("Oh no!");
...@@ -1716,14 +1716,14 @@ fn testRelocatable(b: *Build, opts: Options) *Step {...@@ -1716,14 +1716,14 @@ fn testRelocatable(b: *Build, opts: Options) *Step {
1716 });1716 });
1717 a_o.root_module.link_libcpp = true;1717 a_o.root_module.link_libcpp = true;
17181718
1719 const b_o = addObject(b, opts, .{ .name = "b", .cpp_source_bytes = 1719 const b_o = addObject(b, opts, .{ .name = "b", .cpp_source_bytes =
1720 \\extern int try_me();1720 \\extern int try_me();
1721 \\int try_again() {1721 \\int try_again() {
1722 \\ return try_me();1722 \\ return try_me();
1723 \\}1723 \\}
1724 });1724 });
17251725
1726 const main_o = addObject(b, opts, .{ .name = "main", .cpp_source_bytes = 1726 const main_o = addObject(b, opts, .{ .name = "main", .cpp_source_bytes =
1727 \\#include <iostream>1727 \\#include <iostream>
1728 \\#include <stdexcept>1728 \\#include <stdexcept>
1729 \\extern int try_again();1729 \\extern int try_again();
...@@ -1776,7 +1776,7 @@ fn testRelocatable(b: *Build, opts: Options) *Step {...@@ -1776,7 +1776,7 @@ fn testRelocatable(b: *Build, opts: Options) *Step {
1776fn testRelocatableZig(b: *Build, opts: Options) *Step {1776fn testRelocatableZig(b: *Build, opts: Options) *Step {
1777 const test_step = addTestStep(b, "relocatable-zig", opts);1777 const test_step = addTestStep(b, "relocatable-zig", opts);
17781778
1779 const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes = 1779 const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes =
1780 \\const std = @import("std");1780 \\const std = @import("std");
1781 \\export var foo: i32 = 0;1781 \\export var foo: i32 = 0;
1782 \\export fn incrFoo() void {1782 \\export fn incrFoo() void {
...@@ -1785,7 +1785,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {...@@ -1785,7 +1785,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {
1785 \\}1785 \\}
1786 });1786 });
17871787
1788 const b_o = addObject(b, opts, .{ .name = "b", .zig_source_bytes = 1788 const b_o = addObject(b, opts, .{ .name = "b", .zig_source_bytes =
1789 \\const std = @import("std");1789 \\const std = @import("std");
1790 \\extern var foo: i32;1790 \\extern var foo: i32;
1791 \\export fn decrFoo() void {1791 \\export fn decrFoo() void {
...@@ -1794,7 +1794,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {...@@ -1794,7 +1794,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {
1794 \\}1794 \\}
1795 });1795 });
17961796
1797 const main_o = addObject(b, opts, .{ .name = "main", .zig_source_bytes = 1797 const main_o = addObject(b, opts, .{ .name = "main", .zig_source_bytes =
1798 \\const std = @import("std");1798 \\const std = @import("std");
1799 \\extern var foo: i32;1799 \\extern var foo: i32;
1800 \\extern fn incrFoo() void;1800 \\extern fn incrFoo() void;
...@@ -1827,7 +1827,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {...@@ -1827,7 +1827,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {
1827fn testSearchStrategy(b: *Build, opts: Options) *Step {1827fn testSearchStrategy(b: *Build, opts: Options) *Step {
1828 const test_step = addTestStep(b, "search-strategy", opts);1828 const test_step = addTestStep(b, "search-strategy", opts);
18291829
1830 const obj = addObject(b, opts, .{ .name = "a", .c_source_bytes = 1830 const obj = addObject(b, opts, .{ .name = "a", .c_source_bytes =
1831 \\#include<stdio.h>1831 \\#include<stdio.h>
1832 \\char world[] = "world";1832 \\char world[] = "world";
1833 \\char* hello() {1833 \\char* hello() {
...@@ -1841,7 +1841,7 @@ fn testSearchStrategy(b: *Build, opts: Options) *Step {...@@ -1841,7 +1841,7 @@ fn testSearchStrategy(b: *Build, opts: Options) *Step {
1841 const dylib = addSharedLibrary(b, opts, .{ .name = "a" });1841 const dylib = addSharedLibrary(b, opts, .{ .name = "a" });
1842 dylib.root_module.addObject(obj);1842 dylib.root_module.addObject(obj);
18431843
1844 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 1844 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
1845 \\#include<stdio.h>1845 \\#include<stdio.h>
1846 \\char* hello();1846 \\char* hello();
1847 \\extern char world[];1847 \\extern char world[];
...@@ -1975,7 +1975,7 @@ fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step {...@@ -1975,7 +1975,7 @@ fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step {
1975fn testSectionBoundarySymbols2(b: *Build, opts: Options) *Step {1975fn testSectionBoundarySymbols2(b: *Build, opts: Options) *Step {
1976 const test_step = addTestStep(b, "section-boundary-symbols-2", opts);1976 const test_step = addTestStep(b, "section-boundary-symbols-2", opts);
19771977
1978 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 1978 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
1979 \\#include <stdio.h>1979 \\#include <stdio.h>
1980 \\struct pair { int a; int b; };1980 \\struct pair { int a; int b; };
1981 \\struct pair first __attribute__((section("__DATA,__pairs"))) = { 1, 2 };1981 \\struct pair first __attribute__((section("__DATA,__pairs"))) = { 1, 2 };
...@@ -2012,11 +2012,11 @@ fn testSectionBoundarySymbols2(b: *Build, opts: Options) *Step {...@@ -2012,11 +2012,11 @@ fn testSectionBoundarySymbols2(b: *Build, opts: Options) *Step {
2012fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {2012fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
2013 const test_step = addTestStep(b, "segment-boundary-symbols", opts);2013 const test_step = addTestStep(b, "segment-boundary-symbols", opts);
20142014
2015 const obj1 = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = 2015 const obj1 = addObject(b, opts, .{ .name = "a", .cpp_source_bytes =
2016 \\constexpr const char* MESSAGE __attribute__((used, section("__DATA_CONST_1,__message_ptr"))) = "codebase";2016 \\constexpr const char* MESSAGE __attribute__((used, section("__DATA_CONST_1,__message_ptr"))) = "codebase";
2017 });2017 });
20182018
2019 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 2019 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
2020 \\#include <stdio.h>2020 \\#include <stdio.h>
2021 \\const char* interop();2021 \\const char* interop();
2022 \\int main() {2022 \\int main() {
...@@ -2026,7 +2026,7 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {...@@ -2026,7 +2026,7 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
2026 });2026 });
20272027
2028 {2028 {
2029 const obj2 = addObject(b, opts, .{ .name = "b", .cpp_source_bytes = 2029 const obj2 = addObject(b, opts, .{ .name = "b", .cpp_source_bytes =
2030 \\extern const char* message_pointer __asm("segment$start$__DATA_CONST_1");2030 \\extern const char* message_pointer __asm("segment$start$__DATA_CONST_1");
2031 \\extern "C" const char* interop() {2031 \\extern "C" const char* interop() {
2032 \\ return message_pointer;2032 \\ return message_pointer;
...@@ -2049,7 +2049,7 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {...@@ -2049,7 +2049,7 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
2049 }2049 }
20502050
2051 {2051 {
2052 const obj2 = addObject(b, opts, .{ .name = "c", .cpp_source_bytes = 2052 const obj2 = addObject(b, opts, .{ .name = "c", .cpp_source_bytes =
2053 \\extern const char* message_pointer __asm("segment$start$__DATA_1");2053 \\extern const char* message_pointer __asm("segment$start$__DATA_1");
2054 \\extern "C" const char* interop() {2054 \\extern "C" const char* interop() {
2055 \\ return message_pointer;2055 \\ return message_pointer;
...@@ -2080,21 +2080,21 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {...@@ -2080,21 +2080,21 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step {
2080fn testSymbolStabs(b: *Build, opts: Options) *Step {2080fn testSymbolStabs(b: *Build, opts: Options) *Step {
2081 const test_step = addTestStep(b, "symbol-stabs", opts);2081 const test_step = addTestStep(b, "symbol-stabs", opts);
20822082
2083 const a_o = addObject(b, opts, .{ .name = "a", .c_source_bytes = 2083 const a_o = addObject(b, opts, .{ .name = "a", .c_source_bytes =
2084 \\int foo = 42;2084 \\int foo = 42;
2085 \\int getFoo() {2085 \\int getFoo() {
2086 \\ return foo;2086 \\ return foo;
2087 \\}2087 \\}
2088 });2088 });
20892089
2090 const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes = 2090 const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes =
2091 \\int bar = 24;2091 \\int bar = 24;
2092 \\int getBar() {2092 \\int getBar() {
2093 \\ return bar;2093 \\ return bar;
2094 \\}2094 \\}
2095 });2095 });
20962096
2097 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 2097 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
2098 \\#include <stdio.h>2098 \\#include <stdio.h>
2099 \\extern int getFoo();2099 \\extern int getFoo();
2100 \\extern int getBar();2100 \\extern int getBar();
...@@ -2164,7 +2164,7 @@ fn testTbdv3(b: *Build, opts: Options) *Step {...@@ -2164,7 +2164,7 @@ fn testTbdv3(b: *Build, opts: Options) *Step {
2164 );2164 );
2165 };2165 };
21662166
2167 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 2167 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
2168 \\#include <stdio.h>2168 \\#include <stdio.h>
2169 \\int getFoo();2169 \\int getFoo();
2170 \\int main() {2170 \\int main() {
...@@ -2211,7 +2211,7 @@ fn testTentative(b: *Build, opts: Options) *Step {...@@ -2211,7 +2211,7 @@ fn testTentative(b: *Build, opts: Options) *Step {
2211fn testThunks(b: *Build, opts: Options) *Step {2211fn testThunks(b: *Build, opts: Options) *Step {
2212 const test_step = addTestStep(b, "thunks", opts);2212 const test_step = addTestStep(b, "thunks", opts);
22132213
2214 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 2214 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
2215 \\#include <stdio.h>2215 \\#include <stdio.h>
2216 \\void bar() {2216 \\void bar() {
2217 \\ printf("bar");2217 \\ printf("bar");
...@@ -2243,14 +2243,14 @@ fn testThunks(b: *Build, opts: Options) *Step {...@@ -2243,14 +2243,14 @@ fn testThunks(b: *Build, opts: Options) *Step {
2243fn testTls(b: *Build, opts: Options) *Step {2243fn testTls(b: *Build, opts: Options) *Step {
2244 const test_step = addTestStep(b, "tls", opts);2244 const test_step = addTestStep(b, "tls", opts);
22452245
2246 const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = 2246 const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes =
2247 \\_Thread_local int a;2247 \\_Thread_local int a;
2248 \\int getA() {2248 \\int getA() {
2249 \\ return a;2249 \\ return a;
2250 \\}2250 \\}
2251 });2251 });
22522252
2253 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 2253 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
2254 \\#include<stdio.h>2254 \\#include<stdio.h>
2255 \\extern _Thread_local int a;2255 \\extern _Thread_local int a;
2256 \\extern int getA();2256 \\extern int getA();
...@@ -2294,7 +2294,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {...@@ -2294,7 +2294,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {
2294 );2294 );
2295 };2295 };
22962296
2297 const bar_o = addObject(b, opts, .{ .name = "bar", .cpp_source_bytes = 2297 const bar_o = addObject(b, opts, .{ .name = "bar", .cpp_source_bytes =
2298 \\#include "foo.h"2298 \\#include "foo.h"
2299 \\int bar() {2299 \\int bar() {
2300 \\ int v1 = Foo<int>::getVar();2300 \\ int v1 = Foo<int>::getVar();
...@@ -2304,7 +2304,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {...@@ -2304,7 +2304,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {
2304 bar_o.root_module.addIncludePath(foo_h.dirname());2304 bar_o.root_module.addIncludePath(foo_h.dirname());
2305 bar_o.root_module.link_libcpp = true;2305 bar_o.root_module.link_libcpp = true;
23062306
2307 const baz_o = addObject(b, opts, .{ .name = "baz", .cpp_source_bytes = 2307 const baz_o = addObject(b, opts, .{ .name = "baz", .cpp_source_bytes =
2308 \\#include "foo.h"2308 \\#include "foo.h"
2309 \\int baz() {2309 \\int baz() {
2310 \\ int v1 = Foo<unsigned>::getVar();2310 \\ int v1 = Foo<unsigned>::getVar();
...@@ -2314,7 +2314,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {...@@ -2314,7 +2314,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {
2314 baz_o.root_module.addIncludePath(foo_h.dirname());2314 baz_o.root_module.addIncludePath(foo_h.dirname());
2315 baz_o.root_module.link_libcpp = true;2315 baz_o.root_module.link_libcpp = true;
23162316
2317 const main_o = addObject(b, opts, .{ .name = "main", .cpp_source_bytes = 2317 const main_o = addObject(b, opts, .{ .name = "main", .cpp_source_bytes =
2318 \\extern int bar();2318 \\extern int bar();
2319 \\extern int baz();2319 \\extern int baz();
2320 \\int main() {2320 \\int main() {
...@@ -2342,7 +2342,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {...@@ -2342,7 +2342,7 @@ fn testTlsPointers(b: *Build, opts: Options) *Step {
2342fn testTlsLargeTbss(b: *Build, opts: Options) *Step {2342fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
2343 const test_step = addTestStep(b, "tls-large-tbss", opts);2343 const test_step = addTestStep(b, "tls-large-tbss", opts);
23442344
2345 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 2345 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
2346 \\#include <stdio.h>2346 \\#include <stdio.h>
2347 \\_Thread_local int x[0x8000];2347 \\_Thread_local int x[0x8000];
2348 \\_Thread_local int y[0x8000];2348 \\_Thread_local int y[0x8000];
...@@ -2363,7 +2363,7 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {...@@ -2363,7 +2363,7 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step {
2363fn testTlsZig(b: *Build, opts: Options) *Step {2363fn testTlsZig(b: *Build, opts: Options) *Step {
2364 const test_step = addTestStep(b, "tls-zig", opts);2364 const test_step = addTestStep(b, "tls-zig", opts);
23652365
2366 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = 2366 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
2367 \\const std = @import("std");2367 \\const std = @import("std");
2368 \\threadlocal var x: i32 = 0;2368 \\threadlocal var x: i32 = 0;
2369 \\threadlocal var y: i32 = -1;2369 \\threadlocal var y: i32 = -1;
...@@ -2390,7 +2390,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step {...@@ -2390,7 +2390,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step {
2390fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {2390fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {
2391 const test_step = addTestStep(b, "two-level-namespace", opts);2391 const test_step = addTestStep(b, "two-level-namespace", opts);
23922392
2393 const liba = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = 2393 const liba = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes =
2394 \\#include <stdio.h>2394 \\#include <stdio.h>
2395 \\int foo = 1;2395 \\int foo = 1;
2396 \\int* ptr_to_foo = &foo;2396 \\int* ptr_to_foo = &foo;
...@@ -2411,7 +2411,7 @@ fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {...@@ -2411,7 +2411,7 @@ fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {
2411 test_step.dependOn(&check.step);2411 test_step.dependOn(&check.step);
2412 }2412 }
24132413
2414 const libb = addSharedLibrary(b, opts, .{ .name = "b", .c_source_bytes = 2414 const libb = addSharedLibrary(b, opts, .{ .name = "b", .c_source_bytes =
2415 \\#include <stdio.h>2415 \\#include <stdio.h>
2416 \\int foo = 2;2416 \\int foo = 2;
2417 \\int* ptr_to_foo = &foo;2417 \\int* ptr_to_foo = &foo;
...@@ -2432,7 +2432,7 @@ fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {...@@ -2432,7 +2432,7 @@ fn testTwoLevelNamespace(b: *Build, opts: Options) *Step {
2432 test_step.dependOn(&check.step);2432 test_step.dependOn(&check.step);
2433 }2433 }
24342434
2435 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = 2435 const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes =
2436 \\#include <stdio.h>2436 \\#include <stdio.h>
2437 \\int getFoo();2437 \\int getFoo();
2438 \\extern int* ptr_to_foo;2438 \\extern int* ptr_to_foo;
...@@ -2632,12 +2632,12 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step {...@@ -2632,12 +2632,12 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step {
2632fn testUnresolvedError(b: *Build, opts: Options) *Step {2632fn testUnresolvedError(b: *Build, opts: Options) *Step {
2633 const test_step = addTestStep(b, "unresolved-error", opts);2633 const test_step = addTestStep(b, "unresolved-error", opts);
26342634
2635 const obj = addObject(b, opts, .{ .name = "a", .zig_source_bytes = 2635 const obj = addObject(b, opts, .{ .name = "a", .zig_source_bytes =
2636 \\extern fn foo() i32;2636 \\extern fn foo() i32;
2637 \\export fn bar() i32 { return foo() + 1; }2637 \\export fn bar() i32 { return foo() + 1; }
2638 });2638 });
26392639
2640 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = 2640 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
2641 \\const std = @import("std");2641 \\const std = @import("std");
2642 \\extern fn foo() i32;2642 \\extern fn foo() i32;
2643 \\extern fn bar() i32;2643 \\extern fn bar() i32;
...@@ -2668,7 +2668,7 @@ fn testUnresolvedError(b: *Build, opts: Options) *Step {...@@ -2668,7 +2668,7 @@ fn testUnresolvedError(b: *Build, opts: Options) *Step {
2668fn testUnresolvedError2(b: *Build, opts: Options) *Step {2668fn testUnresolvedError2(b: *Build, opts: Options) *Step {
2669 const test_step = addTestStep(b, "unresolved-error-2", opts);2669 const test_step = addTestStep(b, "unresolved-error-2", opts);
26702670
2671 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = 2671 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
2672 \\pub fn main() !void {2672 \\pub fn main() !void {
2673 \\ const msg_send_fn = @extern(2673 \\ const msg_send_fn = @extern(
2674 \\ *const fn () callconv(.c) usize,2674 \\ *const fn () callconv(.c) usize,
...@@ -2740,7 +2740,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {...@@ -2740,7 +2740,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {
2740 );2740 );
2741 };2741 };
27422742
2743 const main_o = addObject(b, opts, .{ .name = "main", .cpp_source_bytes = 2743 const main_o = addObject(b, opts, .{ .name = "main", .cpp_source_bytes =
2744 \\#include "all.h"2744 \\#include "all.h"
2745 \\#include <cstdio>2745 \\#include <cstdio>
2746 \\2746 \\
...@@ -2769,7 +2769,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {...@@ -2769,7 +2769,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {
2769 main_o.root_module.addIncludePath(all_h.dirname());2769 main_o.root_module.addIncludePath(all_h.dirname());
2770 main_o.root_module.link_libcpp = true;2770 main_o.root_module.link_libcpp = true;
27712771
2772 const simple_string_o = addObject(b, opts, .{ .name = "simple_string", .cpp_source_bytes = 2772 const simple_string_o = addObject(b, opts, .{ .name = "simple_string", .cpp_source_bytes =
2773 \\#include "all.h"2773 \\#include "all.h"
2774 \\#include <cstdio>2774 \\#include <cstdio>
2775 \\#include <cstring>2775 \\#include <cstring>
...@@ -2804,7 +2804,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {...@@ -2804,7 +2804,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {
2804 simple_string_o.root_module.addIncludePath(all_h.dirname());2804 simple_string_o.root_module.addIncludePath(all_h.dirname());
2805 simple_string_o.root_module.link_libcpp = true;2805 simple_string_o.root_module.link_libcpp = true;
28062806
2807 const simple_string_owner_o = addObject(b, opts, .{ .name = "simple_string_owner", .cpp_source_bytes = 2807 const simple_string_owner_o = addObject(b, opts, .{ .name = "simple_string_owner", .cpp_source_bytes =
2808 \\#include "all.h"2808 \\#include "all.h"
2809 \\2809 \\
2810 \\SimpleStringOwner::SimpleStringOwner(const char* x) : string{ 10 } {2810 \\SimpleStringOwner::SimpleStringOwner(const char* x) : string{ 10 } {
...@@ -2851,7 +2851,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {...@@ -2851,7 +2851,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step {
2851fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step {2851fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step {
2852 const test_step = addTestStep(b, "unwind-info-no-subsections-arm64", opts);2852 const test_step = addTestStep(b, "unwind-info-no-subsections-arm64", opts);
28532853
2854 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 2854 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
2855 \\.globl _foo2855 \\.globl _foo
2856 \\.align 42856 \\.align 4
2857 \\_foo:2857 \\_foo:
...@@ -2891,7 +2891,7 @@ fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step {...@@ -2891,7 +2891,7 @@ fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step {
2891 \\ .cfi_endproc2891 \\ .cfi_endproc
2892 });2892 });
28932893
2894 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 2894 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
2895 \\#include <stdio.h>2895 \\#include <stdio.h>
2896 \\int foo();2896 \\int foo();
2897 \\int main() {2897 \\int main() {
...@@ -2911,7 +2911,7 @@ fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step {...@@ -2911,7 +2911,7 @@ fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step {
2911fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step {2911fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step {
2912 const test_step = addTestStep(b, "unwind-info-no-subsections-x64", opts);2912 const test_step = addTestStep(b, "unwind-info-no-subsections-x64", opts);
29132913
2914 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = 2914 const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes =
2915 \\.globl _foo2915 \\.globl _foo
2916 \\_foo:2916 \\_foo:
2917 \\ .cfi_startproc2917 \\ .cfi_startproc
...@@ -2943,7 +2943,7 @@ fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step {...@@ -2943,7 +2943,7 @@ fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step {
2943 \\ .cfi_endproc2943 \\ .cfi_endproc
2944 });2944 });
29452945
2946 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 2946 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
2947 \\#include <stdio.h>2947 \\#include <stdio.h>
2948 \\int foo();2948 \\int foo();
2949 \\int main() {2949 \\int main() {
...@@ -2964,7 +2964,7 @@ fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step {...@@ -2964,7 +2964,7 @@ fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step {
2964fn testWeakBind(b: *Build, opts: Options) *Step {2964fn testWeakBind(b: *Build, opts: Options) *Step {
2965 const test_step = addTestStep(b, "weak-bind", opts);2965 const test_step = addTestStep(b, "weak-bind", opts);
29662966
2967 const lib = addSharedLibrary(b, opts, .{ .name = "foo", .asm_source_bytes = 2967 const lib = addSharedLibrary(b, opts, .{ .name = "foo", .asm_source_bytes =
2968 \\.globl _weak_dysym2968 \\.globl _weak_dysym
2969 \\.weak_definition _weak_dysym2969 \\.weak_definition _weak_dysym
2970 \\_weak_dysym:2970 \\_weak_dysym:
...@@ -2998,7 +2998,7 @@ fn testWeakBind(b: *Build, opts: Options) *Step {...@@ -2998,7 +2998,7 @@ fn testWeakBind(b: *Build, opts: Options) *Step {
2998 test_step.dependOn(&check.step);2998 test_step.dependOn(&check.step);
2999 }2999 }
30003000
3001 const exe = addExecutable(b, opts, .{ .name = "main", .asm_source_bytes = 3001 const exe = addExecutable(b, opts, .{ .name = "main", .asm_source_bytes =
3002 \\.globl _main, _weak_external, _weak_external_for_gotpcrel, _weak_external_fn3002 \\.globl _main, _weak_external, _weak_external_for_gotpcrel, _weak_external_fn
3003 \\.weak_definition _weak_external, _weak_external_for_gotpcrel, _weak_external_fn, _weak_internal, _weak_internal_for_gotpcrel, _weak_internal_fn3003 \\.weak_definition _weak_external, _weak_external_for_gotpcrel, _weak_external_fn, _weak_internal, _weak_internal_for_gotpcrel, _weak_internal_fn
3004 \\3004 \\
...@@ -3114,7 +3114,7 @@ fn testWeakFramework(b: *Build, opts: Options) *Step {...@@ -3114,7 +3114,7 @@ fn testWeakFramework(b: *Build, opts: Options) *Step {
3114fn testWeakLibrary(b: *Build, opts: Options) *Step {3114fn testWeakLibrary(b: *Build, opts: Options) *Step {
3115 const test_step = addTestStep(b, "weak-library", opts);3115 const test_step = addTestStep(b, "weak-library", opts);
31163116
3117 const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = 3117 const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes =
3118 \\#include<stdio.h>3118 \\#include<stdio.h>
3119 \\int a = 42;3119 \\int a = 42;
3120 \\const char* asStr() {3120 \\const char* asStr() {
...@@ -3124,7 +3124,7 @@ fn testWeakLibrary(b: *Build, opts: Options) *Step {...@@ -3124,7 +3124,7 @@ fn testWeakLibrary(b: *Build, opts: Options) *Step {
3124 \\}3124 \\}
3125 });3125 });
31263126
3127 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 3127 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
3128 \\#include<stdio.h>3128 \\#include<stdio.h>
3129 \\extern int a;3129 \\extern int a;
3130 \\extern const char* asStr();3130 \\extern const char* asStr();
...@@ -3157,7 +3157,7 @@ fn testWeakLibrary(b: *Build, opts: Options) *Step {...@@ -3157,7 +3157,7 @@ fn testWeakLibrary(b: *Build, opts: Options) *Step {
3157fn testWeakRef(b: *Build, opts: Options) *Step {3157fn testWeakRef(b: *Build, opts: Options) *Step {
3158 const test_step = addTestStep(b, "weak-ref", opts);3158 const test_step = addTestStep(b, "weak-ref", opts);
31593159
3160 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = 3160 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes =
3161 \\#include <stdio.h>3161 \\#include <stdio.h>
3162 \\#include <sys/_types/_fd_def.h>3162 \\#include <sys/_types/_fd_def.h>
3163 \\int main(int argc, char** argv) {3163 \\int main(int argc, char** argv) {