authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-06 15:34:50-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-06 15:34:50-05:00
log53913acaf70f14c519b0fa0e3771d3dc641ac86b
treecc34d9eb206b47bf85447c7239a7547a59379e1a
parent5951b79af40212754071157596b8aebbe2414ffb
signaturelock-open Commit is signed but in an unrecognized format.

zig fmt and update `extern fn` to `callconv(.C)`


76 files changed, 153 insertions(+), 160 deletions(-)

lib/std/debug.zig+1-1
......@@ -2428,7 +2428,7 @@ fn resetSegfaultHandler() void {
24282428 os.sigaction(os.SIGILL, &act, null);
24292429}
24302430
2431extern fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_void) noreturn {
2431fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *const c_void) callconv(.C) noreturn {
24322432 // Reset to the default handler so that if a segfault happens in this handler it will crash
24332433 // the process. Also when this handler returns, the original instruction will be repeated
24342434 // and the resulting segfault will crash the process rather than continually dump stack traces.
lib/std/json/test.zig+6-6
......@@ -22,7 +22,7 @@ fn err(comptime s: []const u8) void {
2222 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;
2323 var p = std.json.Parser.init(allocator, false);
2424
25 if(p.parse(s)) |_| {
25 if (p.parse(s)) |_| {
2626 unreachable;
2727 } else |_| {}
2828}
......@@ -33,7 +33,7 @@ fn any(comptime s: []const u8) void {
3333 var mem_buffer: [1024 * 20]u8 = undefined;
3434 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;
3535 var p = std.json.Parser.init(allocator, false);
36
36
3737 _ = p.parse(s) catch {};
3838}
3939
......@@ -44,7 +44,7 @@ fn anyStreamingErrNonStreaming(comptime s: []const u8) void {
4444 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;
4545 var p = std.json.Parser.init(allocator, false);
4646
47 if(p.parse(s)) |_| {
47 if (p.parse(s)) |_| {
4848 unreachable;
4949 } else |_| {}
5050}
......@@ -1742,9 +1742,9 @@ test "i_number_double_huge_neg_exp" {
17421742test "i_number_huge_exp" {
17431743 return error.SkipZigTest;
17441744 // FIXME Integer overflow in parseFloat
1745// any(
1746// \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]
1747// );
1745 // any(
1746 // \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]
1747 // );
17481748}
17491749
17501750test "i_number_neg_int_huge_exp" {
lib/std/math/sqrt.zig-1
......@@ -70,4 +70,3 @@ pub fn Sqrt(comptime T: type) type {
7070 else => T,
7171 };
7272}
73
lib/std/mutex.zig+1-1
......@@ -17,7 +17,7 @@ const ResetEvent = std.ResetEvent;
1717/// Example usage:
1818/// var m = Mutex.init();
1919/// defer m.deinit();
20///
20///
2121/// const lock = m.acquire();
2222/// defer lock.release();
2323/// ... critical code
lib/std/os/linux.zig+1-1
......@@ -512,7 +512,7 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
512512 return syscall2(SYS_clock_gettime, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp));
513513}
514514
515extern fn init_vdso_clock_gettime(clk: i32, ts: *timespec) usize {
515fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize {
516516 const ptr = @intToPtr(?*const c_void, vdso.lookup(VDSO_CGT_VER, VDSO_CGT_SYM));
517517 // Note that we may not have a VDSO at all, update the stub address anyway
518518 // so that clock_gettime will fall back on the good old (and slow) syscall
lib/std/os/linux/arm-eabi.zig+1-1
......@@ -91,7 +91,7 @@ pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, a
9191// LLVM calls this when the read-tp-hard feature is set to false. Currently, there is no way to pass
9292// that to llvm via zig, see https://github.com/ziglang/zig/issues/2883.
9393// LLVM expects libc to provide this function as __aeabi_read_tp, so it is exported if needed from special/c.zig.
94pub extern fn getThreadPointer() usize {
94pub fn getThreadPointer() callconv(.C) usize {
9595 return asm volatile ("mrc p15, 0, %[ret], c13, c0, 3"
9696 : [ret] "=r" (-> usize)
9797 );
lib/std/os/test.zig+1-1
......@@ -166,7 +166,7 @@ test "sigaltstack" {
166166// analyzed
167167const dl_phdr_info = if (@hasDecl(os, "dl_phdr_info")) os.dl_phdr_info else c_void;
168168
169extern fn iter_fn(info: *dl_phdr_info, size: usize, data: ?*usize) i32 {
169fn iter_fn(info: *dl_phdr_info, size: usize, data: ?*usize) callconv(.C) i32 {
170170 if (builtin.os == .windows or builtin.os == .wasi or builtin.os == .macosx)
171171 return 0;
172172
lib/std/special/c.zig+6-8
......@@ -40,19 +40,19 @@ comptime {
4040extern var _fltused: c_int = 1;
4141
4242extern fn main(argc: c_int, argv: [*:null]?[*:0]u8) c_int;
43extern fn wasm_start() void {
43fn wasm_start() callconv(.C) void {
4444 _ = main(0, undefined);
4545}
4646
47extern fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) c_int {
47fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) callconv(.C) c_int {
4848 return std.cstr.cmp(s1, s2);
4949}
5050
51extern fn strlen(s: [*:0]const u8) usize {
51fn strlen(s: [*:0]const u8) callconv(.C) usize {
5252 return std.mem.len(u8, s);
5353}
5454
55extern fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) c_int {
55fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.C) c_int {
5656 if (_n == 0) return 0;
5757 var l = _l;
5858 var r = _r;
......@@ -65,7 +65,7 @@ extern fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) c_int {
6565 return @as(c_int, l[0]) - @as(c_int, r[0]);
6666}
6767
68extern fn strerror(errnum: c_int) [*:0]const u8 {
68fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 {
6969 return "TODO strerror implementation";
7070}
7171
......@@ -188,7 +188,7 @@ comptime {
188188 @export("clone", clone, builtin.GlobalLinkage.Strong);
189189 }
190190}
191extern fn __stack_chk_fail() noreturn {
191fn __stack_chk_fail() callconv(.C) noreturn {
192192 @panic("stack smashing detected");
193193}
194194
......@@ -750,7 +750,6 @@ test "sqrt special" {
750750 std.testing.expect(std.math.isNan(sqrt(std.math.nan(f64))));
751751}
752752
753
754753export fn sqrtf(x: f32) f32 {
755754 const tiny: f32 = 1.0e-30;
756755 const sign: i32 = @bitCast(i32, @as(u32, 0x80000000));
......@@ -848,4 +847,3 @@ test "sqrtf special" {
848847 std.testing.expect(std.math.isNan(sqrtf(-1.0)));
849848 std.testing.expect(std.math.isNan(sqrtf(std.math.nan(f32))));
850849}
851
lib/std/special/compiler_rt.zig+19-19
......@@ -309,7 +309,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn
309309 }
310310}
311311
312extern fn __stack_chk_fail() noreturn {
312fn __stack_chk_fail() callconv(.C) noreturn {
313313 @panic("stack smashing detected");
314314}
315315
......@@ -320,17 +320,17 @@ extern var __stack_chk_guard: usize = blk: {
320320 break :blk @bitCast(usize, buf);
321321};
322322
323extern fn __aeabi_unwind_cpp_pr0() void {
323fn __aeabi_unwind_cpp_pr0() callconv(.C) void {
324324 unreachable;
325325}
326extern fn __aeabi_unwind_cpp_pr1() void {
326fn __aeabi_unwind_cpp_pr1() callconv(.C) void {
327327 unreachable;
328328}
329extern fn __aeabi_unwind_cpp_pr2() void {
329fn __aeabi_unwind_cpp_pr2() callconv(.C) void {
330330 unreachable;
331331}
332332
333extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 {
333fn __divmoddi4(a: i64, b: i64, rem: *i64) callconv(.C) i64 {
334334 @setRuntimeSafety(is_test);
335335
336336 const d = __divdi3(a, b);
......@@ -338,7 +338,7 @@ extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 {
338338 return d;
339339}
340340
341extern fn __divdi3(a: i64, b: i64) i64 {
341fn __divdi3(a: i64, b: i64) callconv(.C) i64 {
342342 @setRuntimeSafety(is_test);
343343
344344 // Set aside the sign of the quotient.
......@@ -352,7 +352,7 @@ extern fn __divdi3(a: i64, b: i64) i64 {
352352 return @bitCast(i64, (res ^ sign) -% sign);
353353}
354354
355extern fn __moddi3(a: i64, b: i64) i64 {
355fn __moddi3(a: i64, b: i64) callconv(.C) i64 {
356356 @setRuntimeSafety(is_test);
357357
358358 // 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 {
365365 return (@bitCast(i64, r) ^ (a >> 63)) -% (a >> 63);
366366}
367367
368extern fn __udivdi3(a: u64, b: u64) u64 {
368fn __udivdi3(a: u64, b: u64) callconv(.C) u64 {
369369 @setRuntimeSafety(is_test);
370370 return __udivmoddi4(a, b, null);
371371}
372372
373extern fn __umoddi3(a: u64, b: u64) u64 {
373fn __umoddi3(a: u64, b: u64) callconv(.C) u64 {
374374 @setRuntimeSafety(is_test);
375375
376376 var r: u64 = undefined;
......@@ -378,7 +378,7 @@ extern fn __umoddi3(a: u64, b: u64) u64 {
378378 return r;
379379}
380380
381extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct {
381fn __aeabi_uidivmod(n: u32, d: u32) callconv(.C) extern struct {
382382 q: u32,
383383 r: u32,
384384} {
......@@ -389,7 +389,7 @@ extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct {
389389 return result;
390390}
391391
392extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct {
392fn __aeabi_uldivmod(n: u64, d: u64) callconv(.C) extern struct {
393393 q: u64,
394394 r: u64,
395395} {
......@@ -400,7 +400,7 @@ extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct {
400400 return result;
401401}
402402
403extern fn __aeabi_idivmod(n: i32, d: i32) extern struct {
403fn __aeabi_idivmod(n: i32, d: i32) callconv(.C) extern struct {
404404 q: i32,
405405 r: i32,
406406} {
......@@ -411,7 +411,7 @@ extern fn __aeabi_idivmod(n: i32, d: i32) extern struct {
411411 return result;
412412}
413413
414extern fn __aeabi_ldivmod(n: i64, d: i64) extern struct {
414fn __aeabi_ldivmod(n: i64, d: i64) callconv(.C) extern struct {
415415 q: i64,
416416 r: i64,
417417} {
......@@ -635,7 +635,7 @@ fn __aeabi_memcmp() callconv(.Naked) noreturn {
635635 unreachable;
636636}
637637
638extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 {
638fn __divmodsi4(a: i32, b: i32, rem: *i32) callconv(.C) i32 {
639639 @setRuntimeSafety(is_test);
640640
641641 const d = __divsi3(a, b);
......@@ -643,7 +643,7 @@ extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 {
643643 return d;
644644}
645645
646extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 {
646fn __udivmodsi4(a: u32, b: u32, rem: *u32) callconv(.C) u32 {
647647 @setRuntimeSafety(is_test);
648648
649649 const d = __udivsi3(a, b);
......@@ -651,7 +651,7 @@ extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 {
651651 return d;
652652}
653653
654extern fn __divsi3(n: i32, d: i32) i32 {
654fn __divsi3(n: i32, d: i32) callconv(.C) i32 {
655655 @setRuntimeSafety(is_test);
656656
657657 // Set aside the sign of the quotient.
......@@ -665,7 +665,7 @@ extern fn __divsi3(n: i32, d: i32) i32 {
665665 return @bitCast(i32, (res ^ sign) -% sign);
666666}
667667
668extern fn __udivsi3(n: u32, d: u32) u32 {
668fn __udivsi3(n: u32, d: u32) callconv(.C) u32 {
669669 @setRuntimeSafety(is_test);
670670
671671 const n_uword_bits: c_uint = u32.bit_count;
......@@ -706,13 +706,13 @@ extern fn __udivsi3(n: u32, d: u32) u32 {
706706 return q;
707707}
708708
709extern fn __modsi3(n: i32, d: i32) i32 {
709fn __modsi3(n: i32, d: i32) callconv(.C) i32 {
710710 @setRuntimeSafety(is_test);
711711
712712 return n -% __divsi3(n, d) *% d;
713713}
714714
715extern fn __umodsi3(n: u32, d: u32) u32 {
715fn __umodsi3(n: u32, d: u32) callconv(.C) u32 {
716716 @setRuntimeSafety(is_test);
717717
718718 return n -% __udivsi3(n, d) *% d;
lib/std/special/compiler_rt/addXf3.zig+6-6
......@@ -6,29 +6,29 @@ const std = @import("std");
66const builtin = @import("builtin");
77const compiler_rt = @import("../compiler_rt.zig");
88
9pub extern fn __addsf3(a: f32, b: f32) f32 {
9pub fn __addsf3(a: f32, b: f32) callconv(.C) f32 {
1010 return addXf3(f32, a, b);
1111}
1212
13pub extern fn __adddf3(a: f64, b: f64) f64 {
13pub fn __adddf3(a: f64, b: f64) callconv(.C) f64 {
1414 return addXf3(f64, a, b);
1515}
1616
17pub extern fn __addtf3(a: f128, b: f128) f128 {
17pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 {
1818 return addXf3(f128, a, b);
1919}
2020
21pub extern fn __subsf3(a: f32, b: f32) f32 {
21pub fn __subsf3(a: f32, b: f32) callconv(.C) f32 {
2222 const neg_b = @bitCast(f32, @bitCast(u32, b) ^ (@as(u32, 1) << 31));
2323 return addXf3(f32, a, neg_b);
2424}
2525
26pub extern fn __subdf3(a: f64, b: f64) f64 {
26pub fn __subdf3(a: f64, b: f64) callconv(.C) f64 {
2727 const neg_b = @bitCast(f64, @bitCast(u64, b) ^ (@as(u64, 1) << 63));
2828 return addXf3(f64, a, neg_b);
2929}
3030
31pub extern fn __subtf3(a: f128, b: f128) f128 {
31pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
3232 const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127));
3333 return addXf3(f128, a, neg_b);
3434}
lib/std/special/compiler_rt/ashlti3.zig+1-1
......@@ -1,7 +1,7 @@
11const builtin = @import("builtin");
22const compiler_rt = @import("../compiler_rt.zig");
33
4pub extern fn __ashlti3(a: i128, b: i32) i128 {
4pub fn __ashlti3(a: i128, b: i32) callconv(.C) i128 {
55 var input = twords{ .all = a };
66 var result: twords = undefined;
77
lib/std/special/compiler_rt/ashrti3.zig+1-1
......@@ -1,7 +1,7 @@
11const builtin = @import("builtin");
22const compiler_rt = @import("../compiler_rt.zig");
33
4pub extern fn __ashrti3(a: i128, b: i32) i128 {
4pub fn __ashrti3(a: i128, b: i32) callconv(.C) i128 {
55 var input = twords{ .all = a };
66 var result: twords = undefined;
77
lib/std/special/compiler_rt/aulldiv.zig+1-1
......@@ -1,6 +1,6 @@
11const builtin = @import("builtin");
22
3pub extern fn _alldiv(a: i64, b: i64) callconv(.Stdcall) i64 {
3pub fn _alldiv(a: i64, b: i64) callconv(.Stdcall) i64 {
44 @setRuntimeSafety(builtin.is_test);
55 const s_a = a >> (i64.bit_count - 1);
66 const s_b = b >> (i64.bit_count - 1);
lib/std/special/compiler_rt/aullrem.zig+1-1
......@@ -1,6 +1,6 @@
11const builtin = @import("builtin");
22
3pub extern fn _allrem(a: i64, b: i64) callconv(.Stdcall) i64 {
3pub fn _allrem(a: i64, b: i64) callconv(.Stdcall) i64 {
44 @setRuntimeSafety(builtin.is_test);
55 const s_a = a >> (i64.bit_count - 1);
66 const s_b = b >> (i64.bit_count - 1);
lib/std/special/compiler_rt/comparedf2.zig+7-7
......@@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0);
2727const LE_GREATER = @as(c_int, 1);
2828const LE_UNORDERED = @as(c_int, 1);
2929
30pub extern fn __ledf2(a: fp_t, b: fp_t) c_int {
30pub fn __ledf2(a: fp_t, b: fp_t) callconv(.C) c_int {
3131 @setRuntimeSafety(is_test);
3232 const aInt: srep_t = @bitCast(srep_t, a);
3333 const bInt: srep_t = @bitCast(srep_t, b);
......@@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0);
7070const GE_GREATER = @as(c_int, 1);
7171const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED
7272
73pub extern fn __gedf2(a: fp_t, b: fp_t) c_int {
73pub fn __gedf2(a: fp_t, b: fp_t) callconv(.C) c_int {
7474 @setRuntimeSafety(is_test);
7575 const aInt: srep_t = @bitCast(srep_t, a);
7676 const bInt: srep_t = @bitCast(srep_t, b);
......@@ -94,26 +94,26 @@ pub extern fn __gedf2(a: fp_t, b: fp_t) c_int {
9494 }
9595}
9696
97pub extern fn __unorddf2(a: fp_t, b: fp_t) c_int {
97pub fn __unorddf2(a: fp_t, b: fp_t) callconv(.C) c_int {
9898 @setRuntimeSafety(is_test);
9999 const aAbs: rep_t = @bitCast(rep_t, a) & absMask;
100100 const bAbs: rep_t = @bitCast(rep_t, b) & absMask;
101101 return @boolToInt(aAbs > infRep or bAbs > infRep);
102102}
103103
104pub extern fn __eqdf2(a: fp_t, b: fp_t) c_int {
104pub fn __eqdf2(a: fp_t, b: fp_t) callconv(.C) c_int {
105105 return __ledf2(a, b);
106106}
107107
108pub extern fn __ltdf2(a: fp_t, b: fp_t) c_int {
108pub fn __ltdf2(a: fp_t, b: fp_t) callconv(.C) c_int {
109109 return __ledf2(a, b);
110110}
111111
112pub extern fn __nedf2(a: fp_t, b: fp_t) c_int {
112pub fn __nedf2(a: fp_t, b: fp_t) callconv(.C) c_int {
113113 return __ledf2(a, b);
114114}
115115
116pub extern fn __gtdf2(a: fp_t, b: fp_t) c_int {
116pub fn __gtdf2(a: fp_t, b: fp_t) callconv(.C) c_int {
117117 return __gedf2(a, b);
118118}
119119
lib/std/special/compiler_rt/comparesf2.zig+7-7
......@@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0);
2727const LE_GREATER = @as(c_int, 1);
2828const LE_UNORDERED = @as(c_int, 1);
2929
30pub extern fn __lesf2(a: fp_t, b: fp_t) c_int {
30pub fn __lesf2(a: fp_t, b: fp_t) callconv(.C) c_int {
3131 @setRuntimeSafety(is_test);
3232 const aInt: srep_t = @bitCast(srep_t, a);
3333 const bInt: srep_t = @bitCast(srep_t, b);
......@@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0);
7070const GE_GREATER = @as(c_int, 1);
7171const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED
7272
73pub extern fn __gesf2(a: fp_t, b: fp_t) c_int {
73pub fn __gesf2(a: fp_t, b: fp_t) callconv(.C) c_int {
7474 @setRuntimeSafety(is_test);
7575 const aInt: srep_t = @bitCast(srep_t, a);
7676 const bInt: srep_t = @bitCast(srep_t, b);
......@@ -94,26 +94,26 @@ pub extern fn __gesf2(a: fp_t, b: fp_t) c_int {
9494 }
9595}
9696
97pub extern fn __unordsf2(a: fp_t, b: fp_t) c_int {
97pub fn __unordsf2(a: fp_t, b: fp_t) callconv(.C) c_int {
9898 @setRuntimeSafety(is_test);
9999 const aAbs: rep_t = @bitCast(rep_t, a) & absMask;
100100 const bAbs: rep_t = @bitCast(rep_t, b) & absMask;
101101 return @boolToInt(aAbs > infRep or bAbs > infRep);
102102}
103103
104pub extern fn __eqsf2(a: fp_t, b: fp_t) c_int {
104pub fn __eqsf2(a: fp_t, b: fp_t) callconv(.C) c_int {
105105 return __lesf2(a, b);
106106}
107107
108pub extern fn __ltsf2(a: fp_t, b: fp_t) c_int {
108pub fn __ltsf2(a: fp_t, b: fp_t) callconv(.C) c_int {
109109 return __lesf2(a, b);
110110}
111111
112pub extern fn __nesf2(a: fp_t, b: fp_t) c_int {
112pub fn __nesf2(a: fp_t, b: fp_t) callconv(.C) c_int {
113113 return __lesf2(a, b);
114114}
115115
116pub extern fn __gtsf2(a: fp_t, b: fp_t) c_int {
116pub fn __gtsf2(a: fp_t, b: fp_t) callconv(.C) c_int {
117117 return __gesf2(a, b);
118118}
119119
lib/std/special/compiler_rt/comparetf2.zig+3-3
......@@ -21,7 +21,7 @@ const infRep = exponentMask;
2121const builtin = @import("builtin");
2222const is_test = builtin.is_test;
2323
24pub extern fn __letf2(a: f128, b: f128) c_int {
24pub fn __letf2(a: f128, b: f128) callconv(.C) c_int {
2525 @setRuntimeSafety(is_test);
2626
2727 const aInt = @bitCast(rep_t, a);
......@@ -65,7 +65,7 @@ const GE_EQUAL = @as(c_int, 0);
6565const GE_GREATER = @as(c_int, 1);
6666const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED
6767
68pub extern fn __getf2(a: f128, b: f128) c_int {
68pub fn __getf2(a: f128, b: f128) callconv(.C) c_int {
6969 @setRuntimeSafety(is_test);
7070
7171 const aInt = @bitCast(srep_t, a);
......@@ -90,7 +90,7 @@ pub extern fn __getf2(a: f128, b: f128) c_int {
9090 GE_GREATER;
9191}
9292
93pub extern fn __unordtf2(a: f128, b: f128) c_int {
93pub fn __unordtf2(a: f128, b: f128) callconv(.C) c_int {
9494 @setRuntimeSafety(is_test);
9595
9696 const aAbs = @bitCast(rep_t, a) & absMask;
lib/std/special/compiler_rt/divdf3.zig+1-1
......@@ -5,7 +5,7 @@
55const std = @import("std");
66const builtin = @import("builtin");
77
8pub extern fn __divdf3(a: f64, b: f64) f64 {
8pub fn __divdf3(a: f64, b: f64) callconv(.C) f64 {
99 @setRuntimeSafety(builtin.is_test);
1010 const Z = @IntType(false, f64.bit_count);
1111 const SignedZ = @IntType(true, f64.bit_count);
lib/std/special/compiler_rt/divsf3.zig+1-1
......@@ -5,7 +5,7 @@
55const std = @import("std");
66const builtin = @import("builtin");
77
8pub extern fn __divsf3(a: f32, b: f32) f32 {
8pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 {
99 @setRuntimeSafety(builtin.is_test);
1010 const Z = @IntType(false, f32.bit_count);
1111
lib/std/special/compiler_rt/divti3.zig+2-2
......@@ -1,7 +1,7 @@
11const udivmod = @import("udivmod.zig").udivmod;
22const builtin = @import("builtin");
33
4pub extern fn __divti3(a: i128, b: i128) i128 {
4pub fn __divti3(a: i128, b: i128) callconv(.C) i128 {
55 @setRuntimeSafety(builtin.is_test);
66
77 const s_a = a >> (i128.bit_count - 1);
......@@ -16,7 +16,7 @@ pub extern fn __divti3(a: i128, b: i128) i128 {
1616}
1717
1818const v128 = @Vector(2, u64);
19pub extern fn __divti3_windows_x86_64(a: v128, b: v128) v128 {
19pub fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
2020 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __divti3, .{
2121 @bitCast(i128, a),
2222 @bitCast(i128, b),
lib/std/special/compiler_rt/extendXfYf2.zig+4-4
......@@ -2,19 +2,19 @@ const std = @import("std");
22const builtin = @import("builtin");
33const is_test = builtin.is_test;
44
5pub extern fn __extendsfdf2(a: f32) f64 {
5pub fn __extendsfdf2(a: f32) callconv(.C) f64 {
66 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f64, f32, @bitCast(u32, a) });
77}
88
9pub extern fn __extenddftf2(a: f64) f128 {
9pub fn __extenddftf2(a: f64) callconv(.C) f128 {
1010 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f64, @bitCast(u64, a) });
1111}
1212
13pub extern fn __extendsftf2(a: f32) f128 {
13pub fn __extendsftf2(a: f32) callconv(.C) f128 {
1414 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f32, @bitCast(u32, a) });
1515}
1616
17pub extern fn __extendhfsf2(a: u16) f32 {
17pub fn __extendhfsf2(a: u16) callconv(.C) f32 {
1818 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a });
1919}
2020
lib/std/special/compiler_rt/fixdfdi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixdfdi(a: f64) i64 {
4pub fn __fixdfdi(a: f64) callconv(.C) i64 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f64, i64, a);
77}
lib/std/special/compiler_rt/fixdfsi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixdfsi(a: f64) i32 {
4pub fn __fixdfsi(a: f64) callconv(.C) i32 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f64, i32, a);
77}
lib/std/special/compiler_rt/fixdfti.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixdfti(a: f64) i128 {
4pub fn __fixdfti(a: f64) callconv(.C) i128 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f64, i128, a);
77}
lib/std/special/compiler_rt/fixsfdi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixsfdi(a: f32) i64 {
4pub fn __fixsfdi(a: f32) callconv(.C) i64 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f32, i64, a);
77}
lib/std/special/compiler_rt/fixsfsi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixsfsi(a: f32) i32 {
4pub fn __fixsfsi(a: f32) callconv(.C) i32 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f32, i32, a);
77}
lib/std/special/compiler_rt/fixsfti.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixsfti(a: f32) i128 {
4pub fn __fixsfti(a: f32) callconv(.C) i128 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f32, i128, a);
77}
lib/std/special/compiler_rt/fixtfdi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixtfdi(a: f128) i64 {
4pub fn __fixtfdi(a: f128) callconv(.C) i64 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f128, i64, a);
77}
lib/std/special/compiler_rt/fixtfsi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixtfsi(a: f128) i32 {
4pub fn __fixtfsi(a: f128) callconv(.C) i32 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f128, i32, a);
77}
lib/std/special/compiler_rt/fixtfti.zig+1-1
......@@ -1,7 +1,7 @@
11const fixint = @import("fixint.zig").fixint;
22const builtin = @import("builtin");
33
4pub extern fn __fixtfti(a: f128) i128 {
4pub fn __fixtfti(a: f128) callconv(.C) i128 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixint(f128, i128, a);
77}
lib/std/special/compiler_rt/fixunsdfdi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunsdfdi(a: f64) u64 {
4pub fn __fixunsdfdi(a: f64) callconv(.C) u64 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f64, u64, a);
77}
lib/std/special/compiler_rt/fixunsdfsi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunsdfsi(a: f64) u32 {
4pub fn __fixunsdfsi(a: f64) callconv(.C) u32 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f64, u32, a);
77}
lib/std/special/compiler_rt/fixunsdfti.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunsdfti(a: f64) u128 {
4pub fn __fixunsdfti(a: f64) callconv(.C) u128 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f64, u128, a);
77}
lib/std/special/compiler_rt/fixunssfdi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunssfdi(a: f32) u64 {
4pub fn __fixunssfdi(a: f32) callconv(.C) u64 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f32, u64, a);
77}
lib/std/special/compiler_rt/fixunssfsi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunssfsi(a: f32) u32 {
4pub fn __fixunssfsi(a: f32) callconv(.C) u32 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f32, u32, a);
77}
lib/std/special/compiler_rt/fixunssfti.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunssfti(a: f32) u128 {
4pub fn __fixunssfti(a: f32) callconv(.C) u128 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f32, u128, a);
77}
lib/std/special/compiler_rt/fixunstfdi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunstfdi(a: f128) u64 {
4pub fn __fixunstfdi(a: f128) callconv(.C) u64 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f128, u64, a);
77}
lib/std/special/compiler_rt/fixunstfsi.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunstfsi(a: f128) u32 {
4pub fn __fixunstfsi(a: f128) callconv(.C) u32 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f128, u32, a);
77}
lib/std/special/compiler_rt/fixunstfti.zig+1-1
......@@ -1,7 +1,7 @@
11const fixuint = @import("fixuint.zig").fixuint;
22const builtin = @import("builtin");
33
4pub extern fn __fixunstfti(a: f128) u128 {
4pub fn __fixunstfti(a: f128) callconv(.C) u128 {
55 @setRuntimeSafety(builtin.is_test);
66 return fixuint(f128, u128, a);
77}
lib/std/special/compiler_rt/floatdidf.zig+1-1
......@@ -4,7 +4,7 @@ const std = @import("std");
44const twop52: f64 = 0x1.0p52;
55const twop32: f64 = 0x1.0p32;
66
7pub extern fn __floatdidf(a: i64) f64 {
7pub fn __floatdidf(a: i64) callconv(.C) f64 {
88 @setRuntimeSafety(builtin.is_test);
99
1010 if (a == 0) return 0;
lib/std/special/compiler_rt/floatsiXf.zig+3-3
......@@ -53,17 +53,17 @@ fn floatsiXf(comptime T: type, a: i32) T {
5353 return @bitCast(T, result);
5454}
5555
56pub extern fn __floatsisf(arg: i32) f32 {
56pub fn __floatsisf(arg: i32) callconv(.C) f32 {
5757 @setRuntimeSafety(builtin.is_test);
5858 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f32, arg });
5959}
6060
61pub extern fn __floatsidf(arg: i32) f64 {
61pub fn __floatsidf(arg: i32) callconv(.C) f64 {
6262 @setRuntimeSafety(builtin.is_test);
6363 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f64, arg });
6464}
6565
66pub extern fn __floatsitf(arg: i32) f128 {
66pub fn __floatsitf(arg: i32) callconv(.C) f128 {
6767 @setRuntimeSafety(builtin.is_test);
6868 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg });
6969}
lib/std/special/compiler_rt/floattidf.zig+1-1
......@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
66const DBL_MANT_DIG = 53;
77
8pub extern fn __floattidf(arg: i128) f64 {
8pub fn __floattidf(arg: i128) callconv(.C) f64 {
99 @setRuntimeSafety(is_test);
1010
1111 if (arg == 0)
lib/std/special/compiler_rt/floattisf.zig+1-1
......@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
66const FLT_MANT_DIG = 24;
77
8pub extern fn __floattisf(arg: i128) f32 {
8pub fn __floattisf(arg: i128) callconv(.C) f32 {
99 @setRuntimeSafety(is_test);
1010
1111 if (arg == 0)
lib/std/special/compiler_rt/floattitf.zig+1-1
......@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
66const LDBL_MANT_DIG = 113;
77
8pub extern fn __floattitf(arg: i128) f128 {
8pub fn __floattitf(arg: i128) callconv(.C) f128 {
99 @setRuntimeSafety(is_test);
1010
1111 if (arg == 0)
lib/std/special/compiler_rt/floatundidf.zig+1-1
......@@ -5,7 +5,7 @@ const twop52: f64 = 0x1.0p52;
55const twop84: f64 = 0x1.0p84;
66const twop84_plus_twop52: f64 = 0x1.00000001p84;
77
8pub extern fn __floatundidf(a: u64) f64 {
8pub fn __floatundidf(a: u64) callconv(.C) f64 {
99 @setRuntimeSafety(builtin.is_test);
1010
1111 if (a == 0) return 0;
lib/std/special/compiler_rt/floatunditf.zig+1-1
......@@ -2,7 +2,7 @@ const builtin = @import("builtin");
22const is_test = builtin.is_test;
33const std = @import("std");
44
5pub extern fn __floatunditf(a: u128) f128 {
5pub fn __floatunditf(a: u128) callconv(.C) f128 {
66 @setRuntimeSafety(is_test);
77
88 if (a == 0) {
lib/std/special/compiler_rt/floatunsidf.zig+1-1
......@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;
44
55const implicitBit = @as(u64, 1) << 52;
66
7pub extern fn __floatunsidf(arg: u32) f64 {
7pub fn __floatunsidf(arg: u32) callconv(.C) f64 {
88 @setRuntimeSafety(builtin.is_test);
99
1010 if (arg == 0) return 0.0;
lib/std/special/compiler_rt/floatunsitf.zig+1-1
......@@ -2,7 +2,7 @@ const builtin = @import("builtin");
22const is_test = builtin.is_test;
33const std = @import("std");
44
5pub extern fn __floatunsitf(a: u64) f128 {
5pub fn __floatunsitf(a: u64) callconv(.C) f128 {
66 @setRuntimeSafety(is_test);
77
88 if (a == 0) {
lib/std/special/compiler_rt/floatuntidf.zig+1-1
......@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
66const DBL_MANT_DIG = 53;
77
8pub extern fn __floatuntidf(arg: u128) f64 {
8pub fn __floatuntidf(arg: u128) callconv(.C) f64 {
99 @setRuntimeSafety(is_test);
1010
1111 if (arg == 0)
lib/std/special/compiler_rt/floatuntisf.zig+1-1
......@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
66const FLT_MANT_DIG = 24;
77
8pub extern fn __floatuntisf(arg: u128) f32 {
8pub fn __floatuntisf(arg: u128) callconv(.C) f32 {
99 @setRuntimeSafety(is_test);
1010
1111 if (arg == 0)
lib/std/special/compiler_rt/floatuntitf.zig+1-1
......@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
66const LDBL_MANT_DIG = 113;
77
8pub extern fn __floatuntitf(arg: u128) f128 {
8pub fn __floatuntitf(arg: u128) callconv(.C) f128 {
99 @setRuntimeSafety(is_test);
1010
1111 if (arg == 0)
lib/std/special/compiler_rt/lshrti3.zig+1-1
......@@ -1,7 +1,7 @@
11const builtin = @import("builtin");
22const compiler_rt = @import("../compiler_rt.zig");
33
4pub extern fn __lshrti3(a: i128, b: i32) i128 {
4pub fn __lshrti3(a: i128, b: i32) callconv(.C) i128 {
55 var input = twords{ .all = a };
66 var result: twords = undefined;
77
lib/std/special/compiler_rt/modti3.zig+2-2
......@@ -6,7 +6,7 @@ const udivmod = @import("udivmod.zig").udivmod;
66const builtin = @import("builtin");
77const compiler_rt = @import("../compiler_rt.zig");
88
9pub extern fn __modti3(a: i128, b: i128) i128 {
9pub fn __modti3(a: i128, b: i128) callconv(.C) i128 {
1010 @setRuntimeSafety(builtin.is_test);
1111
1212 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 {
2121}
2222
2323const v128 = @Vector(2, u64);
24pub extern fn __modti3_windows_x86_64(a: v128, b: v128) v128 {
24pub fn __modti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
2525 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __modti3, .{
2626 @bitCast(i128, a),
2727 @bitCast(i128, b),
lib/std/special/compiler_rt/mulXf3.zig+3-3
......@@ -6,13 +6,13 @@ const std = @import("std");
66const builtin = @import("builtin");
77const compiler_rt = @import("../compiler_rt.zig");
88
9pub extern fn __multf3(a: f128, b: f128) f128 {
9pub fn __multf3(a: f128, b: f128) callconv(.C) f128 {
1010 return mulXf3(f128, a, b);
1111}
12pub extern fn __muldf3(a: f64, b: f64) f64 {
12pub fn __muldf3(a: f64, b: f64) callconv(.C) f64 {
1313 return mulXf3(f64, a, b);
1414}
15pub extern fn __mulsf3(a: f32, b: f32) f32 {
15pub fn __mulsf3(a: f32, b: f32) callconv(.C) f32 {
1616 return mulXf3(f32, a, b);
1717}
1818
lib/std/special/compiler_rt/muldi3.zig+1-1
......@@ -39,7 +39,7 @@ fn __muldsi3(a: u32, b: u32) i64 {
3939 return r.all;
4040}
4141
42pub extern fn __muldi3(a: i64, b: i64) i64 {
42pub fn __muldi3(a: i64, b: i64) callconv(.C) i64 {
4343 @setRuntimeSafety(builtin.is_test);
4444
4545 const x = dwords{ .all = a };
lib/std/special/compiler_rt/mulodi4.zig+1-1
......@@ -3,7 +3,7 @@ const compiler_rt = @import("../compiler_rt.zig");
33const maxInt = std.math.maxInt;
44const minInt = std.math.minInt;
55
6pub extern fn __mulodi4(a: i64, b: i64, overflow: *c_int) i64 {
6pub fn __mulodi4(a: i64, b: i64, overflow: *c_int) callconv(.C) i64 {
77 @setRuntimeSafety(builtin.is_test);
88
99 const min = @bitCast(i64, @as(u64, 1 << (i64.bit_count - 1)));
lib/std/special/compiler_rt/muloti4.zig+1-1
......@@ -1,7 +1,7 @@
11const builtin = @import("builtin");
22const compiler_rt = @import("../compiler_rt.zig");
33
4pub extern fn __muloti4(a: i128, b: i128, overflow: *c_int) i128 {
4pub fn __muloti4(a: i128, b: i128, overflow: *c_int) callconv(.C) i128 {
55 @setRuntimeSafety(builtin.is_test);
66
77 const min = @bitCast(i128, @as(u128, 1 << (i128.bit_count - 1)));
lib/std/special/compiler_rt/multi3.zig+2-2
......@@ -5,7 +5,7 @@ const compiler_rt = @import("../compiler_rt.zig");
55// ae684fad6d34858c014c94da69c15e7774a633c3
66// 2018-08-13
77
8pub extern fn __multi3(a: i128, b: i128) i128 {
8pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
99 @setRuntimeSafety(builtin.is_test);
1010 const x = twords{ .all = a };
1111 const y = twords{ .all = b };
......@@ -15,7 +15,7 @@ pub extern fn __multi3(a: i128, b: i128) i128 {
1515}
1616
1717const v128 = @Vector(2, u64);
18pub extern fn __multi3_windows_x86_64(a: v128, b: v128) v128 {
18pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
1919 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
2020 @bitCast(i128, a),
2121 @bitCast(i128, b),
lib/std/special/compiler_rt/negXf2.zig+2-2
......@@ -1,10 +1,10 @@
11const std = @import("std");
22
3pub extern fn __negsf2(a: f32) f32 {
3pub fn __negsf2(a: f32) callconv(.C) f32 {
44 return negXf2(f32, a);
55}
66
7pub extern fn __negdf2(a: f64) f64 {
7pub fn __negdf2(a: f64) callconv(.C) f64 {
88 return negXf2(f64, a);
99}
1010
lib/std/special/compiler_rt/popcountdi2.zig+1-1
......@@ -2,7 +2,7 @@ const builtin = @import("builtin");
22const compiler_rt = @import("../compiler_rt.zig");
33
44// ported from llvm compiler-rt 8.0.0rc3 95e1c294cb0415a377a7b1d6c7c7d4f89e1c04e4
5pub extern fn __popcountdi2(a: i64) i32 {
5pub fn __popcountdi2(a: i64) callconv(.C) i32 {
66 var x2 = @bitCast(u64, a);
77 x2 = x2 - ((x2 >> 1) & 0x5555555555555555);
88 // Every 2 bits holds the sum of every pair of bits (32)
lib/std/special/compiler_rt/truncXfYf2.zig+5-5
......@@ -1,22 +1,22 @@
11const std = @import("std");
22
3pub extern fn __truncsfhf2(a: f32) u16 {
3pub fn __truncsfhf2(a: f32) callconv(.C) u16 {
44 return @bitCast(u16, truncXfYf2(f16, f32, a));
55}
66
7pub extern fn __truncdfhf2(a: f64) u16 {
7pub fn __truncdfhf2(a: f64) callconv(.C) u16 {
88 return @bitCast(u16, truncXfYf2(f16, f64, a));
99}
1010
11pub extern fn __trunctfsf2(a: f128) f32 {
11pub fn __trunctfsf2(a: f128) callconv(.C) f32 {
1212 return truncXfYf2(f32, f128, a);
1313}
1414
15pub extern fn __trunctfdf2(a: f128) f64 {
15pub fn __trunctfdf2(a: f128) callconv(.C) f64 {
1616 return truncXfYf2(f64, f128, a);
1717}
1818
19pub extern fn __truncdfsf2(a: f64) f32 {
19pub fn __truncdfsf2(a: f64) callconv(.C) f32 {
2020 return truncXfYf2(f32, f64, a);
2121}
2222
lib/std/special/compiler_rt/udivmoddi4.zig+1-1
......@@ -1,7 +1,7 @@
11const udivmod = @import("udivmod.zig").udivmod;
22const builtin = @import("builtin");
33
4pub extern fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?*u64) u64 {
4pub fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?*u64) callconv(.C) u64 {
55 @setRuntimeSafety(builtin.is_test);
66 return udivmod(u64, a, b, maybe_rem);
77}
lib/std/special/compiler_rt/udivmodti4.zig+2-2
......@@ -2,13 +2,13 @@ const udivmod = @import("udivmod.zig").udivmod;
22const builtin = @import("builtin");
33const compiler_rt = @import("../compiler_rt.zig");
44
5pub extern fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) u128 {
5pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.C) u128 {
66 @setRuntimeSafety(builtin.is_test);
77 return udivmod(u128, a, b, maybe_rem);
88}
99
1010const v128 = @Vector(2, u64);
11pub extern fn __udivmodti4_windows_x86_64(a: v128, b: v128, maybe_rem: ?*u128) v128 {
11pub fn __udivmodti4_windows_x86_64(a: v128, b: v128, maybe_rem: ?*u128) callconv(.C) v128 {
1212 @setRuntimeSafety(builtin.is_test);
1313 return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem));
1414}
lib/std/special/compiler_rt/udivti3.zig+2-2
......@@ -1,13 +1,13 @@
11const udivmodti4 = @import("udivmodti4.zig");
22const builtin = @import("builtin");
33
4pub extern fn __udivti3(a: u128, b: u128) u128 {
4pub fn __udivti3(a: u128, b: u128) callconv(.C) u128 {
55 @setRuntimeSafety(builtin.is_test);
66 return udivmodti4.__udivmodti4(a, b, null);
77}
88
99const v128 = @Vector(2, u64);
10pub extern fn __udivti3_windows_x86_64(a: v128, b: v128) v128 {
10pub fn __udivti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
1111 @setRuntimeSafety(builtin.is_test);
1212 return udivmodti4.__udivmodti4_windows_x86_64(a, b, null);
1313}
lib/std/special/compiler_rt/umodti3.zig+2-2
......@@ -2,7 +2,7 @@ const udivmodti4 = @import("udivmodti4.zig");
22const builtin = @import("builtin");
33const compiler_rt = @import("../compiler_rt.zig");
44
5pub extern fn __umodti3(a: u128, b: u128) u128 {
5pub fn __umodti3(a: u128, b: u128) callconv(.C) u128 {
66 @setRuntimeSafety(builtin.is_test);
77 var r: u128 = undefined;
88 _ = udivmodti4.__udivmodti4(a, b, &r);
......@@ -10,7 +10,7 @@ pub extern fn __umodti3(a: u128, b: u128) u128 {
1010}
1111
1212const v128 = @Vector(2, u64);
13pub extern fn __umodti3_windows_x86_64(a: v128, b: v128) v128 {
13pub fn __umodti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
1414 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __umodti3, .{
1515 @bitCast(u128, a),
1616 @bitCast(u128, b),
lib/std/start.zig+4-8
......@@ -43,11 +43,7 @@ comptime {
4343 }
4444}
4545
46fn _DllMainCRTStartup(
47 hinstDLL: std.os.windows.HINSTANCE,
48 fdwReason: std.os.windows.DWORD,
49 lpReserved: std.os.windows.LPVOID,
50) callconv(.Stdcall) std.os.windows.BOOL {
46fn _DllMainCRTStartup(hinstDLL: std.os.windows.HINSTANCE, fdwReason: std.os.windows.DWORD, lpReserved: std.os.windows.LPVOID) callconv(.Stdcall) std.os.windows.BOOL {
5147 if (@hasDecl(root, "DllMain")) {
5248 return root.DllMain(hinstDLL, fdwReason, lpReserved);
5349 }
......@@ -55,13 +51,13 @@ fn _DllMainCRTStartup(
5551 return std.os.windows.TRUE;
5652}
5753
58extern fn wasm_freestanding_start() void {
54fn wasm_freestanding_start() callconv(.C) void {
5955 // This is marked inline because for some reason LLVM in release mode fails to inline it,
6056 // and we want fewer call frames in stack traces.
6157 _ = @call(.{ .modifier = .always_inline }, callMain, .{});
6258}
6359
64extern fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) usize {
60fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize {
6561 const bad_efi_main_ret = "expected return type of main to be 'void', 'noreturn', or 'usize'";
6662 uefi.handle = handle;
6763 uefi.system_table = system_table;
......@@ -198,7 +194,7 @@ fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 {
198194 return initEventLoopAndCallMain();
199195}
200196
201extern fn main(c_argc: i32, c_argv: [*][*:0]u8, c_envp: [*:null]?[*:0]u8) i32 {
197fn main(c_argc: i32, c_argv: [*][*:0]u8, c_envp: [*:null]?[*:0]u8) callconv(.C) i32 {
202198 var env_count: usize = 0;
203199 while (c_envp[env_count] != null) : (env_count += 1) {}
204200 const envp = @ptrCast([*][*:0]u8, c_envp)[0..env_count];
lib/std/thread.zig+3-3
......@@ -156,7 +156,7 @@ pub const Thread = struct {
156156 thread: Thread,
157157 inner: Context,
158158 };
159 extern fn threadMain(raw_arg: windows.LPVOID) windows.DWORD {
159 fn threadMain(raw_arg: windows.LPVOID) callconv(.C) windows.DWORD {
160160 const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*;
161161 switch (@typeId(@TypeOf(startFn).ReturnType)) {
162162 .Int => {
......@@ -198,7 +198,7 @@ pub const Thread = struct {
198198 }
199199
200200 const MainFuncs = struct {
201 extern fn linuxThreadMain(ctx_addr: usize) u8 {
201 fn linuxThreadMain(ctx_addr: usize) callconv(.C) u8 {
202202 const arg = if (@sizeOf(Context) == 0) {} else @intToPtr(*const Context, ctx_addr).*;
203203
204204 switch (@typeId(@TypeOf(startFn).ReturnType)) {
......@@ -212,7 +212,7 @@ pub const Thread = struct {
212212 else => @compileError("expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"),
213213 }
214214 }
215 extern fn posixThreadMain(ctx: ?*c_void) ?*c_void {
215 fn posixThreadMain(ctx: ?*c_void) callconv(.C) ?*c_void {
216216 if (@sizeOf(Context) == 0) {
217217 _ = startFn({});
218218 return null;
lib/std/unicode/throughput_test.zig+1-1
......@@ -22,7 +22,7 @@ pub fn main() !void {
2222 const elapsed_ns_orig = timer.lap();
2323 @fence(.SeqCst);
2424
25 var buffer2: [32767] u16 align(4096) = undefined;
25 var buffer2: [32767]u16 align(4096) = undefined;
2626 _ = try std.unicode.utf8ToUtf16Le_better(&buffer2, args[1]);
2727
2828 @fence(.SeqCst);
test/compile_errors.zig+3-3
......@@ -2972,7 +2972,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
29722972 \\ foo(bar);
29732973 \\}
29742974 \\
2975 \\extern fn bar(x: *void) void { }
2975 \\fn bar(x: *void) callconv(.C) void { }
29762976 \\export fn entry2() void {
29772977 \\ bar(&{});
29782978 \\}
......@@ -3871,7 +3871,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
38713871 \\
38723872 \\export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
38733873 , &[_][]const u8{
3874 "tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'extern fn(i32) i32'",
3874 "tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32'",
38753875 });
38763876
38773877 cases.add("colliding invalid top level functions",
......@@ -5618,7 +5618,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
56185618 });
56195619
56205620 cases.add("wrong types given to @export",
5621 \\extern fn entry() void { }
5621 \\fn entry() callconv(.C) void { }
56225622 \\comptime {
56235623 \\ @export("entry", entry, @as(u32, 1234));
56245624 \\}
test/stage1/behavior/align.zig+3-3
......@@ -221,14 +221,14 @@ test "alignment of structs" {
221221 }) == @alignOf(usize));
222222}
223223
224test "alignment of extern() void" {
224test "alignment of function with c calling convention" {
225225 var runtime_nothing = nothing;
226226 const casted1 = @ptrCast(*const u8, runtime_nothing);
227 const casted2 = @ptrCast(extern fn () void, casted1);
227 const casted2 = @ptrCast(fn () callconv(.C) void, casted1);
228228 casted2();
229229}
230230
231extern fn nothing() void {}
231fn nothing() callconv(.C) void {}
232232
233233test "return error union with 128-bit integer" {
234234 expect(3 == try give());
test/stage1/behavior/bugs/1310.zig+2-2
......@@ -3,7 +3,7 @@ const expect = std.testing.expect;
33
44pub const VM = ?[*]const struct_InvocationTable_;
55pub const struct_InvocationTable_ = extern struct {
6 GetVM: ?extern fn (?[*]VM) c_int,
6 GetVM: ?fn (?[*]VM) callconv(.C) c_int,
77};
88
99pub const struct_VM_ = extern struct {
......@@ -15,7 +15,7 @@ pub const struct_VM_ = extern struct {
1515pub const InvocationTable_ = struct_InvocationTable_;
1616pub const VM_ = struct_VM_;
1717
18extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 {
18fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 {
1919 return 11;
2020}
2121
test/stage1/behavior/cast.zig+2-2
......@@ -477,7 +477,7 @@ test "compile time int to ptr of function" {
477477}
478478
479479pub const FUNCTION_CONSTANT = @intToPtr(PFN_void, maxInt(usize));
480pub const PFN_void = extern fn (*c_void) void;
480pub const PFN_void = fn (*c_void) callconv(.C) void;
481481
482482fn foobar(func: PFN_void) void {
483483 std.testing.expect(@ptrToInt(func) == maxInt(usize));
......@@ -587,7 +587,7 @@ test "peer cast *[0]T to []const T" {
587587
588588var global_array: [4]u8 = undefined;
589589test "cast from array reference to fn" {
590 const f = @ptrCast(extern fn () void, &global_array);
590 const f = @ptrCast(fn () callconv(.C) void, &global_array);
591591 expect(@ptrToInt(f) == @ptrToInt(&global_array));
592592}
593593
test/stage1/behavior/misc.zig+1-1
......@@ -19,7 +19,7 @@ comptime {
1919 @export("disabledExternFn", disabledExternFn, builtin.GlobalLinkage.Internal);
2020}
2121
22extern fn disabledExternFn() void {}
22fn disabledExternFn() callconv(.C) void {}
2323
2424test "call disabled extern fn" {
2525 disabledExternFn();
test/stage1/behavior/struct.zig+2-2
......@@ -580,7 +580,7 @@ test "default struct initialization fields" {
580580 expectEqual(1239, x.a + x.b);
581581}
582582
583test "extern fn returns struct by value" {
583test "fn with C calling convention returns struct by value" {
584584 const S = struct {
585585 fn entry() void {
586586 var x = makeBar(10);
......@@ -591,7 +591,7 @@ test "extern fn returns struct by value" {
591591 handle: i32,
592592 };
593593
594 extern fn makeBar(t: i32) ExternBar {
594 fn makeBar(t: i32) callconv(.C) ExternBar {
595595 return ExternBar{
596596 .handle = t,
597597 };
test/standalone/load_dynamic_library/main.zig+1-1
......@@ -9,7 +9,7 @@ pub fn main() !void {
99 var lib = try std.DynLib.open(dynlib_name);
1010 defer lib.close();
1111
12 const addFn = lib.lookup(extern fn (i32, i32) i32, "add") orelse return error.SymbolNotFound;
12 const addFn = lib.lookup(fn (i32, i32) callconv(.C) i32, "add") orelse return error.SymbolNotFound;
1313
1414 const result = addFn(12, 34);
1515 std.debug.assert(result == 46);
test/translate_c.zig+2-2
......@@ -238,7 +238,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
238238 \\pub extern fn foo() void;
239239 \\pub export fn bar() void {
240240 \\ var func_ptr: ?*c_void = @ptrCast(?*c_void, foo);
241 \\ var typed_func_ptr: ?extern fn () void = @intToPtr(?extern fn () void, @intCast(c_ulong, @ptrToInt(func_ptr)));
241 \\ var typed_func_ptr: ?fn () callconv(.C) void = @intToPtr(?fn () callconv(.C) void, @intCast(c_ulong, @ptrToInt(func_ptr)));
242242 \\}
243243 });
244244
......@@ -2297,7 +2297,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
22972297 \\}
22982298 , &[_][]const u8{
22992299 \\pub fn bar() callconv(.C) void {}
2300 \\pub export fn foo(arg_baz: ?extern fn () [*c]c_int) void {
2300 \\pub export fn foo(arg_baz: ?fn () callconv(.C) [*c]c_int) void {
23012301 \\ var baz = arg_baz;
23022302 \\ bar();
23032303 \\ _ = baz.?();