From b9f07b7ac227134001258e5933e3ef61aae80303 Mon Sep 17 00:00:00 2001 From: jacob gw Date: Thu, 11 Mar 2021 22:53:39 -0500 Subject: [PATCH 1/2] format zig files and add formatting check to ci --- ci/azure/linux_script | 3 +++ lib/std/Thread/Futex.zig | 16 +++++------ lib/std/c/darwin.zig | 4 +-- lib/std/zig/parse.zig | 57 +++++++++++++++++++++++++++++----------- test/tests.zig | 7 ++--- 5 files changed, 57 insertions(+), 30 deletions(-) diff --git a/ci/azure/linux_script b/ci/azure/linux_script index cf46b2c22210..56823755ac18 100755 --- a/ci/azure/linux_script +++ b/ci/azure/linux_script @@ -59,6 +59,9 @@ unset CXX make $JOBS install +# look for formatting errors +release/bin/zig fmt --check .. || (echo "Please run 'zig fmt' to fix the non-conforming files listed above." && false) + # Here we rebuild zig but this time using the Zig binary we just now produced to # build zig1.o rather than relying on the one built with stage0. See # https://github.com/ziglang/zig/issues/6830 for more details. diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 01353e9fb8da..356a4e2046ed 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -84,7 +84,7 @@ else const WindowsFutex = struct { const windows = std.os.windows; - + fn wait(ptr: *const Atomic(u32), expect: u32, timeout: ?u64) error{TimedOut}!void { var timeout_value: windows.LARGE_INTEGER = undefined; var timeout_ptr: ?*const windows.LARGE_INTEGER = null; @@ -299,7 +299,7 @@ const PosixFutex = struct { state: State = .empty, cond: std.c.pthread_cond_t = .{}, mutex: std.c.pthread_mutex_t = .{}, - + const Self = @This(); const State = enum { empty, @@ -381,7 +381,7 @@ test "Futex - wait/wake" { const wait_noop_result = Futex.wait(&value, 0, 0); try testing.expectError(error.TimedOut, wait_noop_result); - + const wait_longer_result = Futex.wait(&value, 0, std.time.ns_per_ms); try testing.expectError(error.TimedOut, wait_longer_result); @@ -416,7 +416,7 @@ test "Futex - Signal" { const Thread = struct { tx: *Self, rx: *Self, - + const start_value = 1; fn run(self: Thread) void { @@ -472,7 +472,7 @@ test "Futex - Broadcast" { self.broadcast.store(BROADCAST_RECEIVED, .Release); Futex.wake(&self.broadcast, 1); } - } + } fn run() !void { var self = Self{}; @@ -542,7 +542,7 @@ test "Futex - Chain" { if (chain.index + 1 < chain.self.threads.len) { next_signal = &chain.self.threads[chain.index + 1].signal; } - + this_signal.wait(); next_signal.notify(); } @@ -554,7 +554,7 @@ test "Futex - Chain" { for (self.threads) |*entry, index| { entry.signal = .{}; entry.thread = try std.Thread.spawn(Chain.run, .{ - .self = &self, + .self = &self, .index = index, }); } @@ -567,4 +567,4 @@ test "Futex - Chain" { } } }).run(); -} \ No newline at end of file +} diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index b8a554721f8e..ca18b5130ad2 100644 --- a/lib/std/c/darwin.zig +++ b/lib/std/c/darwin.zig @@ -246,7 +246,7 @@ pub const ULF_WAIT_ADAPTIVE_SPIN = 0x40000; pub extern "c" fn __ulock_wait2(op: u32, addr: ?*const c_void, val: u64, timeout_us: u32, val2: u64) c_int; pub extern "c" fn __ulock_wait(op: u32, addr: ?*const c_void, val: u64, timeout_us: u32) c_int; -pub extern "c" fn __ulock_wake(op: u32, addr: ?*const c_void, val: u64) c_int; +pub extern "c" fn __ulock_wake(op: u32, addr: ?*const c_void, val: u64) c_int; pub const OS_UNFAIR_LOCK_INIT = os_unfair_lock{}; pub const os_unfair_lock_t = *os_unfair_lock; @@ -258,4 +258,4 @@ pub extern "c" fn os_unfair_lock_lock(o: os_unfair_lock_t) void; pub extern "c" fn os_unfair_lock_unlock(o: os_unfair_lock_t) void; pub extern "c" fn os_unfair_lock_trylock(o: os_unfair_lock_t) bool; pub extern "c" fn os_unfair_lock_assert_owner(o: os_unfair_lock_t) void; -pub extern "c" fn os_unfair_lock_assert_not_owner(o: os_unfair_lock_t) void; \ No newline at end of file +pub extern "c" fn os_unfair_lock_assert_not_owner(o: os_unfair_lock_t) void; diff --git a/lib/std/zig/parse.zig b/lib/std/zig/parse.zig index 4d5cadb37bd0..cc323382cd63 100644 --- a/lib/std/zig/parse.zig +++ b/lib/std/zig/parse.zig @@ -2005,9 +2005,12 @@ const Parser = struct { if (field_init != 0) { try p.scratch.append(p.gpa, field_init); while (true) { - switch (p.token_tags[p.tok_i]) { + switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_brace => { p.tok_i += 1; break; }, + .r_brace => { + p.tok_i += 1; + break; + }, .colon, .r_paren, .r_bracket => return p.failExpected(.r_brace), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2045,7 +2048,10 @@ const Parser = struct { try p.scratch.append(p.gpa, elem_init); switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_brace => { p.tok_i += 1; break; }, + .r_brace => { + p.tok_i += 1; + break; + }, .colon, .r_paren, .r_bracket => return p.failExpected(.r_brace), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2121,7 +2127,10 @@ const Parser = struct { try p.scratch.append(p.gpa, param); switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_paren => { p.tok_i += 1; break; }, + .r_paren => { + p.tok_i += 1; + break; + }, .colon, .r_brace, .r_bracket => return p.failExpected(.r_paren), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2129,7 +2138,7 @@ const Parser = struct { } const comma = (p.token_tags[p.tok_i - 2] == .comma); const params = p.scratch.items[scratch_top..]; - switch(params.len) { + switch (params.len) { 0 => return p.addNode(.{ .tag = if (comma) .async_call_one_comma else .async_call_one, .main_token = lparen, @@ -2174,7 +2183,10 @@ const Parser = struct { try p.scratch.append(p.gpa, param); switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_paren => { p.tok_i += 1; break; }, + .r_paren => { + p.tok_i += 1; + break; + }, .colon, .r_brace, .r_bracket => return p.failExpected(.r_paren), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2182,7 +2194,7 @@ const Parser = struct { } const comma = (p.token_tags[p.tok_i - 2] == .comma); const params = p.scratch.items[scratch_top..]; - res = switch(params.len) { + res = switch (params.len) { 0 => try p.addNode(.{ .tag = if (comma) .call_one_comma else .call_one, .main_token = lparen, @@ -2448,7 +2460,10 @@ const Parser = struct { while (true) { switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_brace => { p.tok_i += 1; break; }, + .r_brace => { + p.tok_i += 1; + break; + }, .colon, .r_paren, .r_bracket => return p.failExpected(.r_brace), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2497,7 +2512,10 @@ const Parser = struct { try p.scratch.append(p.gpa, elem_init); switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_brace => { p.tok_i += 1; break; }, + .r_brace => { + p.tok_i += 1; + break; + }, .colon, .r_paren, .r_bracket => return p.failExpected(.r_brace), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2555,7 +2573,10 @@ const Parser = struct { const identifier = try p.expectToken(.identifier); switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_brace => { p.tok_i += 1; break; }, + .r_brace => { + p.tok_i += 1; + break; + }, .colon, .r_paren, .r_bracket => return p.failExpected(.r_brace), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -2992,14 +3013,14 @@ const Parser = struct { _ = try p.parsePtrPayload(); const items = p.scratch.items[scratch_top..]; - switch(items.len) { + switch (items.len) { 0 => return p.addNode(.{ .tag = .switch_case_one, .main_token = arrow_token, .data = .{ .lhs = 0, .rhs = try p.expectAssignExpr(), - } + }, }), 1 => return p.addNode(.{ .tag = .switch_case_one, @@ -3007,7 +3028,7 @@ const Parser = struct { .data = .{ .lhs = items[0], .rhs = try p.expectAssignExpr(), - } + }, }), else => return p.addNode(.{ .tag = .switch_case, @@ -3375,7 +3396,10 @@ const Parser = struct { } switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_paren => { p.tok_i += 1; break; }, + .r_paren => { + p.tok_i += 1; + break; + }, .colon, .r_brace, .r_bracket => return p.failExpected(.r_paren), // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), @@ -3444,7 +3468,10 @@ const Parser = struct { try p.scratch.append(p.gpa, param); switch (p.token_tags[p.tok_i]) { .comma => p.tok_i += 1, - .r_paren => { p.tok_i += 1; break; }, + .r_paren => { + p.tok_i += 1; + break; + }, // Likely just a missing comma; give error but continue parsing. else => try p.warnExpected(.comma), } diff --git a/test/tests.zig b/test/tests.zig index 1b944634a535..26f38d4e284b 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -107,7 +107,6 @@ const test_targets = blk: { .link_libc = true, }, - TestTarget{ .target = .{ .cpu_arch = .aarch64, @@ -228,7 +227,6 @@ const test_targets = blk: { .link_libc = true, }, - TestTarget{ .target = .{ .cpu_arch = .riscv64, @@ -656,7 +654,7 @@ pub const StackTracesContext = struct { const b = self.b; const src_basename = "source.zig"; const write_src = b.addWriteFile(src_basename, source); - const exe = b.addExecutableSource("test", write_src.getFileSource(src_basename).?); + const exe = b.addExecutableSource("test", write_src.getFileSource(src_basename).?); exe.setBuildMode(mode); const run_and_compare = RunAndCompareStep.create( @@ -670,7 +668,6 @@ pub const StackTracesContext = struct { self.step.dependOn(&run_and_compare.step); } - const RunAndCompareStep = struct { pub const base_id = .custom; @@ -1376,4 +1373,4 @@ fn printInvocation(args: []const []const u8) void { warn("{s} ", .{arg}); } warn("\n", .{}); -} \ No newline at end of file +} From e63ff4f1c110165c4b92025cb5b9d5531e861643 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Sun, 13 Jun 2021 22:27:27 +0300 Subject: [PATCH 2/2] add ast-check flag to zig fmt, fix found bugs --- ci/azure/linux_script | 2 +- lib/std/fmt/parse_float.zig | 15 +- lib/std/special/compiler_rt.zig | 831 +++++++++++++++--------- lib/std/special/compiler_rt/atomics.zig | 130 ++-- src/AstGen.zig | 10 +- src/clang.zig | 40 +- src/codegen/llvm/bindings.zig | 18 +- src/codegen/spirv/spec.zig | 91 +-- src/config.zig.in | 2 +- src/link/MachO.zig | 20 +- src/link/MachO/Trie.zig | 2 +- src/link/MachO/Zld.zig | 20 +- src/main.zig | 54 +- src/stage1.zig | 4 +- src/type.zig | 6 +- src/windows_sdk.zig | 2 +- test/behavior/bitcast.zig | 4 +- test/behavior/bugs/1111.zig | 2 +- test/behavior/bugs/3046.zig | 2 +- test/behavior/cast.zig | 13 +- test/behavior/enum.zig | 41 +- test/behavior/error.zig | 2 +- test/behavior/eval.zig | 4 +- test/behavior/generics.zig | 6 +- test/behavior/misc.zig | 8 +- test/behavior/syntax.zig | 3 +- test/behavior/type.zig | 2 +- test/behavior/union.zig | 2 +- test/stage2/test.zig | 14 + 29 files changed, 803 insertions(+), 547 deletions(-) diff --git a/ci/azure/linux_script b/ci/azure/linux_script index 56823755ac18..52880f40aaed 100755 --- a/ci/azure/linux_script +++ b/ci/azure/linux_script @@ -60,7 +60,7 @@ unset CXX make $JOBS install # look for formatting errors -release/bin/zig fmt --check .. || (echo "Please run 'zig fmt' to fix the non-conforming files listed above." && false) +release/bin/zig fmt --check --ast-check .. || (echo "Please run 'zig fmt' to fix the non-conforming files listed above." && false) # Here we rebuild zig but this time using the Zig binary we just now produced to # build zig1.o rather than relying on the one built with stage0. See diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index 3173d749b470..1f6d7222ac76 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -34,7 +34,7 @@ // - Only supports round-to-zero // - Does not handle denormals -const std = @import("../std.zig"); +const std = @import("std"); const ascii = std.ascii; // The mantissa field in FloatRepr is 64bit wide and holds only 19 digits @@ -231,6 +231,8 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { } else if (c == '.') { i += 1; state = .LeadingFractionalZeros; + } else if (c == '_') { + i += 1; } else { state = .MantissaIntegral; } @@ -259,6 +261,8 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { } else if (c == '.') { i += 1; state = .MantissaFractional; + } else if (c == '_') { + i += 1; } else { state = .MantissaFractional; } @@ -276,6 +280,8 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { } else if (c == 'e' or c == 'E') { i += 1; state = .ExponentSign; + } else if (c == '_') { + i += 1; } else { state = .ExponentSign; } @@ -283,6 +289,8 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { .ExponentSign => { if (c == '+') { i += 1; + } else if (c == '_') { + return error.InvalidCharacter; } else if (c == '-') { negative_exp = true; i += 1; @@ -293,6 +301,8 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { .LeadingExponentZeros => { if (c == '0') { i += 1; + } else if (c == '_') { + i += 1; } else { state = .Exponent; } @@ -304,6 +314,8 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { exponent += @intCast(i32, c - '0'); } + i += 1; + } else if (c == '_') { i += 1; } else { return error.InvalidCharacter; @@ -405,6 +417,7 @@ test "fmt.parseFloat" { try expectEqual(try parseFloat(T, "-INF"), -std.math.inf(T)); try expectEqual(try parseFloat(T, "0.4e0066999999999999999999999999999999999999999999999999999"), std.math.inf(T)); + try expect(approxEqAbs(T, try parseFloat(T, "0_1_2_3_4_5_6.7_8_9_0_0_0e0_0_1_0"), @as(T, 123456.789000e10), epsilon)); if (T != f16) { try expect(approxEqAbs(T, try parseFloat(T, "1e-2"), 0.01, epsilon)); diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index 9be31f7d0937..a777067800e4 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -20,10 +20,13 @@ comptime { switch (arch) { .i386, .x86_64, - => @export(@import("compiler_rt/stack_probe.zig").zig_probe_stack, .{ - .name = "__zig_probe_stack", - .linkage = linkage, - }), + => { + const zig_probe_stack = @import("compiler_rt/stack_probe.zig").zig_probe_stack; + @export(zig_probe_stack, .{ + .name = "__zig_probe_stack", + .linkage = linkage, + }); + }, else => {}, } @@ -31,355 +34,567 @@ comptime { // __clear_cache manages its own logic about whether to be exported or not. _ = @import("compiler_rt/clear_cache.zig").clear_cache; - @export(@import("compiler_rt/compareXf2.zig").__lesf2, .{ .name = "__lesf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__ledf2, .{ .name = "__ledf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__letf2", .linkage = linkage }); + const __lesf2 = @import("compiler_rt/compareXf2.zig").__lesf2; + @export(__lesf2, .{ .name = "__lesf2", .linkage = linkage }); + const __ledf2 = @import("compiler_rt/compareXf2.zig").__ledf2; + @export(__ledf2, .{ .name = "__ledf2", .linkage = linkage }); + const __letf2 = @import("compiler_rt/compareXf2.zig").__letf2; + @export(__letf2, .{ .name = "__letf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__gesf2, .{ .name = "__gesf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__gedf2, .{ .name = "__gedf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__getf2, .{ .name = "__getf2", .linkage = linkage }); + const __gesf2 = @import("compiler_rt/compareXf2.zig").__gesf2; + @export(__gesf2, .{ .name = "__gesf2", .linkage = linkage }); + const __gedf2 = @import("compiler_rt/compareXf2.zig").__gedf2; + @export(__gedf2, .{ .name = "__gedf2", .linkage = linkage }); + const __getf2 = @import("compiler_rt/compareXf2.zig").__getf2; + @export(__getf2, .{ .name = "__getf2", .linkage = linkage }); if (!is_test) { - @export(@import("compiler_rt/compareXf2.zig").__lesf2, .{ .name = "__cmpsf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__ledf2, .{ .name = "__cmpdf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__cmptf2", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__eqsf2, .{ .name = "__eqsf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__eqdf2, .{ .name = "__eqdf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__eqtf2", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__ltsf2, .{ .name = "__ltsf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__ltdf2, .{ .name = "__ltdf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__lttf2", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__nesf2, .{ .name = "__nesf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__nedf2, .{ .name = "__nedf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__netf2", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__gtsf2, .{ .name = "__gtsf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__gtdf2, .{ .name = "__gtdf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__getf2, .{ .name = "__gttf2", .linkage = linkage }); - - @export(@import("compiler_rt/extendXfYf2.zig").__extendhfsf2, .{ .name = "__gnu_h2f_ieee", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__truncsfhf2, .{ .name = "__gnu_f2h_ieee", .linkage = linkage }); + @export(__lesf2, .{ .name = "__cmpsf2", .linkage = linkage }); + @export(__ledf2, .{ .name = "__cmpdf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__cmptf2", .linkage = linkage }); + + const __eqsf2 = @import("compiler_rt/compareXf2.zig").__eqsf2; + @export(__eqsf2, .{ .name = "__eqsf2", .linkage = linkage }); + const __eqdf2 = @import("compiler_rt/compareXf2.zig").__eqdf2; + @export(__eqdf2, .{ .name = "__eqdf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__eqtf2", .linkage = linkage }); + + const __ltsf2 = @import("compiler_rt/compareXf2.zig").__ltsf2; + @export(__ltsf2, .{ .name = "__ltsf2", .linkage = linkage }); + const __ltdf2 = @import("compiler_rt/compareXf2.zig").__ltdf2; + @export(__ltdf2, .{ .name = "__ltdf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__lttf2", .linkage = linkage }); + + const __nesf2 = @import("compiler_rt/compareXf2.zig").__nesf2; + @export(__nesf2, .{ .name = "__nesf2", .linkage = linkage }); + const __nedf2 = @import("compiler_rt/compareXf2.zig").__nedf2; + @export(__nedf2, .{ .name = "__nedf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__netf2", .linkage = linkage }); + + const __gtsf2 = @import("compiler_rt/compareXf2.zig").__gtsf2; + @export(__gtsf2, .{ .name = "__gtsf2", .linkage = linkage }); + const __gtdf2 = @import("compiler_rt/compareXf2.zig").__gtdf2; + @export(__gtdf2, .{ .name = "__gtdf2", .linkage = linkage }); + @export(__getf2, .{ .name = "__gttf2", .linkage = linkage }); + + const __extendhfsf2 = @import("compiler_rt/extendXfYf2.zig").__extendhfsf2; + @export(__extendhfsf2, .{ .name = "__gnu_h2f_ieee", .linkage = linkage }); + const __truncsfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncsfhf2; + @export(__truncsfhf2, .{ .name = "__gnu_f2h_ieee", .linkage = linkage }); } - @export(@import("compiler_rt/compareXf2.zig").__unordsf2, .{ .name = "__unordsf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__unorddf2, .{ .name = "__unorddf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__unordtf2, .{ .name = "__unordtf2", .linkage = linkage }); - - @export(@import("compiler_rt/addXf3.zig").__addsf3, .{ .name = "__addsf3", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__adddf3, .{ .name = "__adddf3", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__addtf3, .{ .name = "__addtf3", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__subsf3, .{ .name = "__subsf3", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__subdf3, .{ .name = "__subdf3", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__subtf3, .{ .name = "__subtf3", .linkage = linkage }); - - @export(@import("compiler_rt/mulXf3.zig").__mulsf3, .{ .name = "__mulsf3", .linkage = linkage }); - @export(@import("compiler_rt/mulXf3.zig").__muldf3, .{ .name = "__muldf3", .linkage = linkage }); - @export(@import("compiler_rt/mulXf3.zig").__multf3, .{ .name = "__multf3", .linkage = linkage }); - - @export(@import("compiler_rt/divsf3.zig").__divsf3, .{ .name = "__divsf3", .linkage = linkage }); - @export(@import("compiler_rt/divdf3.zig").__divdf3, .{ .name = "__divdf3", .linkage = linkage }); - @export(@import("compiler_rt/divtf3.zig").__divtf3, .{ .name = "__divtf3", .linkage = linkage }); - - @export(@import("compiler_rt/shift.zig").__ashldi3, .{ .name = "__ashldi3", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__ashlti3, .{ .name = "__ashlti3", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__ashrdi3, .{ .name = "__ashrdi3", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__ashrti3, .{ .name = "__ashrti3", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__lshrdi3, .{ .name = "__lshrdi3", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__lshrti3, .{ .name = "__lshrti3", .linkage = linkage }); - - @export(@import("compiler_rt/floatsiXf.zig").__floatsidf, .{ .name = "__floatsidf", .linkage = linkage }); - @export(@import("compiler_rt/floatsiXf.zig").__floatsisf, .{ .name = "__floatsisf", .linkage = linkage }); - @export(@import("compiler_rt/floatdidf.zig").__floatdidf, .{ .name = "__floatdidf", .linkage = linkage }); - @export(@import("compiler_rt/floatsiXf.zig").__floatsitf, .{ .name = "__floatsitf", .linkage = linkage }); - - @export(@import("compiler_rt/floatunsisf.zig").__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage }); - @export(@import("compiler_rt/floatundisf.zig").__floatundisf, .{ .name = "__floatundisf", .linkage = linkage }); - @export(@import("compiler_rt/floatunsidf.zig").__floatunsidf, .{ .name = "__floatunsidf", .linkage = linkage }); - @export(@import("compiler_rt/floatundidf.zig").__floatundidf, .{ .name = "__floatundidf", .linkage = linkage }); - - @export(@import("compiler_rt/floatditf.zig").__floatditf, .{ .name = "__floatditf", .linkage = linkage }); - @export(@import("compiler_rt/floattitf.zig").__floattitf, .{ .name = "__floattitf", .linkage = linkage }); - @export(@import("compiler_rt/floattidf.zig").__floattidf, .{ .name = "__floattidf", .linkage = linkage }); - @export(@import("compiler_rt/floatXisf.zig").__floattisf, .{ .name = "__floattisf", .linkage = linkage }); - @export(@import("compiler_rt/floatXisf.zig").__floatdisf, .{ .name = "__floatdisf", .linkage = linkage }); - - @export(@import("compiler_rt/floatunditf.zig").__floatunditf, .{ .name = "__floatunditf", .linkage = linkage }); - @export(@import("compiler_rt/floatunsitf.zig").__floatunsitf, .{ .name = "__floatunsitf", .linkage = linkage }); - - @export(@import("compiler_rt/floatuntitf.zig").__floatuntitf, .{ .name = "__floatuntitf", .linkage = linkage }); - @export(@import("compiler_rt/floatuntidf.zig").__floatuntidf, .{ .name = "__floatuntidf", .linkage = linkage }); - @export(@import("compiler_rt/floatuntisf.zig").__floatuntisf, .{ .name = "__floatuntisf", .linkage = linkage }); - - @export(@import("compiler_rt/extendXfYf2.zig").__extenddftf2, .{ .name = "__extenddftf2", .linkage = linkage }); - @export(@import("compiler_rt/extendXfYf2.zig").__extendsftf2, .{ .name = "__extendsftf2", .linkage = linkage }); - @export(@import("compiler_rt/extendXfYf2.zig").__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = linkage }); - @export(@import("compiler_rt/extendXfYf2.zig").__extendhftf2, .{ .name = "__extendhftf2", .linkage = linkage }); - - @export(@import("compiler_rt/truncXfYf2.zig").__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = linkage }); - - @export(@import("compiler_rt/truncXfYf2.zig").__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = linkage }); - - @export(@import("compiler_rt/extendXfYf2.zig").__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = linkage }); - - @export(@import("compiler_rt/fixunssfsi.zig").__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixunssfdi.zig").__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixunssfti.zig").__fixunssfti, .{ .name = "__fixunssfti", .linkage = linkage }); - - @export(@import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixunsdfti.zig").__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = linkage }); - - @export(@import("compiler_rt/fixunstfsi.zig").__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixunstfdi.zig").__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixunstfti.zig").__fixunstfti, .{ .name = "__fixunstfti", .linkage = linkage }); - - @export(@import("compiler_rt/fixdfdi.zig").__fixdfdi, .{ .name = "__fixdfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixdfsi.zig").__fixdfsi, .{ .name = "__fixdfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixdfti.zig").__fixdfti, .{ .name = "__fixdfti", .linkage = linkage }); - @export(@import("compiler_rt/fixsfdi.zig").__fixsfdi, .{ .name = "__fixsfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixsfsi.zig").__fixsfsi, .{ .name = "__fixsfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixsfti.zig").__fixsfti, .{ .name = "__fixsfti", .linkage = linkage }); - @export(@import("compiler_rt/fixtfdi.zig").__fixtfdi, .{ .name = "__fixtfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixtfsi.zig").__fixtfsi, .{ .name = "__fixtfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixtfti.zig").__fixtfti, .{ .name = "__fixtfti", .linkage = linkage }); - - @export(@import("compiler_rt/int.zig").__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = linkage }); - @export(@import("compiler_rt/popcountdi2.zig").__popcountdi2, .{ .name = "__popcountdi2", .linkage = linkage }); - - @export(@import("compiler_rt/int.zig").__mulsi3, .{ .name = "__mulsi3", .linkage = linkage }); - @export(@import("compiler_rt/muldi3.zig").__muldi3, .{ .name = "__muldi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__divmoddi4, .{ .name = "__divmoddi4", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__divsi3, .{ .name = "__divsi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__divdi3, .{ .name = "__divdi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__udivsi3, .{ .name = "__udivsi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__udivdi3, .{ .name = "__udivdi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__modsi3, .{ .name = "__modsi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__moddi3, .{ .name = "__moddi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__umodsi3, .{ .name = "__umodsi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__umoddi3, .{ .name = "__umoddi3", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__divmodsi4, .{ .name = "__divmodsi4", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = linkage }); - - @export(@import("compiler_rt/negXf2.zig").__negsf2, .{ .name = "__negsf2", .linkage = linkage }); - @export(@import("compiler_rt/negXf2.zig").__negdf2, .{ .name = "__negdf2", .linkage = linkage }); - - @export(@import("compiler_rt/clzsi2.zig").__clzsi2, .{ .name = "__clzsi2", .linkage = linkage }); + const __unordsf2 = @import("compiler_rt/compareXf2.zig").__unordsf2; + @export(__unordsf2, .{ .name = "__unordsf2", .linkage = linkage }); + const __unorddf2 = @import("compiler_rt/compareXf2.zig").__unorddf2; + @export(__unorddf2, .{ .name = "__unorddf2", .linkage = linkage }); + const __unordtf2 = @import("compiler_rt/compareXf2.zig").__unordtf2; + @export(__unordtf2, .{ .name = "__unordtf2", .linkage = linkage }); + + const __addsf3 = @import("compiler_rt/addXf3.zig").__addsf3; + @export(__addsf3, .{ .name = "__addsf3", .linkage = linkage }); + const __adddf3 = @import("compiler_rt/addXf3.zig").__adddf3; + @export(__adddf3, .{ .name = "__adddf3", .linkage = linkage }); + const __addtf3 = @import("compiler_rt/addXf3.zig").__addtf3; + @export(__addtf3, .{ .name = "__addtf3", .linkage = linkage }); + const __subsf3 = @import("compiler_rt/addXf3.zig").__subsf3; + @export(__subsf3, .{ .name = "__subsf3", .linkage = linkage }); + const __subdf3 = @import("compiler_rt/addXf3.zig").__subdf3; + @export(__subdf3, .{ .name = "__subdf3", .linkage = linkage }); + const __subtf3 = @import("compiler_rt/addXf3.zig").__subtf3; + @export(__subtf3, .{ .name = "__subtf3", .linkage = linkage }); + + const __mulsf3 = @import("compiler_rt/mulXf3.zig").__mulsf3; + @export(__mulsf3, .{ .name = "__mulsf3", .linkage = linkage }); + const __muldf3 = @import("compiler_rt/mulXf3.zig").__muldf3; + @export(__muldf3, .{ .name = "__muldf3", .linkage = linkage }); + const __multf3 = @import("compiler_rt/mulXf3.zig").__multf3; + @export(__multf3, .{ .name = "__multf3", .linkage = linkage }); + + const __divsf3 = @import("compiler_rt/divsf3.zig").__divsf3; + @export(__divsf3, .{ .name = "__divsf3", .linkage = linkage }); + const __divdf3 = @import("compiler_rt/divdf3.zig").__divdf3; + @export(__divdf3, .{ .name = "__divdf3", .linkage = linkage }); + const __divtf3 = @import("compiler_rt/divtf3.zig").__divtf3; + @export(__divtf3, .{ .name = "__divtf3", .linkage = linkage }); + + const __ashldi3 = @import("compiler_rt/shift.zig").__ashldi3; + @export(__ashldi3, .{ .name = "__ashldi3", .linkage = linkage }); + const __ashlti3 = @import("compiler_rt/shift.zig").__ashlti3; + @export(__ashlti3, .{ .name = "__ashlti3", .linkage = linkage }); + const __ashrdi3 = @import("compiler_rt/shift.zig").__ashrdi3; + @export(__ashrdi3, .{ .name = "__ashrdi3", .linkage = linkage }); + const __ashrti3 = @import("compiler_rt/shift.zig").__ashrti3; + @export(__ashrti3, .{ .name = "__ashrti3", .linkage = linkage }); + const __lshrdi3 = @import("compiler_rt/shift.zig").__lshrdi3; + @export(__lshrdi3, .{ .name = "__lshrdi3", .linkage = linkage }); + const __lshrti3 = @import("compiler_rt/shift.zig").__lshrti3; + @export(__lshrti3, .{ .name = "__lshrti3", .linkage = linkage }); + + const __floatsidf = @import("compiler_rt/floatsiXf.zig").__floatsidf; + @export(__floatsidf, .{ .name = "__floatsidf", .linkage = linkage }); + const __floatsisf = @import("compiler_rt/floatsiXf.zig").__floatsisf; + @export(__floatsisf, .{ .name = "__floatsisf", .linkage = linkage }); + const __floatdidf = @import("compiler_rt/floatdidf.zig").__floatdidf; + @export(__floatdidf, .{ .name = "__floatdidf", .linkage = linkage }); + const __floatsitf = @import("compiler_rt/floatsiXf.zig").__floatsitf; + @export(__floatsitf, .{ .name = "__floatsitf", .linkage = linkage }); + + const __floatunsisf = @import("compiler_rt/floatunsisf.zig").__floatunsisf; + @export(__floatunsisf, .{ .name = "__floatunsisf", .linkage = linkage }); + const __floatundisf = @import("compiler_rt/floatundisf.zig").__floatundisf; + @export(__floatundisf, .{ .name = "__floatundisf", .linkage = linkage }); + const __floatunsidf = @import("compiler_rt/floatunsidf.zig").__floatunsidf; + @export(__floatunsidf, .{ .name = "__floatunsidf", .linkage = linkage }); + const __floatundidf = @import("compiler_rt/floatundidf.zig").__floatundidf; + @export(__floatundidf, .{ .name = "__floatundidf", .linkage = linkage }); + + const __floatditf = @import("compiler_rt/floatditf.zig").__floatditf; + @export(__floatditf, .{ .name = "__floatditf", .linkage = linkage }); + const __floattitf = @import("compiler_rt/floattitf.zig").__floattitf; + @export(__floattitf, .{ .name = "__floattitf", .linkage = linkage }); + const __floattidf = @import("compiler_rt/floattidf.zig").__floattidf; + @export(__floattidf, .{ .name = "__floattidf", .linkage = linkage }); + const __floattisf = @import("compiler_rt/floatXisf.zig").__floattisf; + @export(__floattisf, .{ .name = "__floattisf", .linkage = linkage }); + const __floatdisf = @import("compiler_rt/floatXisf.zig").__floatdisf; + @export(__floatdisf, .{ .name = "__floatdisf", .linkage = linkage }); + + const __floatunditf = @import("compiler_rt/floatunditf.zig").__floatunditf; + @export(__floatunditf, .{ .name = "__floatunditf", .linkage = linkage }); + const __floatunsitf = @import("compiler_rt/floatunsitf.zig").__floatunsitf; + @export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = linkage }); + + const __floatuntitf = @import("compiler_rt/floatuntitf.zig").__floatuntitf; + @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = linkage }); + const __floatuntidf = @import("compiler_rt/floatuntidf.zig").__floatuntidf; + @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = linkage }); + const __floatuntisf = @import("compiler_rt/floatuntisf.zig").__floatuntisf; + @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = linkage }); + + const __extenddftf2 = @import("compiler_rt/extendXfYf2.zig").__extenddftf2; + @export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = linkage }); + const __extendsftf2 = @import("compiler_rt/extendXfYf2.zig").__extendsftf2; + @export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = linkage }); + const __extendhfsf2 = @import("compiler_rt/extendXfYf2.zig").__extendhfsf2; + @export(__extendhfsf2, .{ .name = "__extendhfsf2", .linkage = linkage }); + const __extendhftf2 = @import("compiler_rt/extendXfYf2.zig").__extendhftf2; + @export(__extendhftf2, .{ .name = "__extendhftf2", .linkage = linkage }); + + const __truncsfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncsfhf2; + @export(__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = linkage }); + const __truncdfhf2 = @import("compiler_rt/truncXfYf2.zig").__truncdfhf2; + @export(__truncdfhf2, .{ .name = "__truncdfhf2", .linkage = linkage }); + const __trunctfhf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfhf2; + @export(__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = linkage }); + const __trunctfdf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfdf2; + @export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = linkage }); + const __trunctfsf2 = @import("compiler_rt/truncXfYf2.zig").__trunctfsf2; + @export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = linkage }); + + const __truncdfsf2 = @import("compiler_rt/truncXfYf2.zig").__truncdfsf2; + @export(__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = linkage }); + + const __extendsfdf2 = @import("compiler_rt/extendXfYf2.zig").__extendsfdf2; + @export(__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = linkage }); + + const __fixunssfsi = @import("compiler_rt/fixunssfsi.zig").__fixunssfsi; + @export(__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = linkage }); + const __fixunssfdi = @import("compiler_rt/fixunssfdi.zig").__fixunssfdi; + @export(__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = linkage }); + const __fixunssfti = @import("compiler_rt/fixunssfti.zig").__fixunssfti; + @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = linkage }); + + const __fixunsdfsi = @import("compiler_rt/fixunsdfsi.zig").__fixunsdfsi; + @export(__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = linkage }); + const __fixunsdfdi = @import("compiler_rt/fixunsdfdi.zig").__fixunsdfdi; + @export(__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = linkage }); + const __fixunsdfti = @import("compiler_rt/fixunsdfti.zig").__fixunsdfti; + @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = linkage }); + + const __fixunstfsi = @import("compiler_rt/fixunstfsi.zig").__fixunstfsi; + @export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = linkage }); + const __fixunstfdi = @import("compiler_rt/fixunstfdi.zig").__fixunstfdi; + @export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = linkage }); + const __fixunstfti = @import("compiler_rt/fixunstfti.zig").__fixunstfti; + @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = linkage }); + + const __fixdfdi = @import("compiler_rt/fixdfdi.zig").__fixdfdi; + @export(__fixdfdi, .{ .name = "__fixdfdi", .linkage = linkage }); + const __fixdfsi = @import("compiler_rt/fixdfsi.zig").__fixdfsi; + @export(__fixdfsi, .{ .name = "__fixdfsi", .linkage = linkage }); + const __fixdfti = @import("compiler_rt/fixdfti.zig").__fixdfti; + @export(__fixdfti, .{ .name = "__fixdfti", .linkage = linkage }); + const __fixsfdi = @import("compiler_rt/fixsfdi.zig").__fixsfdi; + @export(__fixsfdi, .{ .name = "__fixsfdi", .linkage = linkage }); + const __fixsfsi = @import("compiler_rt/fixsfsi.zig").__fixsfsi; + @export(__fixsfsi, .{ .name = "__fixsfsi", .linkage = linkage }); + const __fixsfti = @import("compiler_rt/fixsfti.zig").__fixsfti; + @export(__fixsfti, .{ .name = "__fixsfti", .linkage = linkage }); + const __fixtfdi = @import("compiler_rt/fixtfdi.zig").__fixtfdi; + @export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = linkage }); + const __fixtfsi = @import("compiler_rt/fixtfsi.zig").__fixtfsi; + @export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = linkage }); + const __fixtfti = @import("compiler_rt/fixtfti.zig").__fixtfti; + @export(__fixtfti, .{ .name = "__fixtfti", .linkage = linkage }); + + const __udivmoddi4 = @import("compiler_rt/int.zig").__udivmoddi4; + @export(__udivmoddi4, .{ .name = "__udivmoddi4", .linkage = linkage }); + const __popcountdi2 = @import("compiler_rt/popcountdi2.zig").__popcountdi2; + @export(__popcountdi2, .{ .name = "__popcountdi2", .linkage = linkage }); + + const __mulsi3 = @import("compiler_rt/int.zig").__mulsi3; + @export(__mulsi3, .{ .name = "__mulsi3", .linkage = linkage }); + const __muldi3 = @import("compiler_rt/muldi3.zig").__muldi3; + @export(__muldi3, .{ .name = "__muldi3", .linkage = linkage }); + const __divmoddi4 = @import("compiler_rt/int.zig").__divmoddi4; + @export(__divmoddi4, .{ .name = "__divmoddi4", .linkage = linkage }); + const __divsi3 = @import("compiler_rt/int.zig").__divsi3; + @export(__divsi3, .{ .name = "__divsi3", .linkage = linkage }); + const __divdi3 = @import("compiler_rt/int.zig").__divdi3; + @export(__divdi3, .{ .name = "__divdi3", .linkage = linkage }); + const __udivsi3 = @import("compiler_rt/int.zig").__udivsi3; + @export(__udivsi3, .{ .name = "__udivsi3", .linkage = linkage }); + const __udivdi3 = @import("compiler_rt/int.zig").__udivdi3; + @export(__udivdi3, .{ .name = "__udivdi3", .linkage = linkage }); + const __modsi3 = @import("compiler_rt/int.zig").__modsi3; + @export(__modsi3, .{ .name = "__modsi3", .linkage = linkage }); + const __moddi3 = @import("compiler_rt/int.zig").__moddi3; + @export(__moddi3, .{ .name = "__moddi3", .linkage = linkage }); + const __umodsi3 = @import("compiler_rt/int.zig").__umodsi3; + @export(__umodsi3, .{ .name = "__umodsi3", .linkage = linkage }); + const __umoddi3 = @import("compiler_rt/int.zig").__umoddi3; + @export(__umoddi3, .{ .name = "__umoddi3", .linkage = linkage }); + const __divmodsi4 = @import("compiler_rt/int.zig").__divmodsi4; + @export(__divmodsi4, .{ .name = "__divmodsi4", .linkage = linkage }); + const __udivmodsi4 = @import("compiler_rt/int.zig").__udivmodsi4; + @export(__udivmodsi4, .{ .name = "__udivmodsi4", .linkage = linkage }); + + const __negsf2 = @import("compiler_rt/negXf2.zig").__negsf2; + @export(__negsf2, .{ .name = "__negsf2", .linkage = linkage }); + const __negdf2 = @import("compiler_rt/negXf2.zig").__negdf2; + @export(__negdf2, .{ .name = "__negdf2", .linkage = linkage }); + + const __clzsi2 = @import("compiler_rt/clzsi2.zig").__clzsi2; + @export(__clzsi2, .{ .name = "__clzsi2", .linkage = linkage }); if (builtin.link_libc and os_tag == .openbsd) { - @export(@import("compiler_rt/emutls.zig").__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = linkage }); + const __emutls_get_address = @import("compiler_rt/emutls.zig").__emutls_get_address; + @export(__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = linkage }); } if ((arch.isARM() or arch.isThumb()) and !is_test) { - @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage }); - - @export(@import("compiler_rt/muldi3.zig").__muldi3, .{ .name = "__aeabi_lmul", .linkage = linkage }); - - @export(@import("compiler_rt/arm.zig").__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = linkage }); - - @export(@import("compiler_rt/int.zig").__divsi3, .{ .name = "__aeabi_idiv", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = linkage }); - @export(@import("compiler_rt/int.zig").__udivsi3, .{ .name = "__aeabi_uidiv", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = linkage }); - - @export(@import("compiler_rt/arm.zig").__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memcpy, .{ .name = "__aeabi_memcpy4", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memcpy, .{ .name = "__aeabi_memcpy8", .linkage = linkage }); - - @export(@import("compiler_rt/arm.zig").__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memmove, .{ .name = "__aeabi_memmove4", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memmove, .{ .name = "__aeabi_memmove8", .linkage = linkage }); - - @export(@import("compiler_rt/arm.zig").__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memset, .{ .name = "__aeabi_memset4", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memset, .{ .name = "__aeabi_memset8", .linkage = linkage }); - - @export(@import("compiler_rt/arm.zig").__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memclr, .{ .name = "__aeabi_memclr4", .linkage = linkage }); - @export(@import("compiler_rt/arm.zig").__aeabi_memclr, .{ .name = "__aeabi_memclr8", .linkage = linkage }); + const __aeabi_unwind_cpp_pr0 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr0; + @export(__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = linkage }); + const __aeabi_unwind_cpp_pr1 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr1; + @export(__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = linkage }); + const __aeabi_unwind_cpp_pr2 = @import("compiler_rt/arm.zig").__aeabi_unwind_cpp_pr2; + @export(__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = linkage }); + + @export(__muldi3, .{ .name = "__aeabi_lmul", .linkage = linkage }); + + const __aeabi_ldivmod = @import("compiler_rt/arm.zig").__aeabi_ldivmod; + @export(__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = linkage }); + const __aeabi_uldivmod = @import("compiler_rt/arm.zig").__aeabi_uldivmod; + @export(__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = linkage }); + + @export(__divsi3, .{ .name = "__aeabi_idiv", .linkage = linkage }); + const __aeabi_idivmod = @import("compiler_rt/arm.zig").__aeabi_idivmod; + @export(__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = linkage }); + @export(__udivsi3, .{ .name = "__aeabi_uidiv", .linkage = linkage }); + const __aeabi_uidivmod = @import("compiler_rt/arm.zig").__aeabi_uidivmod; + @export(__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = linkage }); + + const __aeabi_memcpy = @import("compiler_rt/arm.zig").__aeabi_memcpy; + @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = linkage }); + @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy4", .linkage = linkage }); + @export(__aeabi_memcpy, .{ .name = "__aeabi_memcpy8", .linkage = linkage }); + + const __aeabi_memmove = @import("compiler_rt/arm.zig").__aeabi_memmove; + @export(__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = linkage }); + @export(__aeabi_memmove, .{ .name = "__aeabi_memmove4", .linkage = linkage }); + @export(__aeabi_memmove, .{ .name = "__aeabi_memmove8", .linkage = linkage }); + + const __aeabi_memset = @import("compiler_rt/arm.zig").__aeabi_memset; + @export(__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = linkage }); + @export(__aeabi_memset, .{ .name = "__aeabi_memset4", .linkage = linkage }); + @export(__aeabi_memset, .{ .name = "__aeabi_memset8", .linkage = linkage }); + + const __aeabi_memclr = @import("compiler_rt/arm.zig").__aeabi_memclr; + @export(__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = linkage }); + @export(__aeabi_memclr, .{ .name = "__aeabi_memclr4", .linkage = linkage }); + @export(__aeabi_memclr, .{ .name = "__aeabi_memclr8", .linkage = linkage }); if (os_tag == .linux) { - @export(@import("compiler_rt/arm.zig").__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = linkage }); + const __aeabi_read_tp = @import("compiler_rt/arm.zig").__aeabi_read_tp; + @export(__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = linkage }); } - @export(@import("compiler_rt/extendXfYf2.zig").__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = linkage }); - @export(@import("compiler_rt/floatsiXf.zig").__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = linkage }); - @export(@import("compiler_rt/floatdidf.zig").__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = linkage }); - @export(@import("compiler_rt/floatXisf.zig").__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = linkage }); - @export(@import("compiler_rt/floatunsidf.zig").__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = linkage }); - @export(@import("compiler_rt/floatundidf.zig").__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = linkage }); - @export(@import("compiler_rt/floatunsisf.zig").__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = linkage }); - @export(@import("compiler_rt/floatundisf.zig").__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = linkage }); - - @export(@import("compiler_rt/negXf2.zig").__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = linkage }); - @export(@import("compiler_rt/negXf2.zig").__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = linkage }); - - @export(@import("compiler_rt/mulXf3.zig").__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = linkage }); - @export(@import("compiler_rt/mulXf3.zig").__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = linkage }); - - @export(@import("compiler_rt/truncXfYf2.zig").__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = linkage }); - - @export(@import("compiler_rt/fixunssfdi.zig").__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = linkage }); - @export(@import("compiler_rt/fixunsdfdi.zig").__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = linkage }); - - @export(@import("compiler_rt/fixsfdi.zig").__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = linkage }); - @export(@import("compiler_rt/fixdfdi.zig").__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = linkage }); - - @export(@import("compiler_rt/fixunsdfsi.zig").__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = linkage }); - - @export(@import("compiler_rt/extendXfYf2.zig").__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = linkage }); - - @export(@import("compiler_rt/floatsiXf.zig").__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = linkage }); - - @export(@import("compiler_rt/addXf3.zig").__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = linkage }); - - @export(@import("compiler_rt/fixunssfsi.zig").__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = linkage }); - - @export(@import("compiler_rt/fixsfsi.zig").__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = linkage }); - @export(@import("compiler_rt/fixdfsi.zig").__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = linkage }); - - @export(@import("compiler_rt/divsf3.zig").__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = linkage }); - @export(@import("compiler_rt/divdf3.zig").__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = linkage }); - - @export(@import("compiler_rt/shift.zig").__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = linkage }); - @export(@import("compiler_rt/shift.zig").__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = linkage }); + const __aeabi_f2d = @import("compiler_rt/extendXfYf2.zig").__aeabi_f2d; + @export(__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = linkage }); + const __aeabi_i2d = @import("compiler_rt/floatsiXf.zig").__aeabi_i2d; + @export(__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = linkage }); + const __aeabi_l2d = @import("compiler_rt/floatdidf.zig").__aeabi_l2d; + @export(__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = linkage }); + const __aeabi_l2f = @import("compiler_rt/floatXisf.zig").__aeabi_l2f; + @export(__aeabi_l2f, .{ .name = "__aeabi_l2f", .linkage = linkage }); + const __aeabi_ui2d = @import("compiler_rt/floatunsidf.zig").__aeabi_ui2d; + @export(__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = linkage }); + const __aeabi_ul2d = @import("compiler_rt/floatundidf.zig").__aeabi_ul2d; + @export(__aeabi_ul2d, .{ .name = "__aeabi_ul2d", .linkage = linkage }); + const __aeabi_ui2f = @import("compiler_rt/floatunsisf.zig").__aeabi_ui2f; + @export(__aeabi_ui2f, .{ .name = "__aeabi_ui2f", .linkage = linkage }); + const __aeabi_ul2f = @import("compiler_rt/floatundisf.zig").__aeabi_ul2f; + @export(__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = linkage }); + + const __aeabi_fneg = @import("compiler_rt/negXf2.zig").__aeabi_fneg; + @export(__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = linkage }); + const __aeabi_dneg = @import("compiler_rt/negXf2.zig").__aeabi_dneg; + @export(__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = linkage }); + + const __aeabi_fmul = @import("compiler_rt/mulXf3.zig").__aeabi_fmul; + @export(__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = linkage }); + const __aeabi_dmul = @import("compiler_rt/mulXf3.zig").__aeabi_dmul; + @export(__aeabi_dmul, .{ .name = "__aeabi_dmul", .linkage = linkage }); + + const __aeabi_d2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2h; + @export(__aeabi_d2h, .{ .name = "__aeabi_d2h", .linkage = linkage }); + + const __aeabi_f2ulz = @import("compiler_rt/fixunssfdi.zig").__aeabi_f2ulz; + @export(__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = linkage }); + const __aeabi_d2ulz = @import("compiler_rt/fixunsdfdi.zig").__aeabi_d2ulz; + @export(__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = linkage }); + + const __aeabi_f2lz = @import("compiler_rt/fixsfdi.zig").__aeabi_f2lz; + @export(__aeabi_f2lz, .{ .name = "__aeabi_f2lz", .linkage = linkage }); + const __aeabi_d2lz = @import("compiler_rt/fixdfdi.zig").__aeabi_d2lz; + @export(__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = linkage }); + + const __aeabi_d2uiz = @import("compiler_rt/fixunsdfsi.zig").__aeabi_d2uiz; + @export(__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = linkage }); + + const __aeabi_h2f = @import("compiler_rt/extendXfYf2.zig").__aeabi_h2f; + @export(__aeabi_h2f, .{ .name = "__aeabi_h2f", .linkage = linkage }); + const __aeabi_f2h = @import("compiler_rt/truncXfYf2.zig").__aeabi_f2h; + @export(__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = linkage }); + + const __aeabi_i2f = @import("compiler_rt/floatsiXf.zig").__aeabi_i2f; + @export(__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = linkage }); + const __aeabi_d2f = @import("compiler_rt/truncXfYf2.zig").__aeabi_d2f; + @export(__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = linkage }); + + const __aeabi_fadd = @import("compiler_rt/addXf3.zig").__aeabi_fadd; + @export(__aeabi_fadd, .{ .name = "__aeabi_fadd", .linkage = linkage }); + const __aeabi_dadd = @import("compiler_rt/addXf3.zig").__aeabi_dadd; + @export(__aeabi_dadd, .{ .name = "__aeabi_dadd", .linkage = linkage }); + const __aeabi_fsub = @import("compiler_rt/addXf3.zig").__aeabi_fsub; + @export(__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = linkage }); + const __aeabi_dsub = @import("compiler_rt/addXf3.zig").__aeabi_dsub; + @export(__aeabi_dsub, .{ .name = "__aeabi_dsub", .linkage = linkage }); + + const __aeabi_f2uiz = @import("compiler_rt/fixunssfsi.zig").__aeabi_f2uiz; + @export(__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = linkage }); + + const __aeabi_f2iz = @import("compiler_rt/fixsfsi.zig").__aeabi_f2iz; + @export(__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = linkage }); + const __aeabi_d2iz = @import("compiler_rt/fixdfsi.zig").__aeabi_d2iz; + @export(__aeabi_d2iz, .{ .name = "__aeabi_d2iz", .linkage = linkage }); + + const __aeabi_fdiv = @import("compiler_rt/divsf3.zig").__aeabi_fdiv; + @export(__aeabi_fdiv, .{ .name = "__aeabi_fdiv", .linkage = linkage }); + const __aeabi_ddiv = @import("compiler_rt/divdf3.zig").__aeabi_ddiv; + @export(__aeabi_ddiv, .{ .name = "__aeabi_ddiv", .linkage = linkage }); + + const __aeabi_llsl = @import("compiler_rt/shift.zig").__aeabi_llsl; + @export(__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = linkage }); + const __aeabi_lasr = @import("compiler_rt/shift.zig").__aeabi_lasr; + @export(__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = linkage }); + const __aeabi_llsr = @import("compiler_rt/shift.zig").__aeabi_llsr; + @export(__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = linkage }); + + const __aeabi_fcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpeq; + @export(__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = linkage }); + const __aeabi_fcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmplt; + @export(__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = linkage }); + const __aeabi_fcmple = @import("compiler_rt/compareXf2.zig").__aeabi_fcmple; + @export(__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = linkage }); + const __aeabi_fcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpge; + @export(__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = linkage }); + const __aeabi_fcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpgt; + @export(__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = linkage }); + const __aeabi_fcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_fcmpun; + @export(__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = linkage }); + + const __aeabi_dcmpeq = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpeq; + @export(__aeabi_dcmpeq, .{ .name = "__aeabi_dcmpeq", .linkage = linkage }); + const __aeabi_dcmplt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmplt; + @export(__aeabi_dcmplt, .{ .name = "__aeabi_dcmplt", .linkage = linkage }); + const __aeabi_dcmple = @import("compiler_rt/compareXf2.zig").__aeabi_dcmple; + @export(__aeabi_dcmple, .{ .name = "__aeabi_dcmple", .linkage = linkage }); + const __aeabi_dcmpge = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpge; + @export(__aeabi_dcmpge, .{ .name = "__aeabi_dcmpge", .linkage = linkage }); + const __aeabi_dcmpgt = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpgt; + @export(__aeabi_dcmpgt, .{ .name = "__aeabi_dcmpgt", .linkage = linkage }); + const __aeabi_dcmpun = @import("compiler_rt/compareXf2.zig").__aeabi_dcmpun; + @export(__aeabi_dcmpun, .{ .name = "__aeabi_dcmpun", .linkage = linkage }); } if (arch == .i386 and abi == .msvc) { // Don't let LLVM apply the stdcall name mangling on those MSVC builtins - @export(@import("compiler_rt/aulldiv.zig")._alldiv, .{ .name = "\x01__alldiv", .linkage = strong_linkage }); - @export(@import("compiler_rt/aulldiv.zig")._aulldiv, .{ .name = "\x01__aulldiv", .linkage = strong_linkage }); - @export(@import("compiler_rt/aullrem.zig")._allrem, .{ .name = "\x01__allrem", .linkage = strong_linkage }); - @export(@import("compiler_rt/aullrem.zig")._aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); + const _alldiv = @import("compiler_rt/aulldiv.zig")._alldiv; + @export(_alldiv, .{ .name = "\x01__alldiv", .linkage = strong_linkage }); + const _aulldiv = @import("compiler_rt/aulldiv.zig")._aulldiv; + @export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = strong_linkage }); + const _allrem = @import("compiler_rt/aullrem.zig")._allrem; + @export(_allrem, .{ .name = "\x01__allrem", .linkage = strong_linkage }); + const _aullrem = @import("compiler_rt/aullrem.zig")._aullrem; + @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); } if (arch.isSPARC()) { // SPARC systems use a different naming scheme - @export(@import("compiler_rt/sparc.zig")._Qp_add, .{ .name = "_Qp_add", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_div, .{ .name = "_Qp_div", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage }); - - @export(@import("compiler_rt/sparc.zig")._Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage }); - - @export(@import("compiler_rt/sparc.zig")._Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage }); - @export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage }); + const _Qp_add = @import("compiler_rt/sparc.zig")._Qp_add; + @export(_Qp_add, .{ .name = "_Qp_add", .linkage = linkage }); + const _Qp_div = @import("compiler_rt/sparc.zig")._Qp_div; + @export(_Qp_div, .{ .name = "_Qp_div", .linkage = linkage }); + const _Qp_mul = @import("compiler_rt/sparc.zig")._Qp_mul; + @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage }); + const _Qp_sub = @import("compiler_rt/sparc.zig")._Qp_sub; + @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage }); + + const _Qp_cmp = @import("compiler_rt/sparc.zig")._Qp_cmp; + @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage }); + const _Qp_feq = @import("compiler_rt/sparc.zig")._Qp_feq; + @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage }); + const _Qp_fne = @import("compiler_rt/sparc.zig")._Qp_fne; + @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage }); + const _Qp_flt = @import("compiler_rt/sparc.zig")._Qp_flt; + @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage }); + const _Qp_fle = @import("compiler_rt/sparc.zig")._Qp_fle; + @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage }); + const _Qp_fgt = @import("compiler_rt/sparc.zig")._Qp_fgt; + @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage }); + const _Qp_fge = @import("compiler_rt/sparc.zig")._Qp_fge; + @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage }); + + const _Qp_itoq = @import("compiler_rt/sparc.zig")._Qp_itoq; + @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage }); + const _Qp_uitoq = @import("compiler_rt/sparc.zig")._Qp_uitoq; + @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage }); + const _Qp_xtoq = @import("compiler_rt/sparc.zig")._Qp_xtoq; + @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage }); + const _Qp_uxtoq = @import("compiler_rt/sparc.zig")._Qp_uxtoq; + @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage }); + const _Qp_stoq = @import("compiler_rt/sparc.zig")._Qp_stoq; + @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage }); + const _Qp_dtoq = @import("compiler_rt/sparc.zig")._Qp_dtoq; + @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage }); + const _Qp_qtoi = @import("compiler_rt/sparc.zig")._Qp_qtoi; + @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage }); + const _Qp_qtoui = @import("compiler_rt/sparc.zig")._Qp_qtoui; + @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage }); + const _Qp_qtox = @import("compiler_rt/sparc.zig")._Qp_qtox; + @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage }); + const _Qp_qtoux = @import("compiler_rt/sparc.zig")._Qp_qtoux; + @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage }); + const _Qp_qtos = @import("compiler_rt/sparc.zig")._Qp_qtos; + @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage }); + const _Qp_qtod = @import("compiler_rt/sparc.zig")._Qp_qtod; + @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage }); } if ((arch == .powerpc or arch.isPPC64()) and !is_test) { - @export(@import("compiler_rt/addXf3.zig").__addtf3, .{ .name = "__addkf3", .linkage = linkage }); - @export(@import("compiler_rt/addXf3.zig").__subtf3, .{ .name = "__subkf3", .linkage = linkage }); - @export(@import("compiler_rt/mulXf3.zig").__multf3, .{ .name = "__mulkf3", .linkage = linkage }); - @export(@import("compiler_rt/divtf3.zig").__divtf3, .{ .name = "__divkf3", .linkage = linkage }); - @export(@import("compiler_rt/extendXfYf2.zig").__extendsftf2, .{ .name = "__extendsfkf2", .linkage = linkage }); - @export(@import("compiler_rt/extendXfYf2.zig").__extenddftf2, .{ .name = "__extenddfkf2", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = linkage }); - @export(@import("compiler_rt/truncXfYf2.zig").__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = linkage }); - @export(@import("compiler_rt/fixtfdi.zig").__fixtfdi, .{ .name = "__fixkfdi", .linkage = linkage }); - @export(@import("compiler_rt/fixtfsi.zig").__fixtfsi, .{ .name = "__fixkfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixunstfsi.zig").__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = linkage }); - @export(@import("compiler_rt/fixunstfdi.zig").__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = linkage }); - @export(@import("compiler_rt/floatsiXf.zig").__floatsitf, .{ .name = "__floatsikf", .linkage = linkage }); - @export(@import("compiler_rt/floatditf.zig").__floatditf, .{ .name = "__floatdikf", .linkage = linkage }); - @export(@import("compiler_rt/floatunditf.zig").__floatunditf, .{ .name = "__floatundikf", .linkage = linkage }); - @export(@import("compiler_rt/floatunsitf.zig").__floatunsitf, .{ .name = "__floatunsikf", .linkage = linkage }); - - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__eqkf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__nekf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__getf2, .{ .name = "__gekf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__ltkf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__letf2, .{ .name = "__lekf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__getf2, .{ .name = "__gtkf2", .linkage = linkage }); - @export(@import("compiler_rt/compareXf2.zig").__unordtf2, .{ .name = "__unordkf2", .linkage = linkage }); + @export(__addtf3, .{ .name = "__addkf3", .linkage = linkage }); + @export(__subtf3, .{ .name = "__subkf3", .linkage = linkage }); + @export(__multf3, .{ .name = "__mulkf3", .linkage = linkage }); + @export(__divtf3, .{ .name = "__divkf3", .linkage = linkage }); + @export(__extendsftf2, .{ .name = "__extendsfkf2", .linkage = linkage }); + @export(__extenddftf2, .{ .name = "__extenddfkf2", .linkage = linkage }); + @export(__trunctfsf2, .{ .name = "__trunckfsf2", .linkage = linkage }); + @export(__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = linkage }); + @export(__fixtfdi, .{ .name = "__fixkfdi", .linkage = linkage }); + @export(__fixtfsi, .{ .name = "__fixkfsi", .linkage = linkage }); + @export(__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = linkage }); + @export(__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = linkage }); + @export(__floatsitf, .{ .name = "__floatsikf", .linkage = linkage }); + @export(__floatditf, .{ .name = "__floatdikf", .linkage = linkage }); + @export(__floatunditf, .{ .name = "__floatundikf", .linkage = linkage }); + @export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = linkage }); + + @export(__letf2, .{ .name = "__eqkf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__nekf2", .linkage = linkage }); + @export(__getf2, .{ .name = "__gekf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__ltkf2", .linkage = linkage }); + @export(__letf2, .{ .name = "__lekf2", .linkage = linkage }); + @export(__getf2, .{ .name = "__gtkf2", .linkage = linkage }); + @export(__unordtf2, .{ .name = "__unordkf2", .linkage = linkage }); } if (builtin.os.tag == .windows) { // Default stack-probe functions emitted by LLVM if (is_mingw) { - @export(@import("compiler_rt/stack_probe.zig")._chkstk, .{ .name = "_alloca", .linkage = strong_linkage }); - @export(@import("compiler_rt/stack_probe.zig").___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = strong_linkage }); + const _chkstk = @import("compiler_rt/stack_probe.zig")._chkstk; + @export(_chkstk, .{ .name = "_alloca", .linkage = strong_linkage }); + const ___chkstk_ms = @import("compiler_rt/stack_probe.zig").___chkstk_ms; + @export(___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = strong_linkage }); } else if (!builtin.link_libc) { // This symbols are otherwise exported by MSVCRT.lib - @export(@import("compiler_rt/stack_probe.zig")._chkstk, .{ .name = "_chkstk", .linkage = strong_linkage }); - @export(@import("compiler_rt/stack_probe.zig").__chkstk, .{ .name = "__chkstk", .linkage = strong_linkage }); + const _chkstk = @import("compiler_rt/stack_probe.zig")._chkstk; + @export(_chkstk, .{ .name = "_chkstk", .linkage = strong_linkage }); + const __chkstk = @import("compiler_rt/stack_probe.zig").__chkstk; + @export(__chkstk, .{ .name = "__chkstk", .linkage = strong_linkage }); } switch (arch) { .i386 => { - @export(@import("compiler_rt/divti3.zig").__divti3, .{ .name = "__divti3", .linkage = linkage }); - @export(@import("compiler_rt/modti3.zig").__modti3, .{ .name = "__modti3", .linkage = linkage }); - @export(@import("compiler_rt/multi3.zig").__multi3, .{ .name = "__multi3", .linkage = linkage }); - @export(@import("compiler_rt/udivti3.zig").__udivti3, .{ .name = "__udivti3", .linkage = linkage }); - @export(@import("compiler_rt/udivmodti4.zig").__udivmodti4, .{ .name = "__udivmodti4", .linkage = linkage }); - @export(@import("compiler_rt/umodti3.zig").__umodti3, .{ .name = "__umodti3", .linkage = linkage }); + const __divti3 = @import("compiler_rt/divti3.zig").__divti3; + @export(__divti3, .{ .name = "__divti3", .linkage = linkage }); + const __modti3 = @import("compiler_rt/modti3.zig").__modti3; + @export(__modti3, .{ .name = "__modti3", .linkage = linkage }); + const __multi3 = @import("compiler_rt/multi3.zig").__multi3; + @export(__multi3, .{ .name = "__multi3", .linkage = linkage }); + const __udivti3 = @import("compiler_rt/udivti3.zig").__udivti3; + @export(__udivti3, .{ .name = "__udivti3", .linkage = linkage }); + const __udivmodti4 = @import("compiler_rt/udivmodti4.zig").__udivmodti4; + @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = linkage }); + const __umodti3 = @import("compiler_rt/umodti3.zig").__umodti3; + @export(__umodti3, .{ .name = "__umodti3", .linkage = linkage }); }, .x86_64 => { // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI // that LLVM expects compiler-rt to have. - @export(@import("compiler_rt/divti3.zig").__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = linkage }); - @export(@import("compiler_rt/modti3.zig").__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = linkage }); - @export(@import("compiler_rt/multi3.zig").__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = linkage }); - @export(@import("compiler_rt/udivti3.zig").__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = linkage }); - @export(@import("compiler_rt/udivmodti4.zig").__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = linkage }); - @export(@import("compiler_rt/umodti3.zig").__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = linkage }); + const __divti3_windows_x86_64 = @import("compiler_rt/divti3.zig").__divti3_windows_x86_64; + @export(__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = linkage }); + const __modti3_windows_x86_64 = @import("compiler_rt/modti3.zig").__modti3_windows_x86_64; + @export(__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = linkage }); + const __multi3_windows_x86_64 = @import("compiler_rt/multi3.zig").__multi3_windows_x86_64; + @export(__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = linkage }); + const __udivti3_windows_x86_64 = @import("compiler_rt/udivti3.zig").__udivti3_windows_x86_64; + @export(__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = linkage }); + const __udivmodti4_windows_x86_64 = @import("compiler_rt/udivmodti4.zig").__udivmodti4_windows_x86_64; + @export(__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = linkage }); + const __umodti3_windows_x86_64 = @import("compiler_rt/umodti3.zig").__umodti3_windows_x86_64; + @export(__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = linkage }); }, else => {}, } } else { - @export(@import("compiler_rt/divti3.zig").__divti3, .{ .name = "__divti3", .linkage = linkage }); - @export(@import("compiler_rt/modti3.zig").__modti3, .{ .name = "__modti3", .linkage = linkage }); - @export(@import("compiler_rt/multi3.zig").__multi3, .{ .name = "__multi3", .linkage = linkage }); - @export(@import("compiler_rt/udivti3.zig").__udivti3, .{ .name = "__udivti3", .linkage = linkage }); - @export(@import("compiler_rt/udivmodti4.zig").__udivmodti4, .{ .name = "__udivmodti4", .linkage = linkage }); - @export(@import("compiler_rt/umodti3.zig").__umodti3, .{ .name = "__umodti3", .linkage = linkage }); + const __divti3 = @import("compiler_rt/divti3.zig").__divti3; + @export(__divti3, .{ .name = "__divti3", .linkage = linkage }); + const __modti3 = @import("compiler_rt/modti3.zig").__modti3; + @export(__modti3, .{ .name = "__modti3", .linkage = linkage }); + const __multi3 = @import("compiler_rt/multi3.zig").__multi3; + @export(__multi3, .{ .name = "__multi3", .linkage = linkage }); + const __udivti3 = @import("compiler_rt/udivti3.zig").__udivti3; + @export(__udivti3, .{ .name = "__udivti3", .linkage = linkage }); + const __udivmodti4 = @import("compiler_rt/udivmodti4.zig").__udivmodti4; + @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = linkage }); + const __umodti3 = @import("compiler_rt/umodti3.zig").__umodti3; + @export(__umodti3, .{ .name = "__umodti3", .linkage = linkage }); } - @export(@import("compiler_rt/muloti4.zig").__muloti4, .{ .name = "__muloti4", .linkage = linkage }); - @export(@import("compiler_rt/mulodi4.zig").__mulodi4, .{ .name = "__mulodi4", .linkage = linkage }); + const __muloti4 = @import("compiler_rt/muloti4.zig").__muloti4; + @export(__muloti4, .{ .name = "__muloti4", .linkage = linkage }); + const __mulodi4 = @import("compiler_rt/mulodi4.zig").__mulodi4; + @export(__mulodi4, .{ .name = "__mulodi4", .linkage = linkage }); } pub usingnamespace @import("compiler_rt/atomics.zig"); diff --git a/lib/std/special/compiler_rt/atomics.zig b/lib/std/special/compiler_rt/atomics.zig index 3ca946c62a2f..e448a580ca5c 100644 --- a/lib/std/special/compiler_rt/atomics.zig +++ b/lib/std/special/compiler_rt/atomics.zig @@ -148,10 +148,14 @@ fn atomicLoadFn(comptime T: type) fn (*T, i32) callconv(.C) T { comptime { if (supports_atomic_ops) { - @export(atomicLoadFn(u8), .{ .name = "__atomic_load_1", .linkage = linkage }); - @export(atomicLoadFn(u16), .{ .name = "__atomic_load_2", .linkage = linkage }); - @export(atomicLoadFn(u32), .{ .name = "__atomic_load_4", .linkage = linkage }); - @export(atomicLoadFn(u64), .{ .name = "__atomic_load_8", .linkage = linkage }); + const atomicLoad_u8 = atomicLoadFn(u8); + const atomicLoad_u16 = atomicLoadFn(u16); + const atomicLoad_u32 = atomicLoadFn(u32); + const atomicLoad_u64 = atomicLoadFn(u64); + @export(atomicLoad_u8, .{ .name = "__atomic_load_1", .linkage = linkage }); + @export(atomicLoad_u16, .{ .name = "__atomic_load_2", .linkage = linkage }); + @export(atomicLoad_u32, .{ .name = "__atomic_load_4", .linkage = linkage }); + @export(atomicLoad_u64, .{ .name = "__atomic_load_8", .linkage = linkage }); } } @@ -171,10 +175,14 @@ fn atomicStoreFn(comptime T: type) fn (*T, T, i32) callconv(.C) void { comptime { if (supports_atomic_ops) { - @export(atomicStoreFn(u8), .{ .name = "__atomic_store_1", .linkage = linkage }); - @export(atomicStoreFn(u16), .{ .name = "__atomic_store_2", .linkage = linkage }); - @export(atomicStoreFn(u32), .{ .name = "__atomic_store_4", .linkage = linkage }); - @export(atomicStoreFn(u64), .{ .name = "__atomic_store_8", .linkage = linkage }); + const atomicStore_u8 = atomicStoreFn(u8); + const atomicStore_u16 = atomicStoreFn(u16); + const atomicStore_u32 = atomicStoreFn(u32); + const atomicStore_u64 = atomicStoreFn(u64); + @export(atomicStore_u8, .{ .name = "__atomic_store_1", .linkage = linkage }); + @export(atomicStore_u16, .{ .name = "__atomic_store_2", .linkage = linkage }); + @export(atomicStore_u32, .{ .name = "__atomic_store_4", .linkage = linkage }); + @export(atomicStore_u64, .{ .name = "__atomic_store_8", .linkage = linkage }); } } @@ -196,10 +204,14 @@ fn atomicExchangeFn(comptime T: type) fn (*T, T, i32) callconv(.C) T { comptime { if (supports_atomic_ops) { - @export(atomicExchangeFn(u8), .{ .name = "__atomic_exchange_1", .linkage = linkage }); - @export(atomicExchangeFn(u16), .{ .name = "__atomic_exchange_2", .linkage = linkage }); - @export(atomicExchangeFn(u32), .{ .name = "__atomic_exchange_4", .linkage = linkage }); - @export(atomicExchangeFn(u64), .{ .name = "__atomic_exchange_8", .linkage = linkage }); + const atomicExchange_u8 = atomicExchangeFn(u8); + const atomicExchange_u16 = atomicExchangeFn(u16); + const atomicExchange_u32 = atomicExchangeFn(u32); + const atomicExchange_u64 = atomicExchangeFn(u64); + @export(atomicExchange_u8, .{ .name = "__atomic_exchange_1", .linkage = linkage }); + @export(atomicExchange_u16, .{ .name = "__atomic_exchange_2", .linkage = linkage }); + @export(atomicExchange_u32, .{ .name = "__atomic_exchange_4", .linkage = linkage }); + @export(atomicExchange_u64, .{ .name = "__atomic_exchange_8", .linkage = linkage }); } } @@ -229,10 +241,14 @@ fn atomicCompareExchangeFn(comptime T: type) fn (*T, *T, T, i32, i32) callconv(. comptime { if (supports_atomic_ops) { - @export(atomicCompareExchangeFn(u8), .{ .name = "__atomic_compare_exchange_1", .linkage = linkage }); - @export(atomicCompareExchangeFn(u16), .{ .name = "__atomic_compare_exchange_2", .linkage = linkage }); - @export(atomicCompareExchangeFn(u32), .{ .name = "__atomic_compare_exchange_4", .linkage = linkage }); - @export(atomicCompareExchangeFn(u64), .{ .name = "__atomic_compare_exchange_8", .linkage = linkage }); + const atomicCompareExchange_u8 = atomicCompareExchangeFn(u8); + const atomicCompareExchange_u16 = atomicCompareExchangeFn(u16); + const atomicCompareExchange_u32 = atomicCompareExchangeFn(u32); + const atomicCompareExchange_u64 = atomicCompareExchangeFn(u64); + @export(atomicCompareExchange_u8, .{ .name = "__atomic_compare_exchange_1", .linkage = linkage }); + @export(atomicCompareExchange_u16, .{ .name = "__atomic_compare_exchange_2", .linkage = linkage }); + @export(atomicCompareExchange_u32, .{ .name = "__atomic_compare_exchange_4", .linkage = linkage }); + @export(atomicCompareExchange_u64, .{ .name = "__atomic_compare_exchange_8", .linkage = linkage }); } } @@ -264,34 +280,58 @@ fn fetchFn(comptime T: type, comptime op: builtin.AtomicRmwOp) fn (*T, T, i32) c comptime { if (supports_atomic_ops) { - @export(fetchFn(u8, .Add), .{ .name = "__atomic_fetch_add_1", .linkage = linkage }); - @export(fetchFn(u16, .Add), .{ .name = "__atomic_fetch_add_2", .linkage = linkage }); - @export(fetchFn(u32, .Add), .{ .name = "__atomic_fetch_add_4", .linkage = linkage }); - @export(fetchFn(u64, .Add), .{ .name = "__atomic_fetch_add_8", .linkage = linkage }); - - @export(fetchFn(u8, .Sub), .{ .name = "__atomic_fetch_sub_1", .linkage = linkage }); - @export(fetchFn(u16, .Sub), .{ .name = "__atomic_fetch_sub_2", .linkage = linkage }); - @export(fetchFn(u32, .Sub), .{ .name = "__atomic_fetch_sub_4", .linkage = linkage }); - @export(fetchFn(u64, .Sub), .{ .name = "__atomic_fetch_sub_8", .linkage = linkage }); - - @export(fetchFn(u8, .And), .{ .name = "__atomic_fetch_and_1", .linkage = linkage }); - @export(fetchFn(u16, .And), .{ .name = "__atomic_fetch_and_2", .linkage = linkage }); - @export(fetchFn(u32, .And), .{ .name = "__atomic_fetch_and_4", .linkage = linkage }); - @export(fetchFn(u64, .And), .{ .name = "__atomic_fetch_and_8", .linkage = linkage }); - - @export(fetchFn(u8, .Or), .{ .name = "__atomic_fetch_or_1", .linkage = linkage }); - @export(fetchFn(u16, .Or), .{ .name = "__atomic_fetch_or_2", .linkage = linkage }); - @export(fetchFn(u32, .Or), .{ .name = "__atomic_fetch_or_4", .linkage = linkage }); - @export(fetchFn(u64, .Or), .{ .name = "__atomic_fetch_or_8", .linkage = linkage }); - - @export(fetchFn(u8, .Xor), .{ .name = "__atomic_fetch_xor_1", .linkage = linkage }); - @export(fetchFn(u16, .Xor), .{ .name = "__atomic_fetch_xor_2", .linkage = linkage }); - @export(fetchFn(u32, .Xor), .{ .name = "__atomic_fetch_xor_4", .linkage = linkage }); - @export(fetchFn(u64, .Xor), .{ .name = "__atomic_fetch_xor_8", .linkage = linkage }); - - @export(fetchFn(u8, .Nand), .{ .name = "__atomic_fetch_nand_1", .linkage = linkage }); - @export(fetchFn(u16, .Nand), .{ .name = "__atomic_fetch_nand_2", .linkage = linkage }); - @export(fetchFn(u32, .Nand), .{ .name = "__atomic_fetch_nand_4", .linkage = linkage }); - @export(fetchFn(u64, .Nand), .{ .name = "__atomic_fetch_nand_8", .linkage = linkage }); + const fetch_add_u8 = fetchFn(u8, .Add); + const fetch_add_u16 = fetchFn(u16, .Add); + const fetch_add_u32 = fetchFn(u32, .Add); + const fetch_add_u64 = fetchFn(u64, .Add); + @export(fetch_add_u8, .{ .name = "__atomic_fetch_add_1", .linkage = linkage }); + @export(fetch_add_u16, .{ .name = "__atomic_fetch_add_2", .linkage = linkage }); + @export(fetch_add_u32, .{ .name = "__atomic_fetch_add_4", .linkage = linkage }); + @export(fetch_add_u64, .{ .name = "__atomic_fetch_add_8", .linkage = linkage }); + + const fetch_sub_u8 = fetchFn(u8, .Sub); + const fetch_sub_u16 = fetchFn(u16, .Sub); + const fetch_sub_u32 = fetchFn(u32, .Sub); + const fetch_sub_u64 = fetchFn(u64, .Sub); + @export(fetch_sub_u8, .{ .name = "__atomic_fetch_sub_1", .linkage = linkage }); + @export(fetch_sub_u16, .{ .name = "__atomic_fetch_sub_2", .linkage = linkage }); + @export(fetch_sub_u32, .{ .name = "__atomic_fetch_sub_4", .linkage = linkage }); + @export(fetch_sub_u64, .{ .name = "__atomic_fetch_sub_8", .linkage = linkage }); + + const fetch_and_u8 = fetchFn(u8, .And); + const fetch_and_u16 = fetchFn(u16, .And); + const fetch_and_u32 = fetchFn(u32, .And); + const fetch_and_u64 = fetchFn(u64, .And); + @export(fetch_and_u8, .{ .name = "__atomic_fetch_and_1", .linkage = linkage }); + @export(fetch_and_u16, .{ .name = "__atomic_fetch_and_2", .linkage = linkage }); + @export(fetch_and_u32, .{ .name = "__atomic_fetch_and_4", .linkage = linkage }); + @export(fetch_and_u64, .{ .name = "__atomic_fetch_and_8", .linkage = linkage }); + + const fetch_or_u8 = fetchFn(u8, .Or); + const fetch_or_u16 = fetchFn(u16, .Or); + const fetch_or_u32 = fetchFn(u32, .Or); + const fetch_or_u64 = fetchFn(u64, .Or); + @export(fetch_or_u8, .{ .name = "__atomic_fetch_or_1", .linkage = linkage }); + @export(fetch_or_u16, .{ .name = "__atomic_fetch_or_2", .linkage = linkage }); + @export(fetch_or_u32, .{ .name = "__atomic_fetch_or_4", .linkage = linkage }); + @export(fetch_or_u64, .{ .name = "__atomic_fetch_or_8", .linkage = linkage }); + + const fetch_xor_u8 = fetchFn(u8, .Xor); + const fetch_xor_u16 = fetchFn(u16, .Xor); + const fetch_xor_u32 = fetchFn(u32, .Xor); + const fetch_xor_u64 = fetchFn(u64, .Xor); + @export(fetch_xor_u8, .{ .name = "__atomic_fetch_xor_1", .linkage = linkage }); + @export(fetch_xor_u16, .{ .name = "__atomic_fetch_xor_2", .linkage = linkage }); + @export(fetch_xor_u32, .{ .name = "__atomic_fetch_xor_4", .linkage = linkage }); + @export(fetch_xor_u64, .{ .name = "__atomic_fetch_xor_8", .linkage = linkage }); + + const fetch_nand_u8 = fetchFn(u8, .Nand); + const fetch_nand_u16 = fetchFn(u16, .Nand); + const fetch_nand_u32 = fetchFn(u32, .Nand); + const fetch_nand_u64 = fetchFn(u64, .Nand); + @export(fetch_nand_u8, .{ .name = "__atomic_fetch_nand_1", .linkage = linkage }); + @export(fetch_nand_u16, .{ .name = "__atomic_fetch_nand_2", .linkage = linkage }); + @export(fetch_nand_u32, .{ .name = "__atomic_fetch_nand_4", .linkage = linkage }); + @export(fetch_nand_u64, .{ .name = "__atomic_fetch_nand_8", .linkage = linkage }); } } diff --git a/src/AstGen.zig b/src/AstGen.zig index 374d27c3e6b3..d7720e76787f 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -59,7 +59,7 @@ fn appendRefsAssumeCapacity(astgen: *AstGen, refs: []const Zir.Inst.Ref) void { astgen.extra.appendSliceAssumeCapacity(coerced); } -pub fn generate(gpa: *Allocator, tree: ast.Tree) InnerError!Zir { +pub fn generate(gpa: *Allocator, tree: ast.Tree) Allocator.Error!Zir { var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); @@ -662,7 +662,7 @@ fn expr(gz: *GenZir, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerEr const lhs = try expr(gz, scope, .ref, node_datas[node].lhs); const extra = tree.extraData(node_datas[node].rhs, ast.Node.SliceSentinel); const start = try expr(gz, scope, .{ .ty = .usize_type }, extra.start); - const end = try expr(gz, scope, .{ .ty = .usize_type }, extra.end); + const end = if (extra.end != 0) try expr(gz, scope, .{ .ty = .usize_type }, extra.end) else .none; const sentinel = try expr(gz, scope, .{ .ty = .usize_type }, extra.sentinel); const result = try gz.addPlNode(.slice_sentinel, node, Zir.Inst.SliceSentinel{ .lhs = lhs, @@ -3877,6 +3877,10 @@ fn containerDecl( const node_tags = tree.nodes.items(.tag); const node_datas = tree.nodes.items(.data); + const prev_fn_block = astgen.fn_block; + astgen.fn_block = null; + defer astgen.fn_block = prev_fn_block; + // We must not create any types until Sema. Here the goal is only to generate // ZIR for all the field types, alignments, and default value expressions. @@ -3976,7 +3980,7 @@ fn containerDecl( .nonexhaustive_node = nonexhaustive_node, }; }; - if (counts.total_fields == 0) { + if (counts.total_fields == 0 and counts.nonexhaustive_node == 0) { // One can construct an enum with no tags, and it functions the same as `noreturn`. But // this is only useful for generic code; when explicitly using `enum {}` syntax, there // must be at least one tag. diff --git a/src/clang.zig b/src/clang.zig index 4cc82c0ae578..bd305bc76f05 100644 --- a/src/clang.zig +++ b/src/clang.zig @@ -45,7 +45,7 @@ pub const APValueLValueBase = extern struct { extern fn ZigClangAPValueLValueBase_dyn_cast_Expr(APValueLValueBase) ?*const Expr; }; -pub const APValueKind = extern enum { +pub const APValueKind = enum(c_int) { None, Indeterminate, Int, @@ -105,7 +105,7 @@ pub const APFloat = opaque { extern fn ZigClangAPFloat_toString(*const APFloat, precision: c_uint, maxPadding: c_uint, truncateZero: bool) [*:0]const u8; }; -pub const APFloatBaseSemantics = extern enum { +pub const APFloatBaseSemantics = enum(c_int) { IEEEhalf, BFloat, IEEEsingle, @@ -1037,7 +1037,7 @@ pub const InitListExpr = opaque { extern fn ZigClangInitListExpr_getInitializedFieldInUnion(*const InitListExpr) ?*FieldDecl; }; -pub const BO = extern enum { +pub const BO = enum(c_int) { PtrMemD, PtrMemI, Mul, @@ -1073,7 +1073,7 @@ pub const BO = extern enum { Comma, }; -pub const UO = extern enum { +pub const UO = enum(c_int) { PostInc, PostDec, PreInc, @@ -1090,7 +1090,7 @@ pub const UO = extern enum { Coawait, }; -pub const TypeClass = extern enum { +pub const TypeClass = enum(c_int) { Adjusted, Decayed, ConstantArray, @@ -1145,7 +1145,7 @@ pub const TypeClass = extern enum { ExtVector, }; -const StmtClass = extern enum { +const StmtClass = enum(c_int) { NoStmtClass, GCCAsmStmtClass, MSAsmStmtClass, @@ -1362,7 +1362,7 @@ const StmtClass = extern enum { WhileStmtClass, }; -pub const CK = extern enum { +pub const CK = enum(c_int) { Dependent, BitCast, LValueBitCast, @@ -1429,7 +1429,7 @@ pub const CK = extern enum { IntToOCLSampler, }; -pub const DeclKind = extern enum { +pub const DeclKind = enum(c_int) { AccessSpec, Block, Captured, @@ -1513,7 +1513,7 @@ pub const DeclKind = extern enum { TranslationUnit, }; -pub const BuiltinTypeKind = extern enum { +pub const BuiltinTypeKind = enum(c_int) { OCLImage1dRO, OCLImage1dArrayRO, OCLImage1dBufferRO, @@ -1687,7 +1687,7 @@ pub const BuiltinTypeKind = extern enum { OMPIterator, }; -pub const CallingConv = extern enum { +pub const CallingConv = enum(c_int) { C, X86StdCall, X86FastCall, @@ -1708,7 +1708,7 @@ pub const CallingConv = extern enum { AArch64VectorCall, }; -pub const StorageClass = extern enum { +pub const StorageClass = enum(c_int) { None, Extern, Static, @@ -1717,7 +1717,7 @@ pub const StorageClass = extern enum { Register, }; -pub const APFloat_roundingMode = extern enum(i8) { +pub const APFloat_roundingMode = enum(i8) { TowardZero = 0, NearestTiesToEven = 1, TowardPositive = 2, @@ -1727,7 +1727,7 @@ pub const APFloat_roundingMode = extern enum(i8) { Invalid = -1, }; -pub const StringLiteral_StringKind = extern enum { +pub const StringLiteral_StringKind = enum(c_int) { Ascii, Wide, UTF8, @@ -1735,7 +1735,7 @@ pub const StringLiteral_StringKind = extern enum { UTF32, }; -pub const CharacterLiteral_CharacterKind = extern enum { +pub const CharacterLiteral_CharacterKind = enum(c_int) { Ascii, Wide, UTF8, @@ -1743,13 +1743,13 @@ pub const CharacterLiteral_CharacterKind = extern enum { UTF32, }; -pub const VarDecl_TLSKind = extern enum { +pub const VarDecl_TLSKind = enum(c_int) { None, Static, Dynamic, }; -pub const ElaboratedTypeKeyword = extern enum { +pub const ElaboratedTypeKeyword = enum(c_int) { Struct, Interface, Union, @@ -1759,21 +1759,21 @@ pub const ElaboratedTypeKeyword = extern enum { None, }; -pub const PreprocessedEntity_EntityKind = extern enum { +pub const PreprocessedEntity_EntityKind = enum(c_int) { InvalidKind, MacroExpansionKind, MacroDefinitionKind, InclusionDirectiveKind, }; -pub const Expr_ConstantExprKind = extern enum { +pub const Expr_ConstantExprKind = enum(c_int) { Normal, NonClassTemplateArgument, ClassTemplateArgument, ImmediateInvocation, }; -pub const UnaryExprOrTypeTrait_Kind = extern enum { +pub const UnaryExprOrTypeTrait_Kind = enum(c_int) { SizeOf, AlignOf, VecStep, @@ -1781,7 +1781,7 @@ pub const UnaryExprOrTypeTrait_Kind = extern enum { PreferredAlignOf, }; -pub const OffsetOfNode_Kind = extern enum { +pub const OffsetOfNode_Kind = enum(c_int) { Array, Field, Identifier, diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig index 63ac7e86a079..364b059a873a 100644 --- a/src/codegen/llvm/bindings.zig +++ b/src/codegen/llvm/bindings.zig @@ -131,7 +131,7 @@ extern fn LLVMLookupIntrinsicID(Name: [*]const u8, NameLen: usize) c_uint; pub const disposeMessage = LLVMDisposeMessage; extern fn LLVMDisposeMessage(Message: [*:0]const u8) void; -pub const VerifierFailureAction = extern enum { +pub const VerifierFailureAction = enum(c_int) { AbortProcess, PrintMessage, ReturnStatus, @@ -228,7 +228,7 @@ pub const Builder = opaque { extern fn LLVMBuildExtractValue(*const Builder, AggVal: *const Value, Index: c_uint, Name: [*:0]const u8) *const Value; }; -pub const IntPredicate = extern enum { +pub const IntPredicate = enum(c_int) { EQ = 32, NE = 33, UGT = 34, @@ -274,7 +274,7 @@ pub const TargetMachine = opaque { ) Bool; }; -pub const CodeMode = extern enum { +pub const CodeMode = enum(c_int) { Default, JITDefault, Tiny, @@ -284,14 +284,14 @@ pub const CodeMode = extern enum { Large, }; -pub const CodeGenOptLevel = extern enum { +pub const CodeGenOptLevel = enum(c_int) { None, Less, Default, Aggressive, }; -pub const RelocMode = extern enum { +pub const RelocMode = enum(c_int) { Default, Static, PIC, @@ -301,7 +301,7 @@ pub const RelocMode = extern enum { ROPI_RWPI, }; -pub const CodeGenFileType = extern enum { +pub const CodeGenFileType = enum(c_int) { AssemblyFile, ObjectFile, }; @@ -504,7 +504,7 @@ pub const LinkELF = ZigLLDLinkELF; pub const LinkMachO = ZigLLDLinkMachO; pub const LinkWasm = ZigLLDLinkWasm; -pub const ObjectFormatType = extern enum(c_int) { +pub const ObjectFormatType = enum(c_int) { Unknown, COFF, ELF, @@ -528,7 +528,7 @@ extern fn ZigLLVMWriteArchive( os_type: OSType, ) bool; -pub const OSType = extern enum(c_int) { +pub const OSType = enum(c_int) { UnknownOS, Ananas, CloudABI, @@ -567,7 +567,7 @@ pub const OSType = extern enum(c_int) { Emscripten, }; -pub const ArchType = extern enum(c_int) { +pub const ArchType = enum(c_int) { UnknownArch, arm, armeb, diff --git a/src/codegen/spirv/spec.zig b/src/codegen/spirv/spec.zig index 227211e4a6b1..429ed63d2368 100644 --- a/src/codegen/spirv/spec.zig +++ b/src/codegen/spirv/spec.zig @@ -3,7 +3,7 @@ const Version = @import("std").builtin.Version; pub const version = Version{ .major = 1, .minor = 5, .patch = 4 }; pub const magic_number: u32 = 0x07230203; -pub const Opcode = extern enum(u16) { +pub const Opcode = enum(u16) { OpNop = 0, OpUndef = 1, OpSourceContinued = 2, @@ -382,12 +382,10 @@ pub const Opcode = extern enum(u16) { OpGroupNonUniformPartitionNV = 5296, OpWritePackedPrimitiveIndices4x8NV = 5299, OpReportIntersectionNV = 5334, - OpReportIntersectionKHR = 5334, OpIgnoreIntersectionNV = 5335, OpTerminateRayNV = 5336, OpTraceNV = 5337, OpTypeAccelerationStructureNV = 5341, - OpTypeAccelerationStructureKHR = 5341, OpExecuteCallableNV = 5344, OpTypeCooperativeMatrixNV = 5358, OpCooperativeMatrixLoadNV = 5359, @@ -432,9 +430,7 @@ pub const Opcode = extern enum(u16) { OpAssumeTrueKHR = 5630, OpExpectKHR = 5631, OpDecorateString = 5632, - OpDecorateStringGOOGLE = 5632, OpMemberDecorateString = 5633, - OpMemberDecorateStringGOOGLE = 5633, OpVmeImageINTEL = 5699, OpTypeVmeImageINTEL = 5700, OpTypeAvcImePayloadINTEL = 5701, @@ -585,6 +581,9 @@ pub const Opcode = extern enum(u16) { OpConstantCompositeContinuedINTEL = 6091, OpSpecConstantCompositeContinuedINTEL = 6092, _, + + const OpReportIntersectionKHR = OpReportIntersectionNV; + const OpTypeAccelerationStructureKHR = OpTypeAccelerationStructureNV; }; pub const ImageOperands = packed struct { Bias: bool align(@alignOf(u32)) = false, @@ -926,7 +925,7 @@ pub const FragmentShadingRate = packed struct { _reserved_bit_30: bool = false, _reserved_bit_31: bool = false, }; -pub const SourceLanguage = extern enum(u32) { +pub const SourceLanguage = enum(u32) { Unknown = 0, ESSL = 1, GLSL = 2, @@ -935,7 +934,7 @@ pub const SourceLanguage = extern enum(u32) { HLSL = 5, _, }; -pub const ExecutionModel = extern enum(u32) { +pub const ExecutionModel = enum(u32) { Vertex = 0, TessellationControl = 1, TessellationEvaluation = 2, @@ -959,23 +958,21 @@ pub const ExecutionModel = extern enum(u32) { CallableKHR = 5318, _, }; -pub const AddressingModel = extern enum(u32) { +pub const AddressingModel = enum(u32) { Logical = 0, Physical32 = 1, Physical64 = 2, PhysicalStorageBuffer64 = 5348, - PhysicalStorageBuffer64EXT = 5348, _, }; -pub const MemoryModel = extern enum(u32) { +pub const MemoryModel = enum(u32) { Simple = 0, GLSL450 = 1, OpenCL = 2, Vulkan = 3, - VulkanKHR = 3, _, }; -pub const ExecutionMode = extern enum(u32) { +pub const ExecutionMode = enum(u32) { Invocations = 0, SpacingEqual = 1, SpacingFractionalEven = 2, @@ -1044,7 +1041,7 @@ pub const ExecutionMode = extern enum(u32) { SchedulerTargetFmaxMhzINTEL = 5903, _, }; -pub const StorageClass = extern enum(u32) { +pub const StorageClass = enum(u32) { UniformConstant = 0, Input = 1, Uniform = 2, @@ -1058,26 +1055,19 @@ pub const StorageClass = extern enum(u32) { AtomicCounter = 10, Image = 11, StorageBuffer = 12, - CallableDataNV = 5328, CallableDataKHR = 5328, - IncomingCallableDataNV = 5329, IncomingCallableDataKHR = 5329, - RayPayloadNV = 5338, RayPayloadKHR = 5338, - HitAttributeNV = 5339, HitAttributeKHR = 5339, - IncomingRayPayloadNV = 5342, IncomingRayPayloadKHR = 5342, - ShaderRecordBufferNV = 5343, ShaderRecordBufferKHR = 5343, PhysicalStorageBuffer = 5349, - PhysicalStorageBufferEXT = 5349, CodeSectionINTEL = 5605, DeviceOnlyINTEL = 5936, HostOnlyINTEL = 5937, _, }; -pub const Dim = extern enum(u32) { +pub const Dim = enum(u32) { @"1D" = 0, @"2D" = 1, @"3D" = 2, @@ -1087,7 +1077,7 @@ pub const Dim = extern enum(u32) { SubpassData = 6, _, }; -pub const SamplerAddressingMode = extern enum(u32) { +pub const SamplerAddressingMode = enum(u32) { None = 0, ClampToEdge = 1, Clamp = 2, @@ -1095,12 +1085,12 @@ pub const SamplerAddressingMode = extern enum(u32) { RepeatMirrored = 4, _, }; -pub const SamplerFilterMode = extern enum(u32) { +pub const SamplerFilterMode = enum(u32) { Nearest = 0, Linear = 1, _, }; -pub const ImageFormat = extern enum(u32) { +pub const ImageFormat = enum(u32) { Unknown = 0, Rgba32f = 1, Rgba16f = 2, @@ -1145,7 +1135,7 @@ pub const ImageFormat = extern enum(u32) { R64i = 41, _, }; -pub const ImageChannelOrder = extern enum(u32) { +pub const ImageChannelOrder = enum(u32) { R = 0, A = 1, RG = 2, @@ -1168,7 +1158,7 @@ pub const ImageChannelOrder = extern enum(u32) { ABGR = 19, _, }; -pub const ImageChannelDataType = extern enum(u32) { +pub const ImageChannelDataType = enum(u32) { SnormInt8 = 0, SnormInt16 = 1, UnormInt8 = 2, @@ -1188,36 +1178,36 @@ pub const ImageChannelDataType = extern enum(u32) { UnormInt101010_2 = 16, _, }; -pub const FPRoundingMode = extern enum(u32) { +pub const FPRoundingMode = enum(u32) { RTE = 0, RTZ = 1, RTP = 2, RTN = 3, _, }; -pub const FPDenormMode = extern enum(u32) { +pub const FPDenormMode = enum(u32) { Preserve = 0, FlushToZero = 1, _, }; -pub const FPOperationMode = extern enum(u32) { +pub const FPOperationMode = enum(u32) { IEEE = 0, ALT = 1, _, }; -pub const LinkageType = extern enum(u32) { +pub const LinkageType = enum(u32) { Export = 0, Import = 1, LinkOnceODR = 2, _, }; -pub const AccessQualifier = extern enum(u32) { +pub const AccessQualifier = enum(u32) { ReadOnly = 0, WriteOnly = 1, ReadWrite = 2, _, }; -pub const FunctionParameterAttribute = extern enum(u32) { +pub const FunctionParameterAttribute = enum(u32) { Zext = 0, Sext = 1, ByVal = 2, @@ -1228,7 +1218,7 @@ pub const FunctionParameterAttribute = extern enum(u32) { NoReadWrite = 7, _, }; -pub const Decoration = extern enum(u32) { +pub const Decoration = enum(u32) { RelaxedPrecision = 0, SpecId = 1, Block = 2, @@ -1334,7 +1324,7 @@ pub const Decoration = extern enum(u32) { VectorComputeCallableFunctionINTEL = 6087, _, }; -pub const BuiltIn = extern enum(u32) { +pub const BuiltIn = enum(u32) { Position = 0, PointSize = 1, ClipDistance = 3, @@ -1455,7 +1445,7 @@ pub const BuiltIn = extern enum(u32) { SMIDNV = 5377, _, }; -pub const Scope = extern enum(u32) { +pub const Scope = enum(u32) { CrossDevice = 0, Device = 1, Workgroup = 2, @@ -1466,7 +1456,7 @@ pub const Scope = extern enum(u32) { ShaderCallKHR = 6, _, }; -pub const GroupOperation = extern enum(u32) { +pub const GroupOperation = enum(u32) { Reduce = 0, InclusiveScan = 1, ExclusiveScan = 2, @@ -1476,13 +1466,13 @@ pub const GroupOperation = extern enum(u32) { PartitionedExclusiveScanNV = 8, _, }; -pub const KernelEnqueueFlags = extern enum(u32) { +pub const KernelEnqueueFlags = enum(u32) { NoWait = 0, WaitKernel = 1, WaitWorkGroup = 2, _, }; -pub const Capability = extern enum(u32) { +pub const Capability = enum(u32) { Matrix = 0, Shader = 1, Geometry = 2, @@ -1560,8 +1550,6 @@ pub const Capability = extern enum(u32) { WorkgroupMemoryExplicitLayout16BitAccessKHR = 4430, SubgroupVoteKHR = 4431, StorageBuffer16BitAccess = 4433, - StorageUniformBufferBlock16 = 4433, - UniformAndStorageBuffer16BitAccess = 4434, StorageUniform16 = 4434, StoragePushConstant16 = 4435, StorageInputOutput16 = 4436, @@ -1592,7 +1580,6 @@ pub const Capability = extern enum(u32) { ShaderClockKHR = 5055, SampleMaskOverrideCoverageNV = 5249, GeometryShaderPassthroughNV = 5251, - ShaderViewportIndexLayerEXT = 5254, ShaderViewportIndexLayerNV = 5254, ShaderViewportMaskNV = 5255, ShaderStereoViewNV = 5259, @@ -1602,40 +1589,24 @@ pub const Capability = extern enum(u32) { ImageFootprintNV = 5282, FragmentBarycentricNV = 5284, ComputeDerivativeGroupQuadsNV = 5288, - FragmentDensityEXT = 5291, ShadingRateNV = 5291, GroupNonUniformPartitionedNV = 5297, ShaderNonUniform = 5301, - ShaderNonUniformEXT = 5301, RuntimeDescriptorArray = 5302, - RuntimeDescriptorArrayEXT = 5302, InputAttachmentArrayDynamicIndexing = 5303, - InputAttachmentArrayDynamicIndexingEXT = 5303, UniformTexelBufferArrayDynamicIndexing = 5304, - UniformTexelBufferArrayDynamicIndexingEXT = 5304, StorageTexelBufferArrayDynamicIndexing = 5305, - StorageTexelBufferArrayDynamicIndexingEXT = 5305, UniformBufferArrayNonUniformIndexing = 5306, - UniformBufferArrayNonUniformIndexingEXT = 5306, SampledImageArrayNonUniformIndexing = 5307, - SampledImageArrayNonUniformIndexingEXT = 5307, StorageBufferArrayNonUniformIndexing = 5308, - StorageBufferArrayNonUniformIndexingEXT = 5308, StorageImageArrayNonUniformIndexing = 5309, - StorageImageArrayNonUniformIndexingEXT = 5309, InputAttachmentArrayNonUniformIndexing = 5310, - InputAttachmentArrayNonUniformIndexingEXT = 5310, UniformTexelBufferArrayNonUniformIndexing = 5311, - UniformTexelBufferArrayNonUniformIndexingEXT = 5311, StorageTexelBufferArrayNonUniformIndexing = 5312, - StorageTexelBufferArrayNonUniformIndexingEXT = 5312, RayTracingNV = 5340, VulkanMemoryModel = 5345, - VulkanMemoryModelKHR = 5345, VulkanMemoryModelDeviceScope = 5346, - VulkanMemoryModelDeviceScopeKHR = 5346, PhysicalStorageBufferAddresses = 5347, - PhysicalStorageBufferAddressesEXT = 5347, ComputeDerivativeGroupLinearNV = 5350, RayTracingProvisionalKHR = 5353, CooperativeMatrixNV = 5357, @@ -1685,18 +1656,18 @@ pub const Capability = extern enum(u32) { LongConstantCompositeINTEL = 6089, _, }; -pub const RayQueryIntersection = extern enum(u32) { +pub const RayQueryIntersection = enum(u32) { RayQueryCandidateIntersectionKHR = 0, RayQueryCommittedIntersectionKHR = 1, _, }; -pub const RayQueryCommittedIntersectionType = extern enum(u32) { +pub const RayQueryCommittedIntersectionType = enum(u32) { RayQueryCommittedIntersectionNoneKHR = 0, RayQueryCommittedIntersectionTriangleKHR = 1, RayQueryCommittedIntersectionGeneratedKHR = 2, _, }; -pub const RayQueryCandidateIntersectionType = extern enum(u32) { +pub const RayQueryCandidateIntersectionType = enum(u32) { RayQueryCandidateIntersectionTriangleKHR = 0, RayQueryCandidateIntersectionAABBKHR = 1, _, diff --git a/src/config.zig.in b/src/config.zig.in index 38dbf6a4d110..1bd1b355050e 100644 --- a/src/config.zig.in +++ b/src/config.zig.in @@ -1,6 +1,6 @@ pub const have_llvm = true; pub const version: [:0]const u8 = "@ZIG_VERSION@"; -pub const semver = try @import("std").SemanticVersion.parse(version); +pub const semver = @import("std").SemanticVersion.parse(version) catch unreachable; pub const enable_logging: bool = @ZIG_ENABLE_LOGGING_BOOL@; pub const enable_tracy = false; pub const is_stage1 = true; diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 4f9ee0587b84..4de1708ff885 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2700,7 +2700,7 @@ fn writeStubHelperPreamble(self: *MachO) !void { const this_addr = stub_helper.addr; const target_addr = data.addr; data_blk: { - const displacement = math.cast(i21, target_addr - this_addr) catch |_| break :data_blk; + const displacement = math.cast(i21, target_addr - this_addr) catch break :data_blk; // adr x17, disp mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.adr(.x17, displacement).toU32()); // nop @@ -2709,7 +2709,7 @@ fn writeStubHelperPreamble(self: *MachO) !void { } data_blk: { const new_this_addr = this_addr + @sizeOf(u32); - const displacement = math.cast(i21, target_addr - new_this_addr) catch |_| break :data_blk; + const displacement = math.cast(i21, target_addr - new_this_addr) catch break :data_blk; // nop mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.nop().toU32()); // adr x17, disp @@ -2738,8 +2738,8 @@ fn writeStubHelperPreamble(self: *MachO) !void { const this_addr = stub_helper.addr + 3 * @sizeOf(u32); const target_addr = got.addr; binder_blk: { - const displacement = math.divExact(u64, target_addr - this_addr, 4) catch |_| break :binder_blk; - const literal = math.cast(u18, displacement) catch |_| break :binder_blk; + const displacement = math.divExact(u64, target_addr - this_addr, 4) catch break :binder_blk; + const literal = math.cast(u18, displacement) catch break :binder_blk; // ldr x16, label mem.writeIntLittle(u32, code[12..16], aarch64.Instruction.ldr(.x16, .{ .literal = literal, @@ -2750,8 +2750,8 @@ fn writeStubHelperPreamble(self: *MachO) !void { } binder_blk: { const new_this_addr = this_addr + @sizeOf(u32); - const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch |_| break :binder_blk; - const literal = math.cast(u18, displacement) catch |_| break :binder_blk; + const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch break :binder_blk; + const literal = math.cast(u18, displacement) catch break :binder_blk; // nop mem.writeIntLittle(u32, code[12..16], aarch64.Instruction.nop().toU32()); // ldr x16, label @@ -2816,8 +2816,8 @@ fn writeStub(self: *MachO, index: u32) !void { const this_addr = stub_addr; const target_addr = la_ptr_addr; inner: { - const displacement = math.divExact(u64, target_addr - this_addr, 4) catch |_| break :inner; - const literal = math.cast(u18, displacement) catch |_| break :inner; + const displacement = math.divExact(u64, target_addr - this_addr, 4) catch break :inner; + const literal = math.cast(u18, displacement) catch break :inner; // ldr x16, literal mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.ldr(.x16, .{ .literal = literal, @@ -2828,8 +2828,8 @@ fn writeStub(self: *MachO, index: u32) !void { } inner: { const new_this_addr = this_addr + @sizeOf(u32); - const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch |_| break :inner; - const literal = math.cast(u18, displacement) catch |_| break :inner; + const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch break :inner; + const literal = math.cast(u18, displacement) catch break :inner; // nop mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.nop().toU32()); // ldr x16, literal diff --git a/src/link/MachO/Trie.zig b/src/link/MachO/Trie.zig index 379b10e2d8a2..9ef1e486e1f0 100644 --- a/src/link/MachO/Trie.zig +++ b/src/link/MachO/Trie.zig @@ -334,7 +334,7 @@ pub fn finalize(self: *Trie) !void { self.ordered_nodes.shrinkRetainingCapacity(0); try self.ordered_nodes.ensureCapacity(self.allocator, self.node_count); - comptime const Fifo = std.fifo.LinearFifo(*Node, .{ .Static = std.math.maxInt(u8) }); + const Fifo = std.fifo.LinearFifo(*Node, .{ .Static = std.math.maxInt(u8) }); var fifo = Fifo.init(); try fifo.writeItem(self.root.?); diff --git a/src/link/MachO/Zld.zig b/src/link/MachO/Zld.zig index dd957f1a4af6..824ea1bb5600 100644 --- a/src/link/MachO/Zld.zig +++ b/src/link/MachO/Zld.zig @@ -1305,7 +1305,7 @@ fn writeStubHelperCommon(self: *Zld) !void { const this_addr = stub_helper.addr; const target_addr = data.addr + data.size - @sizeOf(u64); data_blk: { - const displacement = math.cast(i21, target_addr - this_addr) catch |_| break :data_blk; + const displacement = math.cast(i21, target_addr - this_addr) catch break :data_blk; // adr x17, disp mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.adr(.x17, displacement).toU32()); // nop @@ -1314,7 +1314,7 @@ fn writeStubHelperCommon(self: *Zld) !void { } data_blk: { const new_this_addr = this_addr + @sizeOf(u32); - const displacement = math.cast(i21, target_addr - new_this_addr) catch |_| break :data_blk; + const displacement = math.cast(i21, target_addr - new_this_addr) catch break :data_blk; // nop mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.nop().toU32()); // adr x17, disp @@ -1339,8 +1339,8 @@ fn writeStubHelperCommon(self: *Zld) !void { const this_addr = stub_helper.addr + 3 * @sizeOf(u32); const target_addr = (got.addr + dyld_stub_binder.got_index.? * @sizeOf(u64)); binder_blk: { - const displacement = math.divExact(u64, target_addr - this_addr, 4) catch |_| break :binder_blk; - const literal = math.cast(u18, displacement) catch |_| break :binder_blk; + const displacement = math.divExact(u64, target_addr - this_addr, 4) catch break :binder_blk; + const literal = math.cast(u18, displacement) catch break :binder_blk; // ldr x16, label mem.writeIntLittle(u32, code[12..16], aarch64.Instruction.ldr(.x16, .{ .literal = literal, @@ -1351,8 +1351,8 @@ fn writeStubHelperCommon(self: *Zld) !void { } binder_blk: { const new_this_addr = this_addr + @sizeOf(u32); - const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch |_| break :binder_blk; - const literal = math.cast(u18, displacement) catch |_| break :binder_blk; + const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch break :binder_blk; + const literal = math.cast(u18, displacement) catch break :binder_blk; // Pad with nop to please division. // nop mem.writeIntLittle(u32, code[12..16], aarch64.Instruction.nop().toU32()); @@ -1444,8 +1444,8 @@ fn writeStub(self: *Zld, index: u32) !void { const this_addr = stub_addr; const target_addr = la_ptr_addr; inner: { - const displacement = math.divExact(u64, target_addr - this_addr, 4) catch |_| break :inner; - const literal = math.cast(u18, displacement) catch |_| break :inner; + const displacement = math.divExact(u64, target_addr - this_addr, 4) catch break :inner; + const literal = math.cast(u18, displacement) catch break :inner; // ldr x16, literal mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.ldr(.x16, .{ .literal = literal, @@ -1456,8 +1456,8 @@ fn writeStub(self: *Zld, index: u32) !void { } inner: { const new_this_addr = this_addr + @sizeOf(u32); - const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch |_| break :inner; - const literal = math.cast(u18, displacement) catch |_| break :inner; + const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch break :inner; + const literal = math.cast(u18, displacement) catch break :inner; // nop mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.nop().toU32()); // ldr x16, literal diff --git a/src/main.zig b/src/main.zig index 081b9ac33592..512828bd77ac 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2923,6 +2923,7 @@ pub const usage_fmt = \\ --stdin Format code from stdin; output to stdout \\ --check List non-conforming files and exit with an error \\ if the list is non-empty + \\ --ast-check Run zig ast-check on every file \\ \\ ; @@ -2930,6 +2931,7 @@ pub const usage_fmt = const Fmt = struct { seen: SeenMap, any_error: bool, + check_ast: bool, color: Color, gpa: *Allocator, out_buffer: std.ArrayList(u8), @@ -2942,6 +2944,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { var color: Color = .auto; var stdin_flag: bool = false; var check_flag: bool = false; + var check_ast_flag: bool = false; var input_files = ArrayList([]const u8).init(gpa); defer input_files.deinit(); @@ -2967,6 +2970,8 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { stdin_flag = true; } else if (mem.eql(u8, arg, "--check")) { check_flag = true; + } else if (mem.eql(u8, arg, "--ast-check")) { + check_ast_flag = true; } else { fatal("unrecognized parameter: '{s}'", .{arg}); } @@ -3017,6 +3022,7 @@ pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { .gpa = gpa, .seen = Fmt.SeenMap.init(gpa), .any_error = false, + .check_ast = check_ast_flag, .color = color, .out_buffer = std.ArrayList(u8).init(gpa), }; @@ -3085,7 +3091,7 @@ fn fmtPathDir( while (try dir_it.next()) |entry| { const is_dir = entry.kind == .Directory; - if (is_dir and std.mem.eql(u8, entry.name, "zig-cache")) continue; + if (is_dir and (mem.eql(u8, entry.name, "zig-cache") or mem.eql(u8, entry.name, "zig-out"))) continue; if (is_dir or mem.endsWith(u8, entry.name, ".zig")) { const full_path = try fs.path.join(fmt.gpa, &[_][]const u8{ file_path, entry.name }); @@ -3144,6 +3150,52 @@ fn fmtPathFile( return; } + if (fmt.check_ast) { + const Module = @import("Module.zig"); + const AstGen = @import("AstGen.zig"); + + var file: Module.Scope.File = .{ + .status = .never_loaded, + .source_loaded = true, + .zir_loaded = false, + .sub_file_path = file_path, + .source = source_code, + .stat_size = stat.size, + .stat_inode = stat.inode, + .stat_mtime = stat.mtime, + .tree = tree, + .tree_loaded = true, + .zir = undefined, + .pkg = undefined, + .root_decl = null, + }; + + if (stat.size > max_src_size) + return error.FileTooBig; + + file.zir = try AstGen.generate(fmt.gpa, file.tree); + file.zir_loaded = true; + defer file.zir.deinit(fmt.gpa); + + if (file.zir.hasCompileErrors()) { + var arena_instance = std.heap.ArenaAllocator.init(fmt.gpa); + defer arena_instance.deinit(); + var errors = std.ArrayList(Compilation.AllErrors.Message).init(fmt.gpa); + defer errors.deinit(); + + try Compilation.AllErrors.addZir(&arena_instance.allocator, &errors, &file); + const ttyconf: std.debug.TTY.Config = switch (fmt.color) { + .auto => std.debug.detectTTYConfig(), + .on => .escape_codes, + .off => .no_color, + }; + for (errors.items) |full_err_msg| { + full_err_msg.renderToStdErr(ttyconf); + } + fmt.any_error = true; + } + } + // As a heuristic, we make enough capacity for the same as the input source. fmt.out_buffer.shrinkRetainingCapacity(0); try fmt.out_buffer.ensureCapacity(source_code.len); diff --git a/src/stage1.zig b/src/stage1.zig index fc7b86e7273a..91e7cd8bed12 100644 --- a/src/stage1.zig +++ b/src/stage1.zig @@ -58,7 +58,7 @@ pub const OS = c_int; /// Matches std.builtin.BuildMode pub const BuildMode = c_int; -pub const TargetSubsystem = extern enum(c_int) { +pub const TargetSubsystem = enum(c_int) { Console, Windows, Posix, @@ -171,7 +171,7 @@ export fn stage2_panic(ptr: [*]const u8, len: usize) void { } // ABI warning -const Error = extern enum { +const Error = enum(c_int) { None, OutOfMemory, InvalidFormat, diff --git a/src/type.zig b/src/type.zig index 3e6c810b209e..410773b64969 100644 --- a/src/type.zig +++ b/src/type.zig @@ -6,6 +6,8 @@ const Target = std.Target; const Module = @import("Module.zig"); const log = std.log.scoped(.Type); +const file_struct = @This(); + /// This is the raw data, with no bookkeeping, no memory awareness, no de-duplication. /// It's important for this type to be small. /// Types are not de-duplicated, which helps with multi-threading since it obviates the requirement @@ -3000,12 +3002,12 @@ pub const Type = extern union { }; } - pub fn init(comptime t: Tag) Type { + pub fn init(comptime t: Tag) file_struct.Type { comptime std.debug.assert(@enumToInt(t) < Tag.no_payload_count); return .{ .tag_if_small_enough = @enumToInt(t) }; } - pub fn create(comptime t: Tag, ally: *Allocator, data: Data(t)) error{OutOfMemory}!Type { + pub fn create(comptime t: Tag, ally: *Allocator, data: Data(t)) error{OutOfMemory}!file_struct.Type { const ptr = try ally.create(t.Type()); ptr.* = .{ .base = .{ .tag = t }, diff --git a/src/windows_sdk.zig b/src/windows_sdk.zig index 6dfdeb99fd0c..ca69ff4548ec 100644 --- a/src/windows_sdk.zig +++ b/src/windows_sdk.zig @@ -12,7 +12,7 @@ pub const ZigWindowsSDK = extern struct { msvc_lib_dir_ptr: ?[*]const u8, msvc_lib_dir_len: usize, }; -pub const ZigFindWindowsSdkError = extern enum { +pub const ZigFindWindowsSdkError = enum(c_int) { None, OutOfMemory, NotFound, diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig index d8fc3e64df81..9d2484d26e20 100644 --- a/test/behavior/bitcast.zig +++ b/test/behavior/bitcast.zig @@ -22,8 +22,8 @@ fn conv2(x: u32) i32 { return @bitCast(i32, x); } -test "@bitCast extern enum to its integer type" { - const SOCK = extern enum { +test "@bitCast enum to its integer type" { + const SOCK = enum(c_int) { A, B, diff --git a/test/behavior/bugs/1111.zig b/test/behavior/bugs/1111.zig index 607bc33666dc..d274befaf31c 100644 --- a/test/behavior/bugs/1111.zig +++ b/test/behavior/bugs/1111.zig @@ -1,4 +1,4 @@ -const Foo = extern enum { +const Foo = enum(c_int) { Bar = -1, }; diff --git a/test/behavior/bugs/3046.zig b/test/behavior/bugs/3046.zig index 8ff95f3b9653..60425373b8be 100644 --- a/test/behavior/bugs/3046.zig +++ b/test/behavior/bugs/3046.zig @@ -13,7 +13,7 @@ var some_struct: SomeStruct = undefined; test "fixed" { some_struct = SomeStruct{ - .field = couldFail() catch |_| @as(i32, 0), + .field = couldFail() catch @as(i32, 0), }; try expect(some_struct.field == 1); } diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig index bcd407d25929..864579c8f0a9 100644 --- a/test/behavior/cast.zig +++ b/test/behavior/cast.zig @@ -560,17 +560,6 @@ test "@intToEnum passed a comptime_int to an enum with one item" { try expect(x == E.A); } -test "@intToEnum runtime to an extern enum with duplicate values" { - const E = extern enum(u8) { - A = 1, - B = 1, - }; - var a: u8 = 1; - var x = @intToEnum(E, a); - try expect(x == E.A); - try expect(x == E.B); -} - test "@intCast to u0 and use the result" { const S = struct { fn doTheTest(zero: u1, one: u1, bigzero: i32) !void { @@ -665,7 +654,7 @@ test "*const [N]null u8 to ?[]const u8" { test "peer resolution of string literals" { const S = struct { - const E = extern enum { + const E = enum { a, b, c, diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig index 0ab4e50b243a..a1a4bbdca8fb 100644 --- a/test/behavior/enum.zig +++ b/test/behavior/enum.zig @@ -2,26 +2,6 @@ const expect = @import("std").testing.expect; const mem = @import("std").mem; const Tag = @import("std").meta.Tag; -test "extern enum" { - const S = struct { - const i = extern enum { - n = 0, - o = 2, - p = 4, - q = 4, - }; - fn doTheTest(y: c_int) void { - var x = i.o; - switch (x) { - .n, .p => unreachable, - .o => {}, - } - } - }; - S.doTheTest(52); - comptime S.doTheTest(52); -} - test "non-exhaustive enum" { const S = struct { const E = enum(u8) { @@ -236,11 +216,6 @@ test "@tagName" { comptime try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); } -test "@tagName extern enum with duplicates" { - try expect(mem.eql(u8, testEnumTagNameBare(ExternDuplicates.B), "A")); - comptime try expect(mem.eql(u8, testEnumTagNameBare(ExternDuplicates.B), "A")); -} - test "@tagName non-exhaustive enum" { try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); comptime try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); @@ -256,11 +231,6 @@ const BareNumber = enum { Three, }; -const ExternDuplicates = extern enum(u8) { - A = 1, - B = 1, -}; - const NonExhaustive = enum(u8) { A, B, @@ -1018,17 +988,8 @@ test "enum with 1 field but explicit tag type should still have the tag type" { comptime try expect(@sizeOf(Enum) == @sizeOf(u8)); } -test "empty extern enum with members" { - const E = extern enum { - A, - B, - C, - }; - try expect(@sizeOf(E) == @sizeOf(c_int)); -} - test "tag name with assigned enum values" { - const LocalFoo = enum { + const LocalFoo = enum(u8) { A = 1, B = 0, }; diff --git a/test/behavior/error.zig b/test/behavior/error.zig index e5129f180d38..c0b4dc0231b5 100644 --- a/test/behavior/error.zig +++ b/test/behavior/error.zig @@ -394,7 +394,7 @@ test "function pointer with return type that is error union with payload which i } fn doTheTest() !void { - var x = Foo{ .fun = bar }; + var x = Foo{ .fun = @This().bar }; try expectError(error.UnspecifiedErr, x.fun(1)); } }; diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig index 68537000cb7c..f86ee79761de 100644 --- a/test/behavior/eval.zig +++ b/test/behavior/eval.zig @@ -415,8 +415,8 @@ test "f128 at compile time is lossy" { try expect(@as(f128, 10384593717069655257060992658440192.0) + 1 == 10384593717069655257060992658440192.0); } -comptime { - try expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192); +test { + comptime try expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192); } pub fn TypeWithCompTimeSlice(comptime field_name: []const u8) type { diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig index 2a4fabde45d3..104752607a1d 100644 --- a/test/behavior/generics.zig +++ b/test/behavior/generics.zig @@ -45,9 +45,9 @@ test "var params" { try expect(max_f64(1.2, 3.4) == 3.4); } -comptime { - try expect(max_i32(12, 34) == 34); - try expect(max_f64(1.2, 3.4) == 3.4); +test { + comptime try expect(max_i32(12, 34) == 34); + comptime try expect(max_f64(1.2, 3.4) == 3.4); } fn max_var(a: anytype, b: anytype) @TypeOf(a + b) { diff --git a/test/behavior/misc.zig b/test/behavior/misc.zig index e010644756ef..35f088eb4d05 100644 --- a/test/behavior/misc.zig +++ b/test/behavior/misc.zig @@ -546,19 +546,15 @@ const PackedUnion = packed union { a: u8, b: u32, }; -const PackedEnum = packed enum { - A, - B, -}; test "packed struct, enum, union parameters in extern function" { testPackedStuff(&(PackedStruct{ .a = 1, .b = 2, - }), &(PackedUnion{ .a = 1 }), PackedEnum.A); + }), &(PackedUnion{ .a = 1 })); } -export fn testPackedStuff(a: *const PackedStruct, b: *const PackedUnion, c: PackedEnum) void {} +export fn testPackedStuff(a: *const PackedStruct, b: *const PackedUnion) void {} test "slicing zero length array" { const s1 = ""[0..]; diff --git a/test/behavior/syntax.zig b/test/behavior/syntax.zig index 12df8a43152e..6f75810f3804 100644 --- a/test/behavior/syntax.zig +++ b/test/behavior/syntax.zig @@ -4,7 +4,7 @@ extern var a: c_int; extern "c" var b: c_int; export var c: c_int = 0; -threadlocal var d: c_int; +threadlocal var d: c_int = 0; extern threadlocal var e: c_int; extern "c" threadlocal var f: c_int; export threadlocal var g: c_int = 0; @@ -24,7 +24,6 @@ fn container_init() void { fn type_expr_return1() if (true) A {} fn type_expr_return2() for (true) |_| A {} fn type_expr_return3() while (true) A {} -fn type_expr_return4() comptime A {} fn switch_cases(x: i32) void { switch (x) { diff --git a/test/behavior/type.zig b/test/behavior/type.zig index 5fd89ab43c77..5d12ea494f04 100644 --- a/test/behavior/type.zig +++ b/test/behavior/type.zig @@ -410,7 +410,7 @@ test "Type.Union from Type.Enum" { } test "Type.Union from regular enum" { - const E = enum { working_as_expected = 0 }; + const E = enum { working_as_expected }; const T = @Type(.{ .Union = .{ .layout = .Auto, diff --git a/test/behavior/union.zig b/test/behavior/union.zig index cbc9a1212b45..bcdd3fa24766 100644 --- a/test/behavior/union.zig +++ b/test/behavior/union.zig @@ -776,7 +776,7 @@ test "@unionInit on union w/ tag but no fields" { }; comptime { - try expect(@sizeOf(Data) != 0); + std.debug.assert(@sizeOf(Data) != 0); } fn doTheTest() !void { diff --git a/test/stage2/test.zig b/test/stage2/test.zig index 7ecbcb709f12..46f5fa1ba03b 100644 --- a/test/stage2/test.zig +++ b/test/stage2/test.zig @@ -880,6 +880,20 @@ pub fn addCases(ctx: *TestContext) !void { &.{":3:22: error: redundant comptime keyword in already comptime scope"}, ); } + { + var case = ctx.exe("try in comptime in struct in test", linux_x64); + case.addError( + \\test "@unionInit on union w/ tag but no fields" { + \\ const S = struct { + \\ comptime { + \\ try expect(false); + \\ } + \\ }; + \\} + , + &.{":4:13: error: invalid 'try' outside function scope"}, + ); + } { var case = ctx.exe("import private", linux_x64); case.addError(