From 53913acaf70f14c519b0fa0e3771d3dc641ac86b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 6 Jan 2020 15:34:50 -0500 Subject: [PATCH] zig fmt and update `extern fn` to `callconv(.C)` --- lib/std/debug.zig | 2 +- lib/std/json/test.zig | 12 +++--- lib/std/math/sqrt.zig | 1 - lib/std/mutex.zig | 2 +- lib/std/os/linux.zig | 2 +- lib/std/os/linux/arm-eabi.zig | 2 +- lib/std/os/test.zig | 2 +- lib/std/special/c.zig | 14 +++---- lib/std/special/compiler_rt.zig | 38 +++++++++---------- lib/std/special/compiler_rt/addXf3.zig | 12 +++--- lib/std/special/compiler_rt/ashlti3.zig | 2 +- lib/std/special/compiler_rt/ashrti3.zig | 2 +- lib/std/special/compiler_rt/aulldiv.zig | 2 +- lib/std/special/compiler_rt/aullrem.zig | 2 +- lib/std/special/compiler_rt/comparedf2.zig | 14 +++---- lib/std/special/compiler_rt/comparesf2.zig | 14 +++---- lib/std/special/compiler_rt/comparetf2.zig | 6 +-- lib/std/special/compiler_rt/divdf3.zig | 2 +- lib/std/special/compiler_rt/divsf3.zig | 2 +- lib/std/special/compiler_rt/divti3.zig | 4 +- lib/std/special/compiler_rt/extendXfYf2.zig | 8 ++-- lib/std/special/compiler_rt/fixdfdi.zig | 2 +- lib/std/special/compiler_rt/fixdfsi.zig | 2 +- lib/std/special/compiler_rt/fixdfti.zig | 2 +- lib/std/special/compiler_rt/fixsfdi.zig | 2 +- lib/std/special/compiler_rt/fixsfsi.zig | 2 +- lib/std/special/compiler_rt/fixsfti.zig | 2 +- lib/std/special/compiler_rt/fixtfdi.zig | 2 +- lib/std/special/compiler_rt/fixtfsi.zig | 2 +- lib/std/special/compiler_rt/fixtfti.zig | 2 +- lib/std/special/compiler_rt/fixunsdfdi.zig | 2 +- lib/std/special/compiler_rt/fixunsdfsi.zig | 2 +- lib/std/special/compiler_rt/fixunsdfti.zig | 2 +- lib/std/special/compiler_rt/fixunssfdi.zig | 2 +- lib/std/special/compiler_rt/fixunssfsi.zig | 2 +- lib/std/special/compiler_rt/fixunssfti.zig | 2 +- lib/std/special/compiler_rt/fixunstfdi.zig | 2 +- lib/std/special/compiler_rt/fixunstfsi.zig | 2 +- lib/std/special/compiler_rt/fixunstfti.zig | 2 +- lib/std/special/compiler_rt/floatdidf.zig | 2 +- lib/std/special/compiler_rt/floatsiXf.zig | 6 +-- lib/std/special/compiler_rt/floattidf.zig | 2 +- lib/std/special/compiler_rt/floattisf.zig | 2 +- lib/std/special/compiler_rt/floattitf.zig | 2 +- lib/std/special/compiler_rt/floatundidf.zig | 2 +- lib/std/special/compiler_rt/floatunditf.zig | 2 +- lib/std/special/compiler_rt/floatunsidf.zig | 2 +- lib/std/special/compiler_rt/floatunsitf.zig | 2 +- lib/std/special/compiler_rt/floatuntidf.zig | 2 +- lib/std/special/compiler_rt/floatuntisf.zig | 2 +- lib/std/special/compiler_rt/floatuntitf.zig | 2 +- lib/std/special/compiler_rt/lshrti3.zig | 2 +- lib/std/special/compiler_rt/modti3.zig | 4 +- lib/std/special/compiler_rt/mulXf3.zig | 6 +-- lib/std/special/compiler_rt/muldi3.zig | 2 +- lib/std/special/compiler_rt/mulodi4.zig | 2 +- lib/std/special/compiler_rt/muloti4.zig | 2 +- lib/std/special/compiler_rt/multi3.zig | 4 +- lib/std/special/compiler_rt/negXf2.zig | 4 +- lib/std/special/compiler_rt/popcountdi2.zig | 2 +- lib/std/special/compiler_rt/truncXfYf2.zig | 10 ++--- lib/std/special/compiler_rt/udivmoddi4.zig | 2 +- lib/std/special/compiler_rt/udivmodti4.zig | 4 +- lib/std/special/compiler_rt/udivti3.zig | 4 +- lib/std/special/compiler_rt/umodti3.zig | 4 +- lib/std/start.zig | 12 ++---- lib/std/thread.zig | 6 +-- lib/std/unicode/throughput_test.zig | 2 +- test/compile_errors.zig | 6 +-- test/stage1/behavior/align.zig | 6 +-- test/stage1/behavior/bugs/1310.zig | 4 +- test/stage1/behavior/cast.zig | 4 +- test/stage1/behavior/misc.zig | 2 +- test/stage1/behavior/struct.zig | 4 +- test/standalone/load_dynamic_library/main.zig | 2 +- test/translate_c.zig | 4 +- 76 files changed, 153 insertions(+), 160 deletions(-) diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 5ef25ec9fcb81f423cb06b620c0c2ed0dde6c4ff..94f81908daff58f77c6b6dcf65c8e5343992fd61 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -2428,7 +2428,7 @@ fn resetSegfaultHandler() void { os.sigaction(os.SIGILL, &act, null); } -extern fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_void) noreturn { +fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_void) callconv(.C) noreturn { // Reset to the default handler so that if a segfault happens in this handler it will crash // the process. Also when this handler returns, the original instruction will be repeated // and the resulting segfault will crash the process rather than continually dump stack traces. diff --git a/lib/std/json/test.zig b/lib/std/json/test.zig index 2dc5b860ed0c66a7cbd0aceec9dc8a24bbfd164e..5cc069bda3c705376c626de6ac5f38fee62105d2 100644 --- a/lib/std/json/test.zig +++ b/lib/std/json/test.zig @@ -22,7 +22,7 @@ fn err(comptime s: []const u8) void { const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator; var p = std.json.Parser.init(allocator, false); - if(p.parse(s)) |_| { + if (p.parse(s)) |_| { unreachable; } else |_| {} } @@ -33,7 +33,7 @@ fn any(comptime s: []const u8) void { var mem_buffer: [1024 * 20]u8 = undefined; const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator; var p = std.json.Parser.init(allocator, false); - + _ = p.parse(s) catch {}; } @@ -44,7 +44,7 @@ fn anyStreamingErrNonStreaming(comptime s: []const u8) void { const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator; var p = std.json.Parser.init(allocator, false); - if(p.parse(s)) |_| { + if (p.parse(s)) |_| { unreachable; } else |_| {} } @@ -1742,9 +1742,9 @@ test "i_number_double_huge_neg_exp" { test "i_number_huge_exp" { return error.SkipZigTest; // FIXME Integer overflow in parseFloat -// any( -// \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] -// ); + // any( + // \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] + // ); } test "i_number_neg_int_huge_exp" { diff --git a/lib/std/math/sqrt.zig b/lib/std/math/sqrt.zig index 493e2cacf667b1e56890df8660acfabd2dd18c15..800a7574ae107b413a364388b2ca859f44b6f239 100644 --- a/lib/std/math/sqrt.zig +++ b/lib/std/math/sqrt.zig @@ -70,4 +70,3 @@ pub fn Sqrt(comptime T: type) type { else => T, }; } - diff --git a/lib/std/mutex.zig b/lib/std/mutex.zig index 94ec598a5c45db11b0a4754ca4a24bbd7c2f0b48..7fbe4fde1842aaa0e7698e2f5790eceeb220c309 100644 --- a/lib/std/mutex.zig +++ b/lib/std/mutex.zig @@ -17,7 +17,7 @@ const ResetEvent = std.ResetEvent; /// Example usage: /// var m = Mutex.init(); /// defer m.deinit(); -/// +/// /// const lock = m.acquire(); /// defer lock.release(); /// ... critical code diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index efba40bb8da75112e60fe27997bc51faf24d36b3..94fad4cfb7f54cb13ecc63a5c0a68711011bea7f 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -512,7 +512,7 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { return syscall2(SYS_clock_gettime, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp)); } -extern fn init_vdso_clock_gettime(clk: i32, ts: *timespec) usize { +fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { const ptr = @intToPtr(?*const c_void, vdso.lookup(VDSO_CGT_VER, VDSO_CGT_SYM)); // Note that we may not have a VDSO at all, update the stub address anyway // so that clock_gettime will fall back on the good old (and slow) syscall diff --git a/lib/std/os/linux/arm-eabi.zig b/lib/std/os/linux/arm-eabi.zig index 879805696c0472d72f4f223c3fa94c83157de7df..2e55abd6881858c3d6fe46447a9dc7e2dfaa806f 100644 --- a/lib/std/os/linux/arm-eabi.zig +++ b/lib/std/os/linux/arm-eabi.zig @@ -91,7 +91,7 @@ pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, a // LLVM calls this when the read-tp-hard feature is set to false. Currently, there is no way to pass // that to llvm via zig, see https://github.com/ziglang/zig/issues/2883. // LLVM expects libc to provide this function as __aeabi_read_tp, so it is exported if needed from special/c.zig. -pub extern fn getThreadPointer() usize { +pub fn getThreadPointer() callconv(.C) usize { return asm volatile ("mrc p15, 0, %[ret], c13, c0, 3" : [ret] "=r" (-> usize) ); diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 877b95af1fb83bc3c38ad04ce0c198680464b9b8..1e51dd6f82c1f2aa178e7c17f1481aaf17ca0a87 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -166,7 +166,7 @@ test "sigaltstack" { // analyzed const dl_phdr_info = if (@hasDecl(os, "dl_phdr_info")) os.dl_phdr_info else c_void; -extern fn iter_fn(info: *dl_phdr_info, size: usize, data: ?*usize) i32 { +fn iter_fn(info: *dl_phdr_info, size: usize, data: ?*usize) callconv(.C) i32 { if (builtin.os == .windows or builtin.os == .wasi or builtin.os == .macosx) return 0; diff --git a/lib/std/special/c.zig b/lib/std/special/c.zig index 1e63d9911f06b664d452972f7863474584793665..604bfd277a4c10a29905d4b8891723f3fe67ab37 100644 --- a/lib/std/special/c.zig +++ b/lib/std/special/c.zig @@ -40,19 +40,19 @@ comptime { extern var _fltused: c_int = 1; extern fn main(argc: c_int, argv: [*:null]?[*:0]u8) c_int; -extern fn wasm_start() void { +fn wasm_start() callconv(.C) void { _ = main(0, undefined); } -extern fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) c_int { +fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) callconv(.C) c_int { return std.cstr.cmp(s1, s2); } -extern fn strlen(s: [*:0]const u8) usize { +fn strlen(s: [*:0]const u8) callconv(.C) usize { return std.mem.len(u8, s); } -extern fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) c_int { +fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.C) c_int { if (_n == 0) return 0; var l = _l; var r = _r; @@ -65,7 +65,7 @@ extern fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) c_int { return @as(c_int, l[0]) - @as(c_int, r[0]); } -extern fn strerror(errnum: c_int) [*:0]const u8 { +fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 { return "TODO strerror implementation"; } @@ -188,7 +188,7 @@ comptime { @export("clone", clone, builtin.GlobalLinkage.Strong); } } -extern fn __stack_chk_fail() noreturn { +fn __stack_chk_fail() callconv(.C) noreturn { @panic("stack smashing detected"); } @@ -750,7 +750,6 @@ test "sqrt special" { std.testing.expect(std.math.isNan(sqrt(std.math.nan(f64)))); } - export fn sqrtf(x: f32) f32 { const tiny: f32 = 1.0e-30; const sign: i32 = @bitCast(i32, @as(u32, 0x80000000)); @@ -848,4 +847,3 @@ test "sqrtf special" { std.testing.expect(std.math.isNan(sqrtf(-1.0))); std.testing.expect(std.math.isNan(sqrtf(std.math.nan(f32)))); } - diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index f821918ccc5d13db6a71f781ce631b36ec8445ba..3a6e9c97e27474318ea0ad78d696a640852417da 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -309,7 +309,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn } } -extern fn __stack_chk_fail() noreturn { +fn __stack_chk_fail() callconv(.C) noreturn { @panic("stack smashing detected"); } @@ -320,17 +320,17 @@ extern var __stack_chk_guard: usize = blk: { break :blk @bitCast(usize, buf); }; -extern fn __aeabi_unwind_cpp_pr0() void { +fn __aeabi_unwind_cpp_pr0() callconv(.C) void { unreachable; } -extern fn __aeabi_unwind_cpp_pr1() void { +fn __aeabi_unwind_cpp_pr1() callconv(.C) void { unreachable; } -extern fn __aeabi_unwind_cpp_pr2() void { +fn __aeabi_unwind_cpp_pr2() callconv(.C) void { unreachable; } -extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 { +fn __divmoddi4(a: i64, b: i64, rem: *i64) callconv(.C) i64 { @setRuntimeSafety(is_test); const d = __divdi3(a, b); @@ -338,7 +338,7 @@ extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 { return d; } -extern fn __divdi3(a: i64, b: i64) i64 { +fn __divdi3(a: i64, b: i64) callconv(.C) i64 { @setRuntimeSafety(is_test); // Set aside the sign of the quotient. @@ -352,7 +352,7 @@ extern fn __divdi3(a: i64, b: i64) i64 { return @bitCast(i64, (res ^ sign) -% sign); } -extern fn __moddi3(a: i64, b: i64) i64 { +fn __moddi3(a: i64, b: i64) callconv(.C) i64 { @setRuntimeSafety(is_test); // Take absolute value of a and b via abs(x) = (x^(x >> 63)) - (x >> 63). @@ -365,12 +365,12 @@ extern fn __moddi3(a: i64, b: i64) i64 { return (@bitCast(i64, r) ^ (a >> 63)) -% (a >> 63); } -extern fn __udivdi3(a: u64, b: u64) u64 { +fn __udivdi3(a: u64, b: u64) callconv(.C) u64 { @setRuntimeSafety(is_test); return __udivmoddi4(a, b, null); } -extern fn __umoddi3(a: u64, b: u64) u64 { +fn __umoddi3(a: u64, b: u64) callconv(.C) u64 { @setRuntimeSafety(is_test); var r: u64 = undefined; @@ -378,7 +378,7 @@ extern fn __umoddi3(a: u64, b: u64) u64 { return r; } -extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct { +fn __aeabi_uidivmod(n: u32, d: u32) callconv(.C) extern struct { q: u32, r: u32, } { @@ -389,7 +389,7 @@ extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct { return result; } -extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct { +fn __aeabi_uldivmod(n: u64, d: u64) callconv(.C) extern struct { q: u64, r: u64, } { @@ -400,7 +400,7 @@ extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct { return result; } -extern fn __aeabi_idivmod(n: i32, d: i32) extern struct { +fn __aeabi_idivmod(n: i32, d: i32) callconv(.C) extern struct { q: i32, r: i32, } { @@ -411,7 +411,7 @@ extern fn __aeabi_idivmod(n: i32, d: i32) extern struct { return result; } -extern fn __aeabi_ldivmod(n: i64, d: i64) extern struct { +fn __aeabi_ldivmod(n: i64, d: i64) callconv(.C) extern struct { q: i64, r: i64, } { @@ -635,7 +635,7 @@ fn __aeabi_memcmp() callconv(.Naked) noreturn { unreachable; } -extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 { +fn __divmodsi4(a: i32, b: i32, rem: *i32) callconv(.C) i32 { @setRuntimeSafety(is_test); const d = __divsi3(a, b); @@ -643,7 +643,7 @@ extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 { return d; } -extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 { +fn __udivmodsi4(a: u32, b: u32, rem: *u32) callconv(.C) u32 { @setRuntimeSafety(is_test); const d = __udivsi3(a, b); @@ -651,7 +651,7 @@ extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 { return d; } -extern fn __divsi3(n: i32, d: i32) i32 { +fn __divsi3(n: i32, d: i32) callconv(.C) i32 { @setRuntimeSafety(is_test); // Set aside the sign of the quotient. @@ -665,7 +665,7 @@ extern fn __divsi3(n: i32, d: i32) i32 { return @bitCast(i32, (res ^ sign) -% sign); } -extern fn __udivsi3(n: u32, d: u32) u32 { +fn __udivsi3(n: u32, d: u32) callconv(.C) u32 { @setRuntimeSafety(is_test); const n_uword_bits: c_uint = u32.bit_count; @@ -706,13 +706,13 @@ extern fn __udivsi3(n: u32, d: u32) u32 { return q; } -extern fn __modsi3(n: i32, d: i32) i32 { +fn __modsi3(n: i32, d: i32) callconv(.C) i32 { @setRuntimeSafety(is_test); return n -% __divsi3(n, d) *% d; } -extern fn __umodsi3(n: u32, d: u32) u32 { +fn __umodsi3(n: u32, d: u32) callconv(.C) u32 { @setRuntimeSafety(is_test); return n -% __udivsi3(n, d) *% d; diff --git a/lib/std/special/compiler_rt/addXf3.zig b/lib/std/special/compiler_rt/addXf3.zig index e3dd1819c35d1bd28ea8c5406f92bd951c6b44ff..ac38e1c8cd50c8c3c0e0f39a61687937061a63d0 100644 --- a/lib/std/special/compiler_rt/addXf3.zig +++ b/lib/std/special/compiler_rt/addXf3.zig @@ -6,29 +6,29 @@ const std = @import("std"); const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __addsf3(a: f32, b: f32) f32 { +pub fn __addsf3(a: f32, b: f32) callconv(.C) f32 { return addXf3(f32, a, b); } -pub extern fn __adddf3(a: f64, b: f64) f64 { +pub fn __adddf3(a: f64, b: f64) callconv(.C) f64 { return addXf3(f64, a, b); } -pub extern fn __addtf3(a: f128, b: f128) f128 { +pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 { return addXf3(f128, a, b); } -pub extern fn __subsf3(a: f32, b: f32) f32 { +pub fn __subsf3(a: f32, b: f32) callconv(.C) f32 { const neg_b = @bitCast(f32, @bitCast(u32, b) ^ (@as(u32, 1) << 31)); return addXf3(f32, a, neg_b); } -pub extern fn __subdf3(a: f64, b: f64) f64 { +pub fn __subdf3(a: f64, b: f64) callconv(.C) f64 { const neg_b = @bitCast(f64, @bitCast(u64, b) ^ (@as(u64, 1) << 63)); return addXf3(f64, a, neg_b); } -pub extern fn __subtf3(a: f128, b: f128) f128 { +pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 { const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127)); return addXf3(f128, a, neg_b); } diff --git a/lib/std/special/compiler_rt/ashlti3.zig b/lib/std/special/compiler_rt/ashlti3.zig index 65b23f22e53f4d7679078671cbe95df303a9e9df..211515f9ddd3ba73dd17b60ac9c095bd0a57f861 100644 --- a/lib/std/special/compiler_rt/ashlti3.zig +++ b/lib/std/special/compiler_rt/ashlti3.zig @@ -1,7 +1,7 @@ const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __ashlti3(a: i128, b: i32) i128 { +pub fn __ashlti3(a: i128, b: i32) callconv(.C) i128 { var input = twords{ .all = a }; var result: twords = undefined; diff --git a/lib/std/special/compiler_rt/ashrti3.zig b/lib/std/special/compiler_rt/ashrti3.zig index 40ee89c3c4b5d1ecfe8c30abd082eddf2fda189e..1bcd40d2e4d2a9c86b2e936aab7d9bdc1dd55b07 100644 --- a/lib/std/special/compiler_rt/ashrti3.zig +++ b/lib/std/special/compiler_rt/ashrti3.zig @@ -1,7 +1,7 @@ const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __ashrti3(a: i128, b: i32) i128 { +pub fn __ashrti3(a: i128, b: i32) callconv(.C) i128 { var input = twords{ .all = a }; var result: twords = undefined; diff --git a/lib/std/special/compiler_rt/aulldiv.zig b/lib/std/special/compiler_rt/aulldiv.zig index afc96492c1025d998b59de468a5263021f260962..2e2dd364d5381d73d2375d8169e8e02bcd708690 100644 --- a/lib/std/special/compiler_rt/aulldiv.zig +++ b/lib/std/special/compiler_rt/aulldiv.zig @@ -1,6 +1,6 @@ const builtin = @import("builtin"); -pub extern fn _alldiv(a: i64, b: i64) callconv(.Stdcall) i64 { +pub fn _alldiv(a: i64, b: i64) callconv(.Stdcall) i64 { @setRuntimeSafety(builtin.is_test); const s_a = a >> (i64.bit_count - 1); const s_b = b >> (i64.bit_count - 1); diff --git a/lib/std/special/compiler_rt/aullrem.zig b/lib/std/special/compiler_rt/aullrem.zig index 748aaa0f89171c27a7899193b73096788eb60df4..4244f1bb8043c4502bf5cde5eb73a8f23b1026b2 100644 --- a/lib/std/special/compiler_rt/aullrem.zig +++ b/lib/std/special/compiler_rt/aullrem.zig @@ -1,6 +1,6 @@ const builtin = @import("builtin"); -pub extern fn _allrem(a: i64, b: i64) callconv(.Stdcall) i64 { +pub fn _allrem(a: i64, b: i64) callconv(.Stdcall) i64 { @setRuntimeSafety(builtin.is_test); const s_a = a >> (i64.bit_count - 1); const s_b = b >> (i64.bit_count - 1); diff --git a/lib/std/special/compiler_rt/comparedf2.zig b/lib/std/special/compiler_rt/comparedf2.zig index 95dc8786302610dde75888a4bcbf8998376de5b5..b6e08c49f4059da3bf4d5cffecf2351aa53802c5 100644 --- a/lib/std/special/compiler_rt/comparedf2.zig +++ b/lib/std/special/compiler_rt/comparedf2.zig @@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0); const LE_GREATER = @as(c_int, 1); const LE_UNORDERED = @as(c_int, 1); -pub extern fn __ledf2(a: fp_t, b: fp_t) c_int { +pub fn __ledf2(a: fp_t, b: fp_t) callconv(.C) c_int { @setRuntimeSafety(is_test); const aInt: srep_t = @bitCast(srep_t, a); const bInt: srep_t = @bitCast(srep_t, b); @@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0); const GE_GREATER = @as(c_int, 1); const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED -pub extern fn __gedf2(a: fp_t, b: fp_t) c_int { +pub fn __gedf2(a: fp_t, b: fp_t) callconv(.C) c_int { @setRuntimeSafety(is_test); const aInt: srep_t = @bitCast(srep_t, a); const bInt: srep_t = @bitCast(srep_t, b); @@ -94,26 +94,26 @@ pub extern fn __gedf2(a: fp_t, b: fp_t) c_int { } } -pub extern fn __unorddf2(a: fp_t, b: fp_t) c_int { +pub fn __unorddf2(a: fp_t, b: fp_t) callconv(.C) c_int { @setRuntimeSafety(is_test); const aAbs: rep_t = @bitCast(rep_t, a) & absMask; const bAbs: rep_t = @bitCast(rep_t, b) & absMask; return @boolToInt(aAbs > infRep or bAbs > infRep); } -pub extern fn __eqdf2(a: fp_t, b: fp_t) c_int { +pub fn __eqdf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __ledf2(a, b); } -pub extern fn __ltdf2(a: fp_t, b: fp_t) c_int { +pub fn __ltdf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __ledf2(a, b); } -pub extern fn __nedf2(a: fp_t, b: fp_t) c_int { +pub fn __nedf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __ledf2(a, b); } -pub extern fn __gtdf2(a: fp_t, b: fp_t) c_int { +pub fn __gtdf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __gedf2(a, b); } diff --git a/lib/std/special/compiler_rt/comparesf2.zig b/lib/std/special/compiler_rt/comparesf2.zig index 4468da4fbedaa626ed94e2235cd695f709388c3f..fdb5737ad376384ee07bff4c9187b147b49de5cb 100644 --- a/lib/std/special/compiler_rt/comparesf2.zig +++ b/lib/std/special/compiler_rt/comparesf2.zig @@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0); const LE_GREATER = @as(c_int, 1); const LE_UNORDERED = @as(c_int, 1); -pub extern fn __lesf2(a: fp_t, b: fp_t) c_int { +pub fn __lesf2(a: fp_t, b: fp_t) callconv(.C) c_int { @setRuntimeSafety(is_test); const aInt: srep_t = @bitCast(srep_t, a); const bInt: srep_t = @bitCast(srep_t, b); @@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0); const GE_GREATER = @as(c_int, 1); const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED -pub extern fn __gesf2(a: fp_t, b: fp_t) c_int { +pub fn __gesf2(a: fp_t, b: fp_t) callconv(.C) c_int { @setRuntimeSafety(is_test); const aInt: srep_t = @bitCast(srep_t, a); const bInt: srep_t = @bitCast(srep_t, b); @@ -94,26 +94,26 @@ pub extern fn __gesf2(a: fp_t, b: fp_t) c_int { } } -pub extern fn __unordsf2(a: fp_t, b: fp_t) c_int { +pub fn __unordsf2(a: fp_t, b: fp_t) callconv(.C) c_int { @setRuntimeSafety(is_test); const aAbs: rep_t = @bitCast(rep_t, a) & absMask; const bAbs: rep_t = @bitCast(rep_t, b) & absMask; return @boolToInt(aAbs > infRep or bAbs > infRep); } -pub extern fn __eqsf2(a: fp_t, b: fp_t) c_int { +pub fn __eqsf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __lesf2(a, b); } -pub extern fn __ltsf2(a: fp_t, b: fp_t) c_int { +pub fn __ltsf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __lesf2(a, b); } -pub extern fn __nesf2(a: fp_t, b: fp_t) c_int { +pub fn __nesf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __lesf2(a, b); } -pub extern fn __gtsf2(a: fp_t, b: fp_t) c_int { +pub fn __gtsf2(a: fp_t, b: fp_t) callconv(.C) c_int { return __gesf2(a, b); } diff --git a/lib/std/special/compiler_rt/comparetf2.zig b/lib/std/special/compiler_rt/comparetf2.zig index e9730184551905b1bac835743fef3b2d0019a706..f2969f2112a4adf20de7692272dab81c4e3b7fee 100644 --- a/lib/std/special/compiler_rt/comparetf2.zig +++ b/lib/std/special/compiler_rt/comparetf2.zig @@ -21,7 +21,7 @@ const infRep = exponentMask; const builtin = @import("builtin"); const is_test = builtin.is_test; -pub extern fn __letf2(a: f128, b: f128) c_int { +pub fn __letf2(a: f128, b: f128) callconv(.C) c_int { @setRuntimeSafety(is_test); const aInt = @bitCast(rep_t, a); @@ -65,7 +65,7 @@ const GE_EQUAL = @as(c_int, 0); const GE_GREATER = @as(c_int, 1); const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED -pub extern fn __getf2(a: f128, b: f128) c_int { +pub fn __getf2(a: f128, b: f128) callconv(.C) c_int { @setRuntimeSafety(is_test); const aInt = @bitCast(srep_t, a); @@ -90,7 +90,7 @@ pub extern fn __getf2(a: f128, b: f128) c_int { GE_GREATER; } -pub extern fn __unordtf2(a: f128, b: f128) c_int { +pub fn __unordtf2(a: f128, b: f128) callconv(.C) c_int { @setRuntimeSafety(is_test); const aAbs = @bitCast(rep_t, a) & absMask; diff --git a/lib/std/special/compiler_rt/divdf3.zig b/lib/std/special/compiler_rt/divdf3.zig index 9937b09497e96cbffc3466306c3d8c5d4c3a0f3f..a8afd4a3a69c214c462986f9c929879cbf54d46d 100644 --- a/lib/std/special/compiler_rt/divdf3.zig +++ b/lib/std/special/compiler_rt/divdf3.zig @@ -5,7 +5,7 @@ const std = @import("std"); const builtin = @import("builtin"); -pub extern fn __divdf3(a: f64, b: f64) f64 { +pub fn __divdf3(a: f64, b: f64) callconv(.C) f64 { @setRuntimeSafety(builtin.is_test); const Z = @IntType(false, f64.bit_count); const SignedZ = @IntType(true, f64.bit_count); diff --git a/lib/std/special/compiler_rt/divsf3.zig b/lib/std/special/compiler_rt/divsf3.zig index 4ee2eed36cfa2bff63c4943758b3c0db695bb52e..ea882b4927b9f912f5f0b61273dfce02de7d8137 100644 --- a/lib/std/special/compiler_rt/divsf3.zig +++ b/lib/std/special/compiler_rt/divsf3.zig @@ -5,7 +5,7 @@ const std = @import("std"); const builtin = @import("builtin"); -pub extern fn __divsf3(a: f32, b: f32) f32 { +pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 { @setRuntimeSafety(builtin.is_test); const Z = @IntType(false, f32.bit_count); diff --git a/lib/std/special/compiler_rt/divti3.zig b/lib/std/special/compiler_rt/divti3.zig index fcb23a50d97b8a807c648602267071e27e704365..2b878f526962989f91773e281416765b67cc21b5 100644 --- a/lib/std/special/compiler_rt/divti3.zig +++ b/lib/std/special/compiler_rt/divti3.zig @@ -1,7 +1,7 @@ const udivmod = @import("udivmod.zig").udivmod; const builtin = @import("builtin"); -pub extern fn __divti3(a: i128, b: i128) i128 { +pub fn __divti3(a: i128, b: i128) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); const s_a = a >> (i128.bit_count - 1); @@ -16,7 +16,7 @@ pub extern fn __divti3(a: i128, b: i128) i128 { } const v128 = @Vector(2, u64); -pub extern fn __divti3_windows_x86_64(a: v128, b: v128) v128 { +pub fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { return @bitCast(v128, @call(.{ .modifier = .always_inline }, __divti3, .{ @bitCast(i128, a), @bitCast(i128, b), diff --git a/lib/std/special/compiler_rt/extendXfYf2.zig b/lib/std/special/compiler_rt/extendXfYf2.zig index 427bd4ec24d0b3b44bbe7a741e61d19eb351b5c7..10227043aa2e5f7bd6c4d8e4afff79998002cb0b 100644 --- a/lib/std/special/compiler_rt/extendXfYf2.zig +++ b/lib/std/special/compiler_rt/extendXfYf2.zig @@ -2,19 +2,19 @@ const std = @import("std"); const builtin = @import("builtin"); const is_test = builtin.is_test; -pub extern fn __extendsfdf2(a: f32) f64 { +pub fn __extendsfdf2(a: f32) callconv(.C) f64 { return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f64, f32, @bitCast(u32, a) }); } -pub extern fn __extenddftf2(a: f64) f128 { +pub fn __extenddftf2(a: f64) callconv(.C) f128 { return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f64, @bitCast(u64, a) }); } -pub extern fn __extendsftf2(a: f32) f128 { +pub fn __extendsftf2(a: f32) callconv(.C) f128 { return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f32, @bitCast(u32, a) }); } -pub extern fn __extendhfsf2(a: u16) f32 { +pub fn __extendhfsf2(a: u16) callconv(.C) f32 { return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a }); } diff --git a/lib/std/special/compiler_rt/fixdfdi.zig b/lib/std/special/compiler_rt/fixdfdi.zig index c108fd15aa9c322720746fb2b772ccfbc616f7cd..fb3b31d6e8305de809eceefc186fb022a8ad046e 100644 --- a/lib/std/special/compiler_rt/fixdfdi.zig +++ b/lib/std/special/compiler_rt/fixdfdi.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixdfdi(a: f64) i64 { +pub fn __fixdfdi(a: f64) callconv(.C) i64 { @setRuntimeSafety(builtin.is_test); return fixint(f64, i64, a); } diff --git a/lib/std/special/compiler_rt/fixdfsi.zig b/lib/std/special/compiler_rt/fixdfsi.zig index 83a17b2b0d069d56d1a99054420cbfacc30f9ab9..de21c86e43f42300939a5233a626a9e24141c297 100644 --- a/lib/std/special/compiler_rt/fixdfsi.zig +++ b/lib/std/special/compiler_rt/fixdfsi.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixdfsi(a: f64) i32 { +pub fn __fixdfsi(a: f64) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return fixint(f64, i32, a); } diff --git a/lib/std/special/compiler_rt/fixdfti.zig b/lib/std/special/compiler_rt/fixdfti.zig index e30f885cf6304148673c18f5fe396bea622b6ccc..0e21f0ba192147cee20614c3c63657ed90dd8baa 100644 --- a/lib/std/special/compiler_rt/fixdfti.zig +++ b/lib/std/special/compiler_rt/fixdfti.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixdfti(a: f64) i128 { +pub fn __fixdfti(a: f64) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); return fixint(f64, i128, a); } diff --git a/lib/std/special/compiler_rt/fixsfdi.zig b/lib/std/special/compiler_rt/fixsfdi.zig index ffa81d13ab92bb4559d242b77cf8b33c33d4af66..d3aaf9d470f217deb20e469fe2eacfd5ff8785e2 100644 --- a/lib/std/special/compiler_rt/fixsfdi.zig +++ b/lib/std/special/compiler_rt/fixsfdi.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixsfdi(a: f32) i64 { +pub fn __fixsfdi(a: f32) callconv(.C) i64 { @setRuntimeSafety(builtin.is_test); return fixint(f32, i64, a); } diff --git a/lib/std/special/compiler_rt/fixsfsi.zig b/lib/std/special/compiler_rt/fixsfsi.zig index 9a94b4395bf490585211f0afb33eb0b9fc920e8c..81aa01dfa1b5a63f6b5cd7176da42e4d493112bc 100644 --- a/lib/std/special/compiler_rt/fixsfsi.zig +++ b/lib/std/special/compiler_rt/fixsfsi.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixsfsi(a: f32) i32 { +pub fn __fixsfsi(a: f32) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return fixint(f32, i32, a); } diff --git a/lib/std/special/compiler_rt/fixsfti.zig b/lib/std/special/compiler_rt/fixsfti.zig index 806a1678aa1e700530eef1fcd2d4c082ad14b8ff..d7ce4b3a602d6ffe9184e418270404fb3d63ab12 100644 --- a/lib/std/special/compiler_rt/fixsfti.zig +++ b/lib/std/special/compiler_rt/fixsfti.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixsfti(a: f32) i128 { +pub fn __fixsfti(a: f32) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); return fixint(f32, i128, a); } diff --git a/lib/std/special/compiler_rt/fixtfdi.zig b/lib/std/special/compiler_rt/fixtfdi.zig index 8d99231b74e7b07360889017607c9ee4e43cc425..0ef3aa225937ad6b4af07c725efdce8a1cbba70b 100644 --- a/lib/std/special/compiler_rt/fixtfdi.zig +++ b/lib/std/special/compiler_rt/fixtfdi.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixtfdi(a: f128) i64 { +pub fn __fixtfdi(a: f128) callconv(.C) i64 { @setRuntimeSafety(builtin.is_test); return fixint(f128, i64, a); } diff --git a/lib/std/special/compiler_rt/fixtfsi.zig b/lib/std/special/compiler_rt/fixtfsi.zig index f3f83634b2c8d38fbd380a21d4793cab9f2f2f27..15e89a11b0b0820fda7bd70ead0a3e36d14b3ac8 100644 --- a/lib/std/special/compiler_rt/fixtfsi.zig +++ b/lib/std/special/compiler_rt/fixtfsi.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixtfsi(a: f128) i32 { +pub fn __fixtfsi(a: f128) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return fixint(f128, i32, a); } diff --git a/lib/std/special/compiler_rt/fixtfti.zig b/lib/std/special/compiler_rt/fixtfti.zig index 07d38f2c3b7fde180b79262c999f1cb2b1260146..733fa1eed1b0be8f4b89f480f2144712db3f039f 100644 --- a/lib/std/special/compiler_rt/fixtfti.zig +++ b/lib/std/special/compiler_rt/fixtfti.zig @@ -1,7 +1,7 @@ const fixint = @import("fixint.zig").fixint; const builtin = @import("builtin"); -pub extern fn __fixtfti(a: f128) i128 { +pub fn __fixtfti(a: f128) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); return fixint(f128, i128, a); } diff --git a/lib/std/special/compiler_rt/fixunsdfdi.zig b/lib/std/special/compiler_rt/fixunsdfdi.zig index 1fa7ed758ebe3a4b9e3dbf70125901b325fdad2c..9d41d4b740934d4783cb2c0cea4d3bde7849d858 100644 --- a/lib/std/special/compiler_rt/fixunsdfdi.zig +++ b/lib/std/special/compiler_rt/fixunsdfdi.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunsdfdi(a: f64) u64 { +pub fn __fixunsdfdi(a: f64) callconv(.C) u64 { @setRuntimeSafety(builtin.is_test); return fixuint(f64, u64, a); } diff --git a/lib/std/special/compiler_rt/fixunsdfsi.zig b/lib/std/special/compiler_rt/fixunsdfsi.zig index a77cb8df896fa3566b5911c91d2dcf1499ae12a7..044523512c80466c334b18b251fcbc8a2f0aca55 100644 --- a/lib/std/special/compiler_rt/fixunsdfsi.zig +++ b/lib/std/special/compiler_rt/fixunsdfsi.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunsdfsi(a: f64) u32 { +pub fn __fixunsdfsi(a: f64) callconv(.C) u32 { @setRuntimeSafety(builtin.is_test); return fixuint(f64, u32, a); } diff --git a/lib/std/special/compiler_rt/fixunsdfti.zig b/lib/std/special/compiler_rt/fixunsdfti.zig index 6e1ded46e5f6044466365a8939e94dd2f15c5195..3dcec6bf8987635352c1841137f88f331e9f422a 100644 --- a/lib/std/special/compiler_rt/fixunsdfti.zig +++ b/lib/std/special/compiler_rt/fixunsdfti.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunsdfti(a: f64) u128 { +pub fn __fixunsdfti(a: f64) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return fixuint(f64, u128, a); } diff --git a/lib/std/special/compiler_rt/fixunssfdi.zig b/lib/std/special/compiler_rt/fixunssfdi.zig index 36d4acc28c66978e712be97ddaa0f38da3273f15..a42121aeec963332e1d935ef9084b483e1ec32b6 100644 --- a/lib/std/special/compiler_rt/fixunssfdi.zig +++ b/lib/std/special/compiler_rt/fixunssfdi.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunssfdi(a: f32) u64 { +pub fn __fixunssfdi(a: f32) callconv(.C) u64 { @setRuntimeSafety(builtin.is_test); return fixuint(f32, u64, a); } diff --git a/lib/std/special/compiler_rt/fixunssfsi.zig b/lib/std/special/compiler_rt/fixunssfsi.zig index 53130286a1178da6f46f40586d7ff89dd073b0f5..00f7c8ad22586a00b79b9fb11fc2bd285a0e473d 100644 --- a/lib/std/special/compiler_rt/fixunssfsi.zig +++ b/lib/std/special/compiler_rt/fixunssfsi.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunssfsi(a: f32) u32 { +pub fn __fixunssfsi(a: f32) callconv(.C) u32 { @setRuntimeSafety(builtin.is_test); return fixuint(f32, u32, a); } diff --git a/lib/std/special/compiler_rt/fixunssfti.zig b/lib/std/special/compiler_rt/fixunssfti.zig index f0cd788d2e1a54a9f18c53e5d8d488e1392bc519..dff9eb74980f6136a8af30ea350c3f42d1160ae7 100644 --- a/lib/std/special/compiler_rt/fixunssfti.zig +++ b/lib/std/special/compiler_rt/fixunssfti.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunssfti(a: f32) u128 { +pub fn __fixunssfti(a: f32) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return fixuint(f32, u128, a); } diff --git a/lib/std/special/compiler_rt/fixunstfdi.zig b/lib/std/special/compiler_rt/fixunstfdi.zig index e352044708d1d215e4143416364e15a2ccd9342c..907116c1650ee53ba9d5b3417ef5ec6253513be9 100644 --- a/lib/std/special/compiler_rt/fixunstfdi.zig +++ b/lib/std/special/compiler_rt/fixunstfdi.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunstfdi(a: f128) u64 { +pub fn __fixunstfdi(a: f128) callconv(.C) u64 { @setRuntimeSafety(builtin.is_test); return fixuint(f128, u64, a); } diff --git a/lib/std/special/compiler_rt/fixunstfsi.zig b/lib/std/special/compiler_rt/fixunstfsi.zig index 579c559790cac305e5b08b5df22a01f1c3bf0785..c66a3f18b492a2bfa05a91324dbe5784a5db6847 100644 --- a/lib/std/special/compiler_rt/fixunstfsi.zig +++ b/lib/std/special/compiler_rt/fixunstfsi.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunstfsi(a: f128) u32 { +pub fn __fixunstfsi(a: f128) callconv(.C) u32 { @setRuntimeSafety(builtin.is_test); return fixuint(f128, u32, a); } diff --git a/lib/std/special/compiler_rt/fixunstfti.zig b/lib/std/special/compiler_rt/fixunstfti.zig index cd6178164ab26eedbd1df45b9852af1eb4dc786d..1867c69234ba49606f774885efba862449e7dedb 100644 --- a/lib/std/special/compiler_rt/fixunstfti.zig +++ b/lib/std/special/compiler_rt/fixunstfti.zig @@ -1,7 +1,7 @@ const fixuint = @import("fixuint.zig").fixuint; const builtin = @import("builtin"); -pub extern fn __fixunstfti(a: f128) u128 { +pub fn __fixunstfti(a: f128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return fixuint(f128, u128, a); } diff --git a/lib/std/special/compiler_rt/floatdidf.zig b/lib/std/special/compiler_rt/floatdidf.zig index 1610136413a9aa1b4461222021e9de691f64df85..93bd0c8a3e5b0851d28baa8f908f38eab38ddc75 100644 --- a/lib/std/special/compiler_rt/floatdidf.zig +++ b/lib/std/special/compiler_rt/floatdidf.zig @@ -4,7 +4,7 @@ const std = @import("std"); const twop52: f64 = 0x1.0p52; const twop32: f64 = 0x1.0p32; -pub extern fn __floatdidf(a: i64) f64 { +pub fn __floatdidf(a: i64) callconv(.C) f64 { @setRuntimeSafety(builtin.is_test); if (a == 0) return 0; diff --git a/lib/std/special/compiler_rt/floatsiXf.zig b/lib/std/special/compiler_rt/floatsiXf.zig index 917dfb47fc592fb41ce761bb5e09eab7c6f8ada3..30a09de90c340bbd619c1993fa822cae87f7d4b0 100644 --- a/lib/std/special/compiler_rt/floatsiXf.zig +++ b/lib/std/special/compiler_rt/floatsiXf.zig @@ -53,17 +53,17 @@ fn floatsiXf(comptime T: type, a: i32) T { return @bitCast(T, result); } -pub extern fn __floatsisf(arg: i32) f32 { +pub fn __floatsisf(arg: i32) callconv(.C) f32 { @setRuntimeSafety(builtin.is_test); return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f32, arg }); } -pub extern fn __floatsidf(arg: i32) f64 { +pub fn __floatsidf(arg: i32) callconv(.C) f64 { @setRuntimeSafety(builtin.is_test); return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f64, arg }); } -pub extern fn __floatsitf(arg: i32) f128 { +pub fn __floatsitf(arg: i32) callconv(.C) f128 { @setRuntimeSafety(builtin.is_test); return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg }); } diff --git a/lib/std/special/compiler_rt/floattidf.zig b/lib/std/special/compiler_rt/floattidf.zig index 1e83674598a097ed6ec1a3c67821efa3142c5500..6b5013287b9e45f8a8bdc9ea6e5990a68876a029 100644 --- a/lib/std/special/compiler_rt/floattidf.zig +++ b/lib/std/special/compiler_rt/floattidf.zig @@ -5,7 +5,7 @@ const maxInt = std.math.maxInt; const DBL_MANT_DIG = 53; -pub extern fn __floattidf(arg: i128) f64 { +pub fn __floattidf(arg: i128) callconv(.C) f64 { @setRuntimeSafety(is_test); if (arg == 0) diff --git a/lib/std/special/compiler_rt/floattisf.zig b/lib/std/special/compiler_rt/floattisf.zig index 0c02bfff1f5057d5c27c7303eea7a2b036f266e0..3f020dadd845c83fec73e046059eaf291af80555 100644 --- a/lib/std/special/compiler_rt/floattisf.zig +++ b/lib/std/special/compiler_rt/floattisf.zig @@ -5,7 +5,7 @@ const maxInt = std.math.maxInt; const FLT_MANT_DIG = 24; -pub extern fn __floattisf(arg: i128) f32 { +pub fn __floattisf(arg: i128) callconv(.C) f32 { @setRuntimeSafety(is_test); if (arg == 0) diff --git a/lib/std/special/compiler_rt/floattitf.zig b/lib/std/special/compiler_rt/floattitf.zig index aac22e36d0125a231501d07cd22d3183936a6832..90bc241306fe2be609e32800a4362547eaed911c 100644 --- a/lib/std/special/compiler_rt/floattitf.zig +++ b/lib/std/special/compiler_rt/floattitf.zig @@ -5,7 +5,7 @@ const maxInt = std.math.maxInt; const LDBL_MANT_DIG = 113; -pub extern fn __floattitf(arg: i128) f128 { +pub fn __floattitf(arg: i128) callconv(.C) f128 { @setRuntimeSafety(is_test); if (arg == 0) diff --git a/lib/std/special/compiler_rt/floatundidf.zig b/lib/std/special/compiler_rt/floatundidf.zig index 68759a2acd16b54addbefaa4305d112a239eb179..c8803b4c6cc2ce55b476f5a74407aca439ab4029 100644 --- a/lib/std/special/compiler_rt/floatundidf.zig +++ b/lib/std/special/compiler_rt/floatundidf.zig @@ -5,7 +5,7 @@ const twop52: f64 = 0x1.0p52; const twop84: f64 = 0x1.0p84; const twop84_plus_twop52: f64 = 0x1.00000001p84; -pub extern fn __floatundidf(a: u64) f64 { +pub fn __floatundidf(a: u64) callconv(.C) f64 { @setRuntimeSafety(builtin.is_test); if (a == 0) return 0; diff --git a/lib/std/special/compiler_rt/floatunditf.zig b/lib/std/special/compiler_rt/floatunditf.zig index 9af83a2b5d5418c073981b90f62197a7df7b9d55..b574d21bd8fd1c0153b1116528265e81cfbb5eae 100644 --- a/lib/std/special/compiler_rt/floatunditf.zig +++ b/lib/std/special/compiler_rt/floatunditf.zig @@ -2,7 +2,7 @@ const builtin = @import("builtin"); const is_test = builtin.is_test; const std = @import("std"); -pub extern fn __floatunditf(a: u128) f128 { +pub fn __floatunditf(a: u128) callconv(.C) f128 { @setRuntimeSafety(is_test); if (a == 0) { diff --git a/lib/std/special/compiler_rt/floatunsidf.zig b/lib/std/special/compiler_rt/floatunsidf.zig index d744009aeaa708d43772c0166ed01ff056855d82..92a78708064b14d059a2fe1f781ffab7ca681156 100644 --- a/lib/std/special/compiler_rt/floatunsidf.zig +++ b/lib/std/special/compiler_rt/floatunsidf.zig @@ -4,7 +4,7 @@ const maxInt = std.math.maxInt; const implicitBit = @as(u64, 1) << 52; -pub extern fn __floatunsidf(arg: u32) f64 { +pub fn __floatunsidf(arg: u32) callconv(.C) f64 { @setRuntimeSafety(builtin.is_test); if (arg == 0) return 0.0; diff --git a/lib/std/special/compiler_rt/floatunsitf.zig b/lib/std/special/compiler_rt/floatunsitf.zig index 18397f8ad03b282ed2e3500d595b507b1ae5c1dc..a10ff6b70378448c60cbe7e00ed5c71d26280f07 100644 --- a/lib/std/special/compiler_rt/floatunsitf.zig +++ b/lib/std/special/compiler_rt/floatunsitf.zig @@ -2,7 +2,7 @@ const builtin = @import("builtin"); const is_test = builtin.is_test; const std = @import("std"); -pub extern fn __floatunsitf(a: u64) f128 { +pub fn __floatunsitf(a: u64) callconv(.C) f128 { @setRuntimeSafety(is_test); if (a == 0) { diff --git a/lib/std/special/compiler_rt/floatuntidf.zig b/lib/std/special/compiler_rt/floatuntidf.zig index 5d3a201058b6feca46721966575e36af30b26d21..5b5adc04910af64e03de2a12765896f0b2660d2f 100644 --- a/lib/std/special/compiler_rt/floatuntidf.zig +++ b/lib/std/special/compiler_rt/floatuntidf.zig @@ -5,7 +5,7 @@ const maxInt = std.math.maxInt; const DBL_MANT_DIG = 53; -pub extern fn __floatuntidf(arg: u128) f64 { +pub fn __floatuntidf(arg: u128) callconv(.C) f64 { @setRuntimeSafety(is_test); if (arg == 0) diff --git a/lib/std/special/compiler_rt/floatuntisf.zig b/lib/std/special/compiler_rt/floatuntisf.zig index e450ad9a48108d68f3d3799b5d11fb66bd719797..33e6e41a84fcb28ecdf21f8d447ba58227208ca9 100644 --- a/lib/std/special/compiler_rt/floatuntisf.zig +++ b/lib/std/special/compiler_rt/floatuntisf.zig @@ -5,7 +5,7 @@ const maxInt = std.math.maxInt; const FLT_MANT_DIG = 24; -pub extern fn __floatuntisf(arg: u128) f32 { +pub fn __floatuntisf(arg: u128) callconv(.C) f32 { @setRuntimeSafety(is_test); if (arg == 0) diff --git a/lib/std/special/compiler_rt/floatuntitf.zig b/lib/std/special/compiler_rt/floatuntitf.zig index f92942e0347ab3134c138a9854238fac141924f9..0b96076206dbdb69368519a94cd4121032151abf 100644 --- a/lib/std/special/compiler_rt/floatuntitf.zig +++ b/lib/std/special/compiler_rt/floatuntitf.zig @@ -5,7 +5,7 @@ const maxInt = std.math.maxInt; const LDBL_MANT_DIG = 113; -pub extern fn __floatuntitf(arg: u128) f128 { +pub fn __floatuntitf(arg: u128) callconv(.C) f128 { @setRuntimeSafety(is_test); if (arg == 0) diff --git a/lib/std/special/compiler_rt/lshrti3.zig b/lib/std/special/compiler_rt/lshrti3.zig index 329968ae40b6bbe7e5672da0a15d2a1932194b70..043be5e2a2966539ebc84739981d480fd9a342ac 100644 --- a/lib/std/special/compiler_rt/lshrti3.zig +++ b/lib/std/special/compiler_rt/lshrti3.zig @@ -1,7 +1,7 @@ const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __lshrti3(a: i128, b: i32) i128 { +pub fn __lshrti3(a: i128, b: i32) callconv(.C) i128 { var input = twords{ .all = a }; var result: twords = undefined; diff --git a/lib/std/special/compiler_rt/modti3.zig b/lib/std/special/compiler_rt/modti3.zig index d983ecba5f8e016f13177f826880195f7dbfcf87..a9d1f4846868ca311c475602e5658fec188e01c1 100644 --- a/lib/std/special/compiler_rt/modti3.zig +++ b/lib/std/special/compiler_rt/modti3.zig @@ -6,7 +6,7 @@ const udivmod = @import("udivmod.zig").udivmod; const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __modti3(a: i128, b: i128) i128 { +pub fn __modti3(a: i128, b: i128) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); const s_a = a >> (i128.bit_count - 1); // s = a < 0 ? -1 : 0 @@ -21,7 +21,7 @@ pub extern fn __modti3(a: i128, b: i128) i128 { } const v128 = @Vector(2, u64); -pub extern fn __modti3_windows_x86_64(a: v128, b: v128) v128 { +pub fn __modti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { return @bitCast(v128, @call(.{ .modifier = .always_inline }, __modti3, .{ @bitCast(i128, a), @bitCast(i128, b), diff --git a/lib/std/special/compiler_rt/mulXf3.zig b/lib/std/special/compiler_rt/mulXf3.zig index 11ee0b49a4da4931439a3045c457d40d3d2b7a52..9457bfb86e4f0e1060f343d10c5e8f3131d6c20c 100644 --- a/lib/std/special/compiler_rt/mulXf3.zig +++ b/lib/std/special/compiler_rt/mulXf3.zig @@ -6,13 +6,13 @@ const std = @import("std"); const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __multf3(a: f128, b: f128) f128 { +pub fn __multf3(a: f128, b: f128) callconv(.C) f128 { return mulXf3(f128, a, b); } -pub extern fn __muldf3(a: f64, b: f64) f64 { +pub fn __muldf3(a: f64, b: f64) callconv(.C) f64 { return mulXf3(f64, a, b); } -pub extern fn __mulsf3(a: f32, b: f32) f32 { +pub fn __mulsf3(a: f32, b: f32) callconv(.C) f32 { return mulXf3(f32, a, b); } diff --git a/lib/std/special/compiler_rt/muldi3.zig b/lib/std/special/compiler_rt/muldi3.zig index 3efc5a9ac64d45248c5e8181eef1f67ce120a688..4f605d441cb7c0a68bc392d3b6a6691ee495e1d8 100644 --- a/lib/std/special/compiler_rt/muldi3.zig +++ b/lib/std/special/compiler_rt/muldi3.zig @@ -39,7 +39,7 @@ fn __muldsi3(a: u32, b: u32) i64 { return r.all; } -pub extern fn __muldi3(a: i64, b: i64) i64 { +pub fn __muldi3(a: i64, b: i64) callconv(.C) i64 { @setRuntimeSafety(builtin.is_test); const x = dwords{ .all = a }; diff --git a/lib/std/special/compiler_rt/mulodi4.zig b/lib/std/special/compiler_rt/mulodi4.zig index 21c7fd1f974599e547ddc0d84f1f278509710d79..b70d1657e71130f8c0038c7ddbf1aad43e59bc7e 100644 --- a/lib/std/special/compiler_rt/mulodi4.zig +++ b/lib/std/special/compiler_rt/mulodi4.zig @@ -3,7 +3,7 @@ const compiler_rt = @import("../compiler_rt.zig"); const maxInt = std.math.maxInt; const minInt = std.math.minInt; -pub extern fn __mulodi4(a: i64, b: i64, overflow: *c_int) i64 { +pub fn __mulodi4(a: i64, b: i64, overflow: *c_int) callconv(.C) i64 { @setRuntimeSafety(builtin.is_test); const min = @bitCast(i64, @as(u64, 1 << (i64.bit_count - 1))); diff --git a/lib/std/special/compiler_rt/muloti4.zig b/lib/std/special/compiler_rt/muloti4.zig index ad6ad43808058eec06ef0a45bde65a079d9a3f4f..190959b8014e3275ff61524a2e6aeceb31907f78 100644 --- a/lib/std/special/compiler_rt/muloti4.zig +++ b/lib/std/special/compiler_rt/muloti4.zig @@ -1,7 +1,7 @@ const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __muloti4(a: i128, b: i128, overflow: *c_int) i128 { +pub fn __muloti4(a: i128, b: i128, overflow: *c_int) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); const min = @bitCast(i128, @as(u128, 1 << (i128.bit_count - 1))); diff --git a/lib/std/special/compiler_rt/multi3.zig b/lib/std/special/compiler_rt/multi3.zig index 56ff56cbb24e7d35b5f01be25a7e10e444acbfbb..f46bd55421d0cd1df9a6e1f4c19e4a2784538da2 100644 --- a/lib/std/special/compiler_rt/multi3.zig +++ b/lib/std/special/compiler_rt/multi3.zig @@ -5,7 +5,7 @@ const compiler_rt = @import("../compiler_rt.zig"); // ae684fad6d34858c014c94da69c15e7774a633c3 // 2018-08-13 -pub extern fn __multi3(a: i128, b: i128) i128 { +pub fn __multi3(a: i128, b: i128) callconv(.C) i128 { @setRuntimeSafety(builtin.is_test); const x = twords{ .all = a }; const y = twords{ .all = b }; @@ -15,7 +15,7 @@ pub extern fn __multi3(a: i128, b: i128) i128 { } const v128 = @Vector(2, u64); -pub extern fn __multi3_windows_x86_64(a: v128, b: v128) v128 { +pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{ @bitCast(i128, a), @bitCast(i128, b), diff --git a/lib/std/special/compiler_rt/negXf2.zig b/lib/std/special/compiler_rt/negXf2.zig index c4be085d62b111ed2cb8d93a7c14c3e057aee681..e21e36b9552be7ec465a651fa63397a3b7fc1781 100644 --- a/lib/std/special/compiler_rt/negXf2.zig +++ b/lib/std/special/compiler_rt/negXf2.zig @@ -1,10 +1,10 @@ const std = @import("std"); -pub extern fn __negsf2(a: f32) f32 { +pub fn __negsf2(a: f32) callconv(.C) f32 { return negXf2(f32, a); } -pub extern fn __negdf2(a: f64) f64 { +pub fn __negdf2(a: f64) callconv(.C) f64 { return negXf2(f64, a); } diff --git a/lib/std/special/compiler_rt/popcountdi2.zig b/lib/std/special/compiler_rt/popcountdi2.zig index ea36b0ec440ba6cb48f75cd45eea3cd3e86dd1b9..b7e7220c7b8c109ab8f49e74d1b0e067e561c0fd 100644 --- a/lib/std/special/compiler_rt/popcountdi2.zig +++ b/lib/std/special/compiler_rt/popcountdi2.zig @@ -2,7 +2,7 @@ const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); // ported from llvm compiler-rt 8.0.0rc3 95e1c294cb0415a377a7b1d6c7c7d4f89e1c04e4 -pub extern fn __popcountdi2(a: i64) i32 { +pub fn __popcountdi2(a: i64) callconv(.C) i32 { var x2 = @bitCast(u64, a); x2 = x2 - ((x2 >> 1) & 0x5555555555555555); // Every 2 bits holds the sum of every pair of bits (32) diff --git a/lib/std/special/compiler_rt/truncXfYf2.zig b/lib/std/special/compiler_rt/truncXfYf2.zig index d231c0d41655e0dcb687d09b40e4ac19ee87ff23..10b097e777c3daa6e1b193a4d83210efb77b7d9c 100644 --- a/lib/std/special/compiler_rt/truncXfYf2.zig +++ b/lib/std/special/compiler_rt/truncXfYf2.zig @@ -1,22 +1,22 @@ const std = @import("std"); -pub extern fn __truncsfhf2(a: f32) u16 { +pub fn __truncsfhf2(a: f32) callconv(.C) u16 { return @bitCast(u16, truncXfYf2(f16, f32, a)); } -pub extern fn __truncdfhf2(a: f64) u16 { +pub fn __truncdfhf2(a: f64) callconv(.C) u16 { return @bitCast(u16, truncXfYf2(f16, f64, a)); } -pub extern fn __trunctfsf2(a: f128) f32 { +pub fn __trunctfsf2(a: f128) callconv(.C) f32 { return truncXfYf2(f32, f128, a); } -pub extern fn __trunctfdf2(a: f128) f64 { +pub fn __trunctfdf2(a: f128) callconv(.C) f64 { return truncXfYf2(f64, f128, a); } -pub extern fn __truncdfsf2(a: f64) f32 { +pub fn __truncdfsf2(a: f64) callconv(.C) f32 { return truncXfYf2(f32, f64, a); } diff --git a/lib/std/special/compiler_rt/udivmoddi4.zig b/lib/std/special/compiler_rt/udivmoddi4.zig index de86c845e53369fa40be247e320964ad018dca28..79f0f39986462295889f6073b481691689bf332e 100644 --- a/lib/std/special/compiler_rt/udivmoddi4.zig +++ b/lib/std/special/compiler_rt/udivmoddi4.zig @@ -1,7 +1,7 @@ const udivmod = @import("udivmod.zig").udivmod; const builtin = @import("builtin"); -pub extern fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?*u64) u64 { +pub fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?*u64) callconv(.C) u64 { @setRuntimeSafety(builtin.is_test); return udivmod(u64, a, b, maybe_rem); } diff --git a/lib/std/special/compiler_rt/udivmodti4.zig b/lib/std/special/compiler_rt/udivmodti4.zig index c74dff512da2b9f773bb8cf899d04869215ffe0a..7a3405c3e201ba35f6f828ac839e1bd2af24c8f1 100644 --- a/lib/std/special/compiler_rt/udivmodti4.zig +++ b/lib/std/special/compiler_rt/udivmodti4.zig @@ -2,13 +2,13 @@ const udivmod = @import("udivmod.zig").udivmod; const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) u128 { +pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return udivmod(u128, a, b, maybe_rem); } const v128 = @Vector(2, u64); -pub extern fn __udivmodti4_windows_x86_64(a: v128, b: v128, maybe_rem: ?*u128) v128 { +pub fn __udivmodti4_windows_x86_64(a: v128, b: v128, maybe_rem: ?*u128) callconv(.C) v128 { @setRuntimeSafety(builtin.is_test); return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem)); } diff --git a/lib/std/special/compiler_rt/udivti3.zig b/lib/std/special/compiler_rt/udivti3.zig index ab451859bfc8008a8b0d52d060c3813d3f2c951e..6283285e013150153bdccd372188132a74d54d31 100644 --- a/lib/std/special/compiler_rt/udivti3.zig +++ b/lib/std/special/compiler_rt/udivti3.zig @@ -1,13 +1,13 @@ const udivmodti4 = @import("udivmodti4.zig"); const builtin = @import("builtin"); -pub extern fn __udivti3(a: u128, b: u128) u128 { +pub fn __udivti3(a: u128, b: u128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); return udivmodti4.__udivmodti4(a, b, null); } const v128 = @Vector(2, u64); -pub extern fn __udivti3_windows_x86_64(a: v128, b: v128) v128 { +pub fn __udivti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { @setRuntimeSafety(builtin.is_test); return udivmodti4.__udivmodti4_windows_x86_64(a, b, null); } diff --git a/lib/std/special/compiler_rt/umodti3.zig b/lib/std/special/compiler_rt/umodti3.zig index 9d4a42147c3901c0a5ff790c7d80e0735a237ee0..4f9890f51222ac292240c212845199f23b67a036 100644 --- a/lib/std/special/compiler_rt/umodti3.zig +++ b/lib/std/special/compiler_rt/umodti3.zig @@ -2,7 +2,7 @@ const udivmodti4 = @import("udivmodti4.zig"); const builtin = @import("builtin"); const compiler_rt = @import("../compiler_rt.zig"); -pub extern fn __umodti3(a: u128, b: u128) u128 { +pub fn __umodti3(a: u128, b: u128) callconv(.C) u128 { @setRuntimeSafety(builtin.is_test); var r: u128 = undefined; _ = udivmodti4.__udivmodti4(a, b, &r); @@ -10,7 +10,7 @@ pub extern fn __umodti3(a: u128, b: u128) u128 { } const v128 = @Vector(2, u64); -pub extern fn __umodti3_windows_x86_64(a: v128, b: v128) v128 { +pub fn __umodti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { return @bitCast(v128, @call(.{ .modifier = .always_inline }, __umodti3, .{ @bitCast(u128, a), @bitCast(u128, b), diff --git a/lib/std/start.zig b/lib/std/start.zig index a91910726605a593506c14b49f96c73a6d5a88b7..7c1353e18b98f31bcc3a2f880ad8b77a393ae348 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -43,11 +43,7 @@ comptime { } } -fn _DllMainCRTStartup( - hinstDLL: std.os.windows.HINSTANCE, - fdwReason: std.os.windows.DWORD, - lpReserved: std.os.windows.LPVOID, -) callconv(.Stdcall) std.os.windows.BOOL { +fn _DllMainCRTStartup(hinstDLL: std.os.windows.HINSTANCE, fdwReason: std.os.windows.DWORD, lpReserved: std.os.windows.LPVOID) callconv(.Stdcall) std.os.windows.BOOL { if (@hasDecl(root, "DllMain")) { return root.DllMain(hinstDLL, fdwReason, lpReserved); } @@ -55,13 +51,13 @@ fn _DllMainCRTStartup( return std.os.windows.TRUE; } -extern fn wasm_freestanding_start() void { +fn wasm_freestanding_start() callconv(.C) void { // This is marked inline because for some reason LLVM in release mode fails to inline it, // and we want fewer call frames in stack traces. _ = @call(.{ .modifier = .always_inline }, callMain, .{}); } -extern fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) usize { +fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize { const bad_efi_main_ret = "expected return type of main to be 'void', 'noreturn', or 'usize'"; uefi.handle = handle; uefi.system_table = system_table; @@ -198,7 +194,7 @@ fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 { return initEventLoopAndCallMain(); } -extern fn main(c_argc: i32, c_argv: [*][*:0]u8, c_envp: [*:null]?[*:0]u8) i32 { +fn main(c_argc: i32, c_argv: [*][*:0]u8, c_envp: [*:null]?[*:0]u8) callconv(.C) i32 { var env_count: usize = 0; while (c_envp[env_count] != null) : (env_count += 1) {} const envp = @ptrCast([*][*:0]u8, c_envp)[0..env_count]; diff --git a/lib/std/thread.zig b/lib/std/thread.zig index dcc762f30e7b9d540f686e440a67c8d6095385c5..c482405c443411b85683c6712423ed68c6f663dc 100644 --- a/lib/std/thread.zig +++ b/lib/std/thread.zig @@ -156,7 +156,7 @@ pub const Thread = struct { thread: Thread, inner: Context, }; - extern fn threadMain(raw_arg: windows.LPVOID) windows.DWORD { + fn threadMain(raw_arg: windows.LPVOID) callconv(.C) windows.DWORD { const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*; switch (@typeId(@TypeOf(startFn).ReturnType)) { .Int => { @@ -198,7 +198,7 @@ pub const Thread = struct { } const MainFuncs = struct { - extern fn linuxThreadMain(ctx_addr: usize) u8 { + fn linuxThreadMain(ctx_addr: usize) callconv(.C) u8 { const arg = if (@sizeOf(Context) == 0) {} else @intToPtr(*const Context, ctx_addr).*; switch (@typeId(@TypeOf(startFn).ReturnType)) { @@ -212,7 +212,7 @@ pub const Thread = struct { else => @compileError("expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"), } } - extern fn posixThreadMain(ctx: ?*c_void) ?*c_void { + fn posixThreadMain(ctx: ?*c_void) callconv(.C) ?*c_void { if (@sizeOf(Context) == 0) { _ = startFn({}); return null; diff --git a/lib/std/unicode/throughput_test.zig b/lib/std/unicode/throughput_test.zig index 922c25ebc6fcfda7de42bd4795b0be3d0cf77f19..7265361b31f2b9cafa67918d8b68a8903b25abe3 100644 --- a/lib/std/unicode/throughput_test.zig +++ b/lib/std/unicode/throughput_test.zig @@ -22,7 +22,7 @@ pub fn main() !void { const elapsed_ns_orig = timer.lap(); @fence(.SeqCst); - var buffer2: [32767] u16 align(4096) = undefined; + var buffer2: [32767]u16 align(4096) = undefined; _ = try std.unicode.utf8ToUtf16Le_better(&buffer2, args[1]); @fence(.SeqCst); diff --git a/test/compile_errors.zig b/test/compile_errors.zig index f5798a54603dda2afbf08e634235d40f348da8c8..bf3ee14bec8e783a5a5cd4b5b7fb27855b087689 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2972,7 +2972,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ foo(bar); \\} \\ - \\extern fn bar(x: *void) void { } + \\fn bar(x: *void) callconv(.C) void { } \\export fn entry2() void { \\ bar(&{}); \\} @@ -3871,7 +3871,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ \\export fn entry() usize { return @sizeOf(@TypeOf(fns)); } , &[_][]const u8{ - "tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'extern fn(i32) i32'", + "tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32'", }); cases.add("colliding invalid top level functions", @@ -5618,7 +5618,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("wrong types given to @export", - \\extern fn entry() void { } + \\fn entry() callconv(.C) void { } \\comptime { \\ @export("entry", entry, @as(u32, 1234)); \\} diff --git a/test/stage1/behavior/align.zig b/test/stage1/behavior/align.zig index 1812394f2ecc5ac8fca6ed1c9506c81110c78aff..c83d2379b44cf015134db8d15018a397a490f3b9 100644 --- a/test/stage1/behavior/align.zig +++ b/test/stage1/behavior/align.zig @@ -221,14 +221,14 @@ test "alignment of structs" { }) == @alignOf(usize)); } -test "alignment of extern() void" { +test "alignment of function with c calling convention" { var runtime_nothing = nothing; const casted1 = @ptrCast(*const u8, runtime_nothing); - const casted2 = @ptrCast(extern fn () void, casted1); + const casted2 = @ptrCast(fn () callconv(.C) void, casted1); casted2(); } -extern fn nothing() void {} +fn nothing() callconv(.C) void {} test "return error union with 128-bit integer" { expect(3 == try give()); diff --git a/test/stage1/behavior/bugs/1310.zig b/test/stage1/behavior/bugs/1310.zig index f0f696e4bc556cc4ef41139bfa3c2888b4f79024..788cba5756e5ffdc08bcc329d7a1c8cdbcb970e5 100644 --- a/test/stage1/behavior/bugs/1310.zig +++ b/test/stage1/behavior/bugs/1310.zig @@ -3,7 +3,7 @@ const expect = std.testing.expect; pub const VM = ?[*]const struct_InvocationTable_; pub const struct_InvocationTable_ = extern struct { - GetVM: ?extern fn (?[*]VM) c_int, + GetVM: ?fn (?[*]VM) callconv(.C) c_int, }; pub const struct_VM_ = extern struct { @@ -15,7 +15,7 @@ pub const struct_VM_ = extern struct { pub const InvocationTable_ = struct_InvocationTable_; pub const VM_ = struct_VM_; -extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 { +fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 { return 11; } diff --git a/test/stage1/behavior/cast.zig b/test/stage1/behavior/cast.zig index aca8c6fc3432ea5fceb0a6e454c85c0ce4cc0df1..ae2530af6104e083f6a014a0d89a29e937e93f17 100644 --- a/test/stage1/behavior/cast.zig +++ b/test/stage1/behavior/cast.zig @@ -477,7 +477,7 @@ test "compile time int to ptr of function" { } pub const FUNCTION_CONSTANT = @intToPtr(PFN_void, maxInt(usize)); -pub const PFN_void = extern fn (*c_void) void; +pub const PFN_void = fn (*c_void) callconv(.C) void; fn foobar(func: PFN_void) void { std.testing.expect(@ptrToInt(func) == maxInt(usize)); @@ -587,7 +587,7 @@ test "peer cast *[0]T to []const T" { var global_array: [4]u8 = undefined; test "cast from array reference to fn" { - const f = @ptrCast(extern fn () void, &global_array); + const f = @ptrCast(fn () callconv(.C) void, &global_array); expect(@ptrToInt(f) == @ptrToInt(&global_array)); } diff --git a/test/stage1/behavior/misc.zig b/test/stage1/behavior/misc.zig index 0b29189cde34c6cabae1bf100ff9e0242dc65d7e..9b9771a24cef45ac229dfe48f738505c3b8705d7 100644 --- a/test/stage1/behavior/misc.zig +++ b/test/stage1/behavior/misc.zig @@ -19,7 +19,7 @@ comptime { @export("disabledExternFn", disabledExternFn, builtin.GlobalLinkage.Internal); } -extern fn disabledExternFn() void {} +fn disabledExternFn() callconv(.C) void {} test "call disabled extern fn" { disabledExternFn(); diff --git a/test/stage1/behavior/struct.zig b/test/stage1/behavior/struct.zig index 2d51498a85ae136804f3264fd4d1bc9008aa663c..8e5ab29db36bbcc74b74a18639b4fad5919fab29 100644 --- a/test/stage1/behavior/struct.zig +++ b/test/stage1/behavior/struct.zig @@ -580,7 +580,7 @@ test "default struct initialization fields" { expectEqual(1239, x.a + x.b); } -test "extern fn returns struct by value" { +test "fn with C calling convention returns struct by value" { const S = struct { fn entry() void { var x = makeBar(10); @@ -591,7 +591,7 @@ test "extern fn returns struct by value" { handle: i32, }; - extern fn makeBar(t: i32) ExternBar { + fn makeBar(t: i32) callconv(.C) ExternBar { return ExternBar{ .handle = t, }; diff --git a/test/standalone/load_dynamic_library/main.zig b/test/standalone/load_dynamic_library/main.zig index d1cba72db54835d8a76b4edaeefbbbe8573f3496..197e3ca47c968b2be08bddede5092cb5329b6f52 100644 --- a/test/standalone/load_dynamic_library/main.zig +++ b/test/standalone/load_dynamic_library/main.zig @@ -9,7 +9,7 @@ pub fn main() !void { var lib = try std.DynLib.open(dynlib_name); defer lib.close(); - const addFn = lib.lookup(extern fn (i32, i32) i32, "add") orelse return error.SymbolNotFound; + const addFn = lib.lookup(fn (i32, i32) callconv(.C) i32, "add") orelse return error.SymbolNotFound; const result = addFn(12, 34); std.debug.assert(result == 46); diff --git a/test/translate_c.zig b/test/translate_c.zig index c20989b8352bf7be315bb2dc41e8d37e31d42e0a..a78c56fd735564b73034fc75765389bf422fcd8b 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -238,7 +238,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\pub extern fn foo() void; \\pub export fn bar() void { \\ var func_ptr: ?*c_void = @ptrCast(?*c_void, foo); - \\ var typed_func_ptr: ?extern fn () void = @intToPtr(?extern fn () void, @intCast(c_ulong, @ptrToInt(func_ptr))); + \\ var typed_func_ptr: ?fn () callconv(.C) void = @intToPtr(?fn () callconv(.C) void, @intCast(c_ulong, @ptrToInt(func_ptr))); \\} }); @@ -2297,7 +2297,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\} , &[_][]const u8{ \\pub fn bar() callconv(.C) void {} - \\pub export fn foo(arg_baz: ?extern fn () [*c]c_int) void { + \\pub export fn foo(arg_baz: ?fn () callconv(.C) [*c]c_int) void { \\ var baz = arg_baz; \\ bar(); \\ _ = baz.?(); -- 2.54.0