diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 5ef25ec9fc..94f81908da 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 2dc5b860ed..5cc069bda3 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 493e2cacf6..800a7574ae 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 94ec598a5c..7fbe4fde18 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 efba40bb8d..94fad4cfb7 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 879805696c..2e55abd688 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 877b95af1f..1e51dd6f82 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 1e63d9911f..604bfd277a 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 f821918ccc..3a6e9c97e2 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 e3dd1819c3..ac38e1c8cd 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 65b23f22e5..211515f9dd 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 40ee89c3c4..1bcd40d2e4 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 afc96492c1..2e2dd364d5 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 748aaa0f89..4244f1bb80 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 95dc878630..b6e08c49f4 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 4468da4fbe..fdb5737ad3 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 e973018455..f2969f2112 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 9937b09497..a8afd4a3a6 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 4ee2eed36c..ea882b4927 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 fcb23a50d9..2b878f5269 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 427bd4ec24..10227043aa 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 c108fd15aa..fb3b31d6e8 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 83a17b2b0d..de21c86e43 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 e30f885cf6..0e21f0ba19 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 ffa81d13ab..d3aaf9d470 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 9a94b4395b..81aa01dfa1 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 806a1678aa..d7ce4b3a60 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 8d99231b74..0ef3aa2259 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 f3f83634b2..15e89a11b0 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 07d38f2c3b..733fa1eed1 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 1fa7ed758e..9d41d4b740 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 a77cb8df89..044523512c 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 6e1ded46e5..3dcec6bf89 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 36d4acc28c..a42121aeec 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 53130286a1..00f7c8ad22 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 f0cd788d2e..dff9eb7498 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 e352044708..907116c165 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 579c559790..c66a3f18b4 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 cd6178164a..1867c69234 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 1610136413..93bd0c8a3e 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 917dfb47fc..30a09de90c 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 1e83674598..6b5013287b 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 0c02bfff1f..3f020dadd8 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 aac22e36d0..90bc241306 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 68759a2acd..c8803b4c6c 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 9af83a2b5d..b574d21bd8 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 d744009aea..92a7870806 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 18397f8ad0..a10ff6b703 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 5d3a201058..5b5adc0491 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 e450ad9a48..33e6e41a84 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 f92942e034..0b96076206 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 329968ae40..043be5e2a2 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 d983ecba5f..a9d1f48468 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 11ee0b49a4..9457bfb86e 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 3efc5a9ac6..4f605d441c 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 21c7fd1f97..b70d1657e7 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 ad6ad43808..190959b801 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 56ff56cbb2..f46bd55421 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 c4be085d62..e21e36b955 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 ea36b0ec44..b7e7220c7b 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 d231c0d416..10b097e777 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 de86c845e5..79f0f39986 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 c74dff512d..7a3405c3e2 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 ab451859bf..6283285e01 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 9d4a42147c..4f9890f512 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 a919107266..7c1353e18b 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 dcc762f30e..c482405c44 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 922c25ebc6..7265361b31 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 f5798a5460..bf3ee14bec 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 1812394f2e..c83d2379b4 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 f0f696e4bc..788cba5756 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 aca8c6fc34..ae2530af61 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 0b29189cde..9b9771a24c 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 2d51498a85..8e5ab29db3 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 d1cba72db5..197e3ca47c 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 c20989b835..a78c56fd73 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.?();