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
signature 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 {...@@ -2428,7 +2428,7 @@ fn resetSegfaultHandler() void {
2428 os.sigaction(os.SIGILL, &act, null);2428 os.sigaction(os.SIGILL, &act, null);
2429}2429}
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 {
2432 // Reset to the default handler so that if a segfault happens in this handler it will crash2432 // Reset to the default handler so that if a segfault happens in this handler it will crash
2433 // the process. Also when this handler returns, the original instruction will be repeated2433 // the process. Also when this handler returns, the original instruction will be repeated
2434 // and the resulting segfault will crash the process rather than continually dump stack traces.2434 // 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 {...@@ -22,7 +22,7 @@ fn err(comptime s: []const u8) void {
22 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;22 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;
23 var p = std.json.Parser.init(allocator, false);23 var p = std.json.Parser.init(allocator, false);
2424
25 if(p.parse(s)) |_| {25 if (p.parse(s)) |_| {
26 unreachable;26 unreachable;
27 } else |_| {}27 } else |_| {}
28}28}
...@@ -33,7 +33,7 @@ fn any(comptime s: []const u8) void {...@@ -33,7 +33,7 @@ fn any(comptime s: []const u8) void {
33 var mem_buffer: [1024 * 20]u8 = undefined;33 var mem_buffer: [1024 * 20]u8 = undefined;
34 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;34 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;
35 var p = std.json.Parser.init(allocator, false);35 var p = std.json.Parser.init(allocator, false);
36 36
37 _ = p.parse(s) catch {};37 _ = p.parse(s) catch {};
38}38}
3939
...@@ -44,7 +44,7 @@ fn anyStreamingErrNonStreaming(comptime s: []const u8) void {...@@ -44,7 +44,7 @@ fn anyStreamingErrNonStreaming(comptime s: []const u8) void {
44 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;44 const allocator = &std.heap.FixedBufferAllocator.init(&mem_buffer).allocator;
45 var p = std.json.Parser.init(allocator, false);45 var p = std.json.Parser.init(allocator, false);
4646
47 if(p.parse(s)) |_| {47 if (p.parse(s)) |_| {
48 unreachable;48 unreachable;
49 } else |_| {}49 } else |_| {}
50}50}
...@@ -1742,9 +1742,9 @@ test "i_number_double_huge_neg_exp" {...@@ -1742,9 +1742,9 @@ test "i_number_double_huge_neg_exp" {
1742test "i_number_huge_exp" {1742test "i_number_huge_exp" {
1743 return error.SkipZigTest;1743 return error.SkipZigTest;
1744 // FIXME Integer overflow in parseFloat1744 // FIXME Integer overflow in parseFloat
1745// any(1745 // any(
1746// \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]1746 // \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006]
1747// );1747 // );
1748}1748}
17491749
1750test "i_number_neg_int_huge_exp" {1750test "i_number_neg_int_huge_exp" {
lib/std/math/sqrt.zig-1
...@@ -70,4 +70,3 @@ pub fn Sqrt(comptime T: type) type {...@@ -70,4 +70,3 @@ pub fn Sqrt(comptime T: type) type {
70 else => T,70 else => T,
71 };71 };
72}72}
73
lib/std/mutex.zig+1-1
...@@ -17,7 +17,7 @@ const ResetEvent = std.ResetEvent;...@@ -17,7 +17,7 @@ const ResetEvent = std.ResetEvent;
17/// Example usage:17/// Example usage:
18/// var m = Mutex.init();18/// var m = Mutex.init();
19/// defer m.deinit();19/// defer m.deinit();
20/// 20///
21/// const lock = m.acquire();21/// const lock = m.acquire();
22/// defer lock.release();22/// defer lock.release();
23/// ... critical code23/// ... critical code
lib/std/os/linux.zig+1-1
...@@ -512,7 +512,7 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {...@@ -512,7 +512,7 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
512 return syscall2(SYS_clock_gettime, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp));512 return syscall2(SYS_clock_gettime, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp));
513}513}
514514
515extern fn init_vdso_clock_gettime(clk: i32, ts: *timespec) usize {515fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize {
516 const ptr = @intToPtr(?*const c_void, vdso.lookup(VDSO_CGT_VER, VDSO_CGT_SYM));516 const ptr = @intToPtr(?*const c_void, vdso.lookup(VDSO_CGT_VER, VDSO_CGT_SYM));
517 // Note that we may not have a VDSO at all, update the stub address anyway517 // Note that we may not have a VDSO at all, update the stub address anyway
518 // so that clock_gettime will fall back on the good old (and slow) syscall518 // 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...@@ -91,7 +91,7 @@ pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, a
91// LLVM calls this when the read-tp-hard feature is set to false. Currently, there is no way to pass91// LLVM calls this when the read-tp-hard feature is set to false. Currently, there is no way to pass
92// that to llvm via zig, see https://github.com/ziglang/zig/issues/2883.92// that to llvm via zig, see https://github.com/ziglang/zig/issues/2883.
93// LLVM expects libc to provide this function as __aeabi_read_tp, so it is exported if needed from special/c.zig.93// 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 {
95 return asm volatile ("mrc p15, 0, %[ret], c13, c0, 3"95 return asm volatile ("mrc p15, 0, %[ret], c13, c0, 3"
96 : [ret] "=r" (-> usize)96 : [ret] "=r" (-> usize)
97 );97 );
lib/std/os/test.zig+1-1
...@@ -166,7 +166,7 @@ test "sigaltstack" {...@@ -166,7 +166,7 @@ test "sigaltstack" {
166// analyzed166// analyzed
167const dl_phdr_info = if (@hasDecl(os, "dl_phdr_info")) os.dl_phdr_info else c_void;167const 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 {
170 if (builtin.os == .windows or builtin.os == .wasi or builtin.os == .macosx)170 if (builtin.os == .windows or builtin.os == .wasi or builtin.os == .macosx)
171 return 0;171 return 0;
172172
lib/std/special/c.zig+6-8
...@@ -40,19 +40,19 @@ comptime {...@@ -40,19 +40,19 @@ comptime {
40extern var _fltused: c_int = 1;40extern var _fltused: c_int = 1;
4141
42extern fn main(argc: c_int, argv: [*:null]?[*:0]u8) c_int;42extern fn main(argc: c_int, argv: [*:null]?[*:0]u8) c_int;
43extern fn wasm_start() void {43fn wasm_start() callconv(.C) void {
44 _ = main(0, undefined);44 _ = main(0, undefined);
45}45}
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 {
48 return std.cstr.cmp(s1, s2);48 return std.cstr.cmp(s1, s2);
49}49}
5050
51extern fn strlen(s: [*:0]const u8) usize {51fn strlen(s: [*:0]const u8) callconv(.C) usize {
52 return std.mem.len(u8, s);52 return std.mem.len(u8, s);
53}53}
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 {
56 if (_n == 0) return 0;56 if (_n == 0) return 0;
57 var l = _l;57 var l = _l;
58 var r = _r;58 var r = _r;
...@@ -65,7 +65,7 @@ extern fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) c_int {...@@ -65,7 +65,7 @@ extern fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) c_int {
65 return @as(c_int, l[0]) - @as(c_int, r[0]);65 return @as(c_int, l[0]) - @as(c_int, r[0]);
66}66}
6767
68extern fn strerror(errnum: c_int) [*:0]const u8 {68fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 {
69 return "TODO strerror implementation";69 return "TODO strerror implementation";
70}70}
7171
...@@ -188,7 +188,7 @@ comptime {...@@ -188,7 +188,7 @@ comptime {
188 @export("clone", clone, builtin.GlobalLinkage.Strong);188 @export("clone", clone, builtin.GlobalLinkage.Strong);
189 }189 }
190}190}
191extern fn __stack_chk_fail() noreturn {191fn __stack_chk_fail() callconv(.C) noreturn {
192 @panic("stack smashing detected");192 @panic("stack smashing detected");
193}193}
194194
...@@ -750,7 +750,6 @@ test "sqrt special" {...@@ -750,7 +750,6 @@ test "sqrt special" {
750 std.testing.expect(std.math.isNan(sqrt(std.math.nan(f64))));750 std.testing.expect(std.math.isNan(sqrt(std.math.nan(f64))));
751}751}
752752
753
754export fn sqrtf(x: f32) f32 {753export fn sqrtf(x: f32) f32 {
755 const tiny: f32 = 1.0e-30;754 const tiny: f32 = 1.0e-30;
756 const sign: i32 = @bitCast(i32, @as(u32, 0x80000000));755 const sign: i32 = @bitCast(i32, @as(u32, 0x80000000));
...@@ -848,4 +847,3 @@ test "sqrtf special" {...@@ -848,4 +847,3 @@ test "sqrtf special" {
848 std.testing.expect(std.math.isNan(sqrtf(-1.0)));847 std.testing.expect(std.math.isNan(sqrtf(-1.0)));
849 std.testing.expect(std.math.isNan(sqrtf(std.math.nan(f32))));848 std.testing.expect(std.math.isNan(sqrtf(std.math.nan(f32))));
850}849}
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...@@ -309,7 +309,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn
309 }309 }
310}310}
311311
312extern fn __stack_chk_fail() noreturn {312fn __stack_chk_fail() callconv(.C) noreturn {
313 @panic("stack smashing detected");313 @panic("stack smashing detected");
314}314}
315315
...@@ -320,17 +320,17 @@ extern var __stack_chk_guard: usize = blk: {...@@ -320,17 +320,17 @@ extern var __stack_chk_guard: usize = blk: {
320 break :blk @bitCast(usize, buf);320 break :blk @bitCast(usize, buf);
321};321};
322322
323extern fn __aeabi_unwind_cpp_pr0() void {323fn __aeabi_unwind_cpp_pr0() callconv(.C) void {
324 unreachable;324 unreachable;
325}325}
326extern fn __aeabi_unwind_cpp_pr1() void {326fn __aeabi_unwind_cpp_pr1() callconv(.C) void {
327 unreachable;327 unreachable;
328}328}
329extern fn __aeabi_unwind_cpp_pr2() void {329fn __aeabi_unwind_cpp_pr2() callconv(.C) void {
330 unreachable;330 unreachable;
331}331}
332332
333extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 {333fn __divmoddi4(a: i64, b: i64, rem: *i64) callconv(.C) i64 {
334 @setRuntimeSafety(is_test);334 @setRuntimeSafety(is_test);
335335
336 const d = __divdi3(a, b);336 const d = __divdi3(a, b);
...@@ -338,7 +338,7 @@ extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 {...@@ -338,7 +338,7 @@ extern fn __divmoddi4(a: i64, b: i64, rem: *i64) i64 {
338 return d;338 return d;
339}339}
340340
341extern fn __divdi3(a: i64, b: i64) i64 {341fn __divdi3(a: i64, b: i64) callconv(.C) i64 {
342 @setRuntimeSafety(is_test);342 @setRuntimeSafety(is_test);
343343
344 // Set aside the sign of the quotient.344 // Set aside the sign of the quotient.
...@@ -352,7 +352,7 @@ extern fn __divdi3(a: i64, b: i64) i64 {...@@ -352,7 +352,7 @@ extern fn __divdi3(a: i64, b: i64) i64 {
352 return @bitCast(i64, (res ^ sign) -% sign);352 return @bitCast(i64, (res ^ sign) -% sign);
353}353}
354354
355extern fn __moddi3(a: i64, b: i64) i64 {355fn __moddi3(a: i64, b: i64) callconv(.C) i64 {
356 @setRuntimeSafety(is_test);356 @setRuntimeSafety(is_test);
357357
358 // Take absolute value of a and b via abs(x) = (x^(x >> 63)) - (x >> 63).358 // 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 {...@@ -365,12 +365,12 @@ extern fn __moddi3(a: i64, b: i64) i64 {
365 return (@bitCast(i64, r) ^ (a >> 63)) -% (a >> 63);365 return (@bitCast(i64, r) ^ (a >> 63)) -% (a >> 63);
366}366}
367367
368extern fn __udivdi3(a: u64, b: u64) u64 {368fn __udivdi3(a: u64, b: u64) callconv(.C) u64 {
369 @setRuntimeSafety(is_test);369 @setRuntimeSafety(is_test);
370 return __udivmoddi4(a, b, null);370 return __udivmoddi4(a, b, null);
371}371}
372372
373extern fn __umoddi3(a: u64, b: u64) u64 {373fn __umoddi3(a: u64, b: u64) callconv(.C) u64 {
374 @setRuntimeSafety(is_test);374 @setRuntimeSafety(is_test);
375375
376 var r: u64 = undefined;376 var r: u64 = undefined;
...@@ -378,7 +378,7 @@ extern fn __umoddi3(a: u64, b: u64) u64 {...@@ -378,7 +378,7 @@ extern fn __umoddi3(a: u64, b: u64) u64 {
378 return r;378 return r;
379}379}
380380
381extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct {381fn __aeabi_uidivmod(n: u32, d: u32) callconv(.C) extern struct {
382 q: u32,382 q: u32,
383 r: u32,383 r: u32,
384} {384} {
...@@ -389,7 +389,7 @@ extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct {...@@ -389,7 +389,7 @@ extern fn __aeabi_uidivmod(n: u32, d: u32) extern struct {
389 return result;389 return result;
390}390}
391391
392extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct {392fn __aeabi_uldivmod(n: u64, d: u64) callconv(.C) extern struct {
393 q: u64,393 q: u64,
394 r: u64,394 r: u64,
395} {395} {
...@@ -400,7 +400,7 @@ extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct {...@@ -400,7 +400,7 @@ extern fn __aeabi_uldivmod(n: u64, d: u64) extern struct {
400 return result;400 return result;
401}401}
402402
403extern fn __aeabi_idivmod(n: i32, d: i32) extern struct {403fn __aeabi_idivmod(n: i32, d: i32) callconv(.C) extern struct {
404 q: i32,404 q: i32,
405 r: i32,405 r: i32,
406} {406} {
...@@ -411,7 +411,7 @@ extern fn __aeabi_idivmod(n: i32, d: i32) extern struct {...@@ -411,7 +411,7 @@ extern fn __aeabi_idivmod(n: i32, d: i32) extern struct {
411 return result;411 return result;
412}412}
413413
414extern fn __aeabi_ldivmod(n: i64, d: i64) extern struct {414fn __aeabi_ldivmod(n: i64, d: i64) callconv(.C) extern struct {
415 q: i64,415 q: i64,
416 r: i64,416 r: i64,
417} {417} {
...@@ -635,7 +635,7 @@ fn __aeabi_memcmp() callconv(.Naked) noreturn {...@@ -635,7 +635,7 @@ fn __aeabi_memcmp() callconv(.Naked) noreturn {
635 unreachable;635 unreachable;
636}636}
637637
638extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 {638fn __divmodsi4(a: i32, b: i32, rem: *i32) callconv(.C) i32 {
639 @setRuntimeSafety(is_test);639 @setRuntimeSafety(is_test);
640640
641 const d = __divsi3(a, b);641 const d = __divsi3(a, b);
...@@ -643,7 +643,7 @@ extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 {...@@ -643,7 +643,7 @@ extern fn __divmodsi4(a: i32, b: i32, rem: *i32) i32 {
643 return d;643 return d;
644}644}
645645
646extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 {646fn __udivmodsi4(a: u32, b: u32, rem: *u32) callconv(.C) u32 {
647 @setRuntimeSafety(is_test);647 @setRuntimeSafety(is_test);
648648
649 const d = __udivsi3(a, b);649 const d = __udivsi3(a, b);
...@@ -651,7 +651,7 @@ extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 {...@@ -651,7 +651,7 @@ extern fn __udivmodsi4(a: u32, b: u32, rem: *u32) u32 {
651 return d;651 return d;
652}652}
653653
654extern fn __divsi3(n: i32, d: i32) i32 {654fn __divsi3(n: i32, d: i32) callconv(.C) i32 {
655 @setRuntimeSafety(is_test);655 @setRuntimeSafety(is_test);
656656
657 // Set aside the sign of the quotient.657 // Set aside the sign of the quotient.
...@@ -665,7 +665,7 @@ extern fn __divsi3(n: i32, d: i32) i32 {...@@ -665,7 +665,7 @@ extern fn __divsi3(n: i32, d: i32) i32 {
665 return @bitCast(i32, (res ^ sign) -% sign);665 return @bitCast(i32, (res ^ sign) -% sign);
666}666}
667667
668extern fn __udivsi3(n: u32, d: u32) u32 {668fn __udivsi3(n: u32, d: u32) callconv(.C) u32 {
669 @setRuntimeSafety(is_test);669 @setRuntimeSafety(is_test);
670670
671 const n_uword_bits: c_uint = u32.bit_count;671 const n_uword_bits: c_uint = u32.bit_count;
...@@ -706,13 +706,13 @@ extern fn __udivsi3(n: u32, d: u32) u32 {...@@ -706,13 +706,13 @@ extern fn __udivsi3(n: u32, d: u32) u32 {
706 return q;706 return q;
707}707}
708708
709extern fn __modsi3(n: i32, d: i32) i32 {709fn __modsi3(n: i32, d: i32) callconv(.C) i32 {
710 @setRuntimeSafety(is_test);710 @setRuntimeSafety(is_test);
711711
712 return n -% __divsi3(n, d) *% d;712 return n -% __divsi3(n, d) *% d;
713}713}
714714
715extern fn __umodsi3(n: u32, d: u32) u32 {715fn __umodsi3(n: u32, d: u32) callconv(.C) u32 {
716 @setRuntimeSafety(is_test);716 @setRuntimeSafety(is_test);
717717
718 return n -% __udivsi3(n, d) *% d;718 return n -% __udivsi3(n, d) *% d;
lib/std/special/compiler_rt/addXf3.zig+6-6
...@@ -6,29 +6,29 @@ const std = @import("std");...@@ -6,29 +6,29 @@ const std = @import("std");
6const builtin = @import("builtin");6const builtin = @import("builtin");
7const compiler_rt = @import("../compiler_rt.zig");7const 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 {
10 return addXf3(f32, a, b);10 return addXf3(f32, a, b);
11}11}
1212
13pub extern fn __adddf3(a: f64, b: f64) f64 {13pub fn __adddf3(a: f64, b: f64) callconv(.C) f64 {
14 return addXf3(f64, a, b);14 return addXf3(f64, a, b);
15}15}
1616
17pub extern fn __addtf3(a: f128, b: f128) f128 {17pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 {
18 return addXf3(f128, a, b);18 return addXf3(f128, a, b);
19}19}
2020
21pub extern fn __subsf3(a: f32, b: f32) f32 {21pub fn __subsf3(a: f32, b: f32) callconv(.C) f32 {
22 const neg_b = @bitCast(f32, @bitCast(u32, b) ^ (@as(u32, 1) << 31));22 const neg_b = @bitCast(f32, @bitCast(u32, b) ^ (@as(u32, 1) << 31));
23 return addXf3(f32, a, neg_b);23 return addXf3(f32, a, neg_b);
24}24}
2525
26pub extern fn __subdf3(a: f64, b: f64) f64 {26pub fn __subdf3(a: f64, b: f64) callconv(.C) f64 {
27 const neg_b = @bitCast(f64, @bitCast(u64, b) ^ (@as(u64, 1) << 63));27 const neg_b = @bitCast(f64, @bitCast(u64, b) ^ (@as(u64, 1) << 63));
28 return addXf3(f64, a, neg_b);28 return addXf3(f64, a, neg_b);
29}29}
3030
31pub extern fn __subtf3(a: f128, b: f128) f128 {31pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
32 const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127));32 const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127));
33 return addXf3(f128, a, neg_b);33 return addXf3(f128, a, neg_b);
34}34}
lib/std/special/compiler_rt/ashlti3.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const compiler_rt = @import("../compiler_rt.zig");2const 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 {
5 var input = twords{ .all = a };5 var input = twords{ .all = a };
6 var result: twords = undefined;6 var result: twords = undefined;
77
lib/std/special/compiler_rt/ashrti3.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const compiler_rt = @import("../compiler_rt.zig");2const 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 {
5 var input = twords{ .all = a };5 var input = twords{ .all = a };
6 var result: twords = undefined;6 var result: twords = undefined;
77
lib/std/special/compiler_rt/aulldiv.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const builtin = @import("builtin");1const 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 {
4 @setRuntimeSafety(builtin.is_test);4 @setRuntimeSafety(builtin.is_test);
5 const s_a = a >> (i64.bit_count - 1);5 const s_a = a >> (i64.bit_count - 1);
6 const s_b = b >> (i64.bit_count - 1);6 const s_b = b >> (i64.bit_count - 1);
lib/std/special/compiler_rt/aullrem.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const builtin = @import("builtin");1const 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 {
4 @setRuntimeSafety(builtin.is_test);4 @setRuntimeSafety(builtin.is_test);
5 const s_a = a >> (i64.bit_count - 1);5 const s_a = a >> (i64.bit_count - 1);
6 const s_b = b >> (i64.bit_count - 1);6 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);...@@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0);
27const LE_GREATER = @as(c_int, 1);27const LE_GREATER = @as(c_int, 1);
28const LE_UNORDERED = @as(c_int, 1);28const 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 {
31 @setRuntimeSafety(is_test);31 @setRuntimeSafety(is_test);
32 const aInt: srep_t = @bitCast(srep_t, a);32 const aInt: srep_t = @bitCast(srep_t, a);
33 const bInt: srep_t = @bitCast(srep_t, b);33 const bInt: srep_t = @bitCast(srep_t, b);
...@@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0);...@@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0);
70const GE_GREATER = @as(c_int, 1);70const GE_GREATER = @as(c_int, 1);
71const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED71const 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 {
74 @setRuntimeSafety(is_test);74 @setRuntimeSafety(is_test);
75 const aInt: srep_t = @bitCast(srep_t, a);75 const aInt: srep_t = @bitCast(srep_t, a);
76 const bInt: srep_t = @bitCast(srep_t, b);76 const bInt: srep_t = @bitCast(srep_t, b);
...@@ -94,26 +94,26 @@ pub extern fn __gedf2(a: fp_t, b: fp_t) c_int {...@@ -94,26 +94,26 @@ pub extern fn __gedf2(a: fp_t, b: fp_t) c_int {
94 }94 }
95}95}
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 {
98 @setRuntimeSafety(is_test);98 @setRuntimeSafety(is_test);
99 const aAbs: rep_t = @bitCast(rep_t, a) & absMask;99 const aAbs: rep_t = @bitCast(rep_t, a) & absMask;
100 const bAbs: rep_t = @bitCast(rep_t, b) & absMask;100 const bAbs: rep_t = @bitCast(rep_t, b) & absMask;
101 return @boolToInt(aAbs > infRep or bAbs > infRep);101 return @boolToInt(aAbs > infRep or bAbs > infRep);
102}102}
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 {
105 return __ledf2(a, b);105 return __ledf2(a, b);
106}106}
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 {
109 return __ledf2(a, b);109 return __ledf2(a, b);
110}110}
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 {
113 return __ledf2(a, b);113 return __ledf2(a, b);
114}114}
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 {
117 return __gedf2(a, b);117 return __gedf2(a, b);
118}118}
119119
lib/std/special/compiler_rt/comparesf2.zig+7-7
...@@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0);...@@ -27,7 +27,7 @@ const LE_EQUAL = @as(c_int, 0);
27const LE_GREATER = @as(c_int, 1);27const LE_GREATER = @as(c_int, 1);
28const LE_UNORDERED = @as(c_int, 1);28const 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 {
31 @setRuntimeSafety(is_test);31 @setRuntimeSafety(is_test);
32 const aInt: srep_t = @bitCast(srep_t, a);32 const aInt: srep_t = @bitCast(srep_t, a);
33 const bInt: srep_t = @bitCast(srep_t, b);33 const bInt: srep_t = @bitCast(srep_t, b);
...@@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0);...@@ -70,7 +70,7 @@ const GE_EQUAL = @as(c_int, 0);
70const GE_GREATER = @as(c_int, 1);70const GE_GREATER = @as(c_int, 1);
71const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED71const 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 {
74 @setRuntimeSafety(is_test);74 @setRuntimeSafety(is_test);
75 const aInt: srep_t = @bitCast(srep_t, a);75 const aInt: srep_t = @bitCast(srep_t, a);
76 const bInt: srep_t = @bitCast(srep_t, b);76 const bInt: srep_t = @bitCast(srep_t, b);
...@@ -94,26 +94,26 @@ pub extern fn __gesf2(a: fp_t, b: fp_t) c_int {...@@ -94,26 +94,26 @@ pub extern fn __gesf2(a: fp_t, b: fp_t) c_int {
94 }94 }
95}95}
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 {
98 @setRuntimeSafety(is_test);98 @setRuntimeSafety(is_test);
99 const aAbs: rep_t = @bitCast(rep_t, a) & absMask;99 const aAbs: rep_t = @bitCast(rep_t, a) & absMask;
100 const bAbs: rep_t = @bitCast(rep_t, b) & absMask;100 const bAbs: rep_t = @bitCast(rep_t, b) & absMask;
101 return @boolToInt(aAbs > infRep or bAbs > infRep);101 return @boolToInt(aAbs > infRep or bAbs > infRep);
102}102}
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 {
105 return __lesf2(a, b);105 return __lesf2(a, b);
106}106}
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 {
109 return __lesf2(a, b);109 return __lesf2(a, b);
110}110}
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 {
113 return __lesf2(a, b);113 return __lesf2(a, b);
114}114}
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 {
117 return __gesf2(a, b);117 return __gesf2(a, b);
118}118}
119119
lib/std/special/compiler_rt/comparetf2.zig+3-3
...@@ -21,7 +21,7 @@ const infRep = exponentMask;...@@ -21,7 +21,7 @@ const infRep = exponentMask;
21const builtin = @import("builtin");21const builtin = @import("builtin");
22const is_test = builtin.is_test;22const 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 {
25 @setRuntimeSafety(is_test);25 @setRuntimeSafety(is_test);
2626
27 const aInt = @bitCast(rep_t, a);27 const aInt = @bitCast(rep_t, a);
...@@ -65,7 +65,7 @@ const GE_EQUAL = @as(c_int, 0);...@@ -65,7 +65,7 @@ const GE_EQUAL = @as(c_int, 0);
65const GE_GREATER = @as(c_int, 1);65const GE_GREATER = @as(c_int, 1);
66const GE_UNORDERED = @as(c_int, -1); // Note: different from LE_UNORDERED66const 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 {
69 @setRuntimeSafety(is_test);69 @setRuntimeSafety(is_test);
7070
71 const aInt = @bitCast(srep_t, a);71 const aInt = @bitCast(srep_t, a);
...@@ -90,7 +90,7 @@ pub extern fn __getf2(a: f128, b: f128) c_int {...@@ -90,7 +90,7 @@ pub extern fn __getf2(a: f128, b: f128) c_int {
90 GE_GREATER;90 GE_GREATER;
91}91}
9292
93pub extern fn __unordtf2(a: f128, b: f128) c_int {93pub fn __unordtf2(a: f128, b: f128) callconv(.C) c_int {
94 @setRuntimeSafety(is_test);94 @setRuntimeSafety(is_test);
9595
96 const aAbs = @bitCast(rep_t, a) & absMask;96 const aAbs = @bitCast(rep_t, a) & absMask;
lib/std/special/compiler_rt/divdf3.zig+1-1
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");6const builtin = @import("builtin");
77
8pub extern fn __divdf3(a: f64, b: f64) f64 {8pub fn __divdf3(a: f64, b: f64) callconv(.C) f64 {
9 @setRuntimeSafety(builtin.is_test);9 @setRuntimeSafety(builtin.is_test);
10 const Z = @IntType(false, f64.bit_count);10 const Z = @IntType(false, f64.bit_count);
11 const SignedZ = @IntType(true, f64.bit_count);11 const SignedZ = @IntType(true, f64.bit_count);
lib/std/special/compiler_rt/divsf3.zig+1-1
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");6const builtin = @import("builtin");
77
8pub extern fn __divsf3(a: f32, b: f32) f32 {8pub fn __divsf3(a: f32, b: f32) callconv(.C) f32 {
9 @setRuntimeSafety(builtin.is_test);9 @setRuntimeSafety(builtin.is_test);
10 const Z = @IntType(false, f32.bit_count);10 const Z = @IntType(false, f32.bit_count);
1111
lib/std/special/compiler_rt/divti3.zig+2-2
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const udivmod = @import("udivmod.zig").udivmod;1const udivmod = @import("udivmod.zig").udivmod;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __divti3(a: i128, b: i128) i128 {4pub fn __divti3(a: i128, b: i128) callconv(.C) i128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
66
7 const s_a = a >> (i128.bit_count - 1);7 const s_a = a >> (i128.bit_count - 1);
...@@ -16,7 +16,7 @@ pub extern fn __divti3(a: i128, b: i128) i128 {...@@ -16,7 +16,7 @@ pub extern fn __divti3(a: i128, b: i128) i128 {
16}16}
1717
18const v128 = @Vector(2, u64);18const 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 {
20 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __divti3, .{20 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __divti3, .{
21 @bitCast(i128, a),21 @bitCast(i128, a),
22 @bitCast(i128, b),22 @bitCast(i128, b),
lib/std/special/compiler_rt/extendXfYf2.zig+4-4
...@@ -2,19 +2,19 @@ const std = @import("std");...@@ -2,19 +2,19 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const is_test = builtin.is_test;3const is_test = builtin.is_test;
44
5pub extern fn __extendsfdf2(a: f32) f64 {5pub fn __extendsfdf2(a: f32) callconv(.C) f64 {
6 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f64, f32, @bitCast(u32, a) });6 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f64, f32, @bitCast(u32, a) });
7}7}
88
9pub extern fn __extenddftf2(a: f64) f128 {9pub fn __extenddftf2(a: f64) callconv(.C) f128 {
10 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f64, @bitCast(u64, a) });10 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f64, @bitCast(u64, a) });
11}11}
1212
13pub extern fn __extendsftf2(a: f32) f128 {13pub fn __extendsftf2(a: f32) callconv(.C) f128 {
14 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f32, @bitCast(u32, a) });14 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f128, f32, @bitCast(u32, a) });
15}15}
1616
17pub extern fn __extendhfsf2(a: u16) f32 {17pub fn __extendhfsf2(a: u16) callconv(.C) f32 {
18 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a });18 return @call(.{ .modifier = .always_inline }, extendXfYf2, .{ f32, f16, a });
19}19}
2020
lib/std/special/compiler_rt/fixdfdi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixdfdi(a: f64) i64 {4pub fn __fixdfdi(a: f64) callconv(.C) i64 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f64, i64, a);6 return fixint(f64, i64, a);
7}7}
lib/std/special/compiler_rt/fixdfsi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixdfsi(a: f64) i32 {4pub fn __fixdfsi(a: f64) callconv(.C) i32 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f64, i32, a);6 return fixint(f64, i32, a);
7}7}
lib/std/special/compiler_rt/fixdfti.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixdfti(a: f64) i128 {4pub fn __fixdfti(a: f64) callconv(.C) i128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f64, i128, a);6 return fixint(f64, i128, a);
7}7}
lib/std/special/compiler_rt/fixsfdi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixsfdi(a: f32) i64 {4pub fn __fixsfdi(a: f32) callconv(.C) i64 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f32, i64, a);6 return fixint(f32, i64, a);
7}7}
lib/std/special/compiler_rt/fixsfsi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixsfsi(a: f32) i32 {4pub fn __fixsfsi(a: f32) callconv(.C) i32 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f32, i32, a);6 return fixint(f32, i32, a);
7}7}
lib/std/special/compiler_rt/fixsfti.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixsfti(a: f32) i128 {4pub fn __fixsfti(a: f32) callconv(.C) i128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f32, i128, a);6 return fixint(f32, i128, a);
7}7}
lib/std/special/compiler_rt/fixtfdi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixtfdi(a: f128) i64 {4pub fn __fixtfdi(a: f128) callconv(.C) i64 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f128, i64, a);6 return fixint(f128, i64, a);
7}7}
lib/std/special/compiler_rt/fixtfsi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixtfsi(a: f128) i32 {4pub fn __fixtfsi(a: f128) callconv(.C) i32 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f128, i32, a);6 return fixint(f128, i32, a);
7}7}
lib/std/special/compiler_rt/fixtfti.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixint = @import("fixint.zig").fixint;1const fixint = @import("fixint.zig").fixint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixtfti(a: f128) i128 {4pub fn __fixtfti(a: f128) callconv(.C) i128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixint(f128, i128, a);6 return fixint(f128, i128, a);
7}7}
lib/std/special/compiler_rt/fixunsdfdi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunsdfdi(a: f64) u64 {4pub fn __fixunsdfdi(a: f64) callconv(.C) u64 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f64, u64, a);6 return fixuint(f64, u64, a);
7}7}
lib/std/special/compiler_rt/fixunsdfsi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunsdfsi(a: f64) u32 {4pub fn __fixunsdfsi(a: f64) callconv(.C) u32 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f64, u32, a);6 return fixuint(f64, u32, a);
7}7}
lib/std/special/compiler_rt/fixunsdfti.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunsdfti(a: f64) u128 {4pub fn __fixunsdfti(a: f64) callconv(.C) u128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f64, u128, a);6 return fixuint(f64, u128, a);
7}7}
lib/std/special/compiler_rt/fixunssfdi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunssfdi(a: f32) u64 {4pub fn __fixunssfdi(a: f32) callconv(.C) u64 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f32, u64, a);6 return fixuint(f32, u64, a);
7}7}
lib/std/special/compiler_rt/fixunssfsi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunssfsi(a: f32) u32 {4pub fn __fixunssfsi(a: f32) callconv(.C) u32 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f32, u32, a);6 return fixuint(f32, u32, a);
7}7}
lib/std/special/compiler_rt/fixunssfti.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunssfti(a: f32) u128 {4pub fn __fixunssfti(a: f32) callconv(.C) u128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f32, u128, a);6 return fixuint(f32, u128, a);
7}7}
lib/std/special/compiler_rt/fixunstfdi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunstfdi(a: f128) u64 {4pub fn __fixunstfdi(a: f128) callconv(.C) u64 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f128, u64, a);6 return fixuint(f128, u64, a);
7}7}
lib/std/special/compiler_rt/fixunstfsi.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunstfsi(a: f128) u32 {4pub fn __fixunstfsi(a: f128) callconv(.C) u32 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f128, u32, a);6 return fixuint(f128, u32, a);
7}7}
lib/std/special/compiler_rt/fixunstfti.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const fixuint = @import("fixuint.zig").fixuint;1const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __fixunstfti(a: f128) u128 {4pub fn __fixunstfti(a: f128) callconv(.C) u128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return fixuint(f128, u128, a);6 return fixuint(f128, u128, a);
7}7}
lib/std/special/compiler_rt/floatdidf.zig+1-1
...@@ -4,7 +4,7 @@ const std = @import("std");...@@ -4,7 +4,7 @@ const std = @import("std");
4const twop52: f64 = 0x1.0p52;4const twop52: f64 = 0x1.0p52;
5const twop32: f64 = 0x1.0p32;5const twop32: f64 = 0x1.0p32;
66
7pub extern fn __floatdidf(a: i64) f64 {7pub fn __floatdidf(a: i64) callconv(.C) f64 {
8 @setRuntimeSafety(builtin.is_test);8 @setRuntimeSafety(builtin.is_test);
99
10 if (a == 0) return 0;10 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 {...@@ -53,17 +53,17 @@ fn floatsiXf(comptime T: type, a: i32) T {
53 return @bitCast(T, result);53 return @bitCast(T, result);
54}54}
5555
56pub extern fn __floatsisf(arg: i32) f32 {56pub fn __floatsisf(arg: i32) callconv(.C) f32 {
57 @setRuntimeSafety(builtin.is_test);57 @setRuntimeSafety(builtin.is_test);
58 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f32, arg });58 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f32, arg });
59}59}
6060
61pub extern fn __floatsidf(arg: i32) f64 {61pub fn __floatsidf(arg: i32) callconv(.C) f64 {
62 @setRuntimeSafety(builtin.is_test);62 @setRuntimeSafety(builtin.is_test);
63 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f64, arg });63 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f64, arg });
64}64}
6565
66pub extern fn __floatsitf(arg: i32) f128 {66pub fn __floatsitf(arg: i32) callconv(.C) f128 {
67 @setRuntimeSafety(builtin.is_test);67 @setRuntimeSafety(builtin.is_test);
68 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg });68 return @call(.{ .modifier = .always_inline }, floatsiXf, .{ f128, arg });
69}69}
lib/std/special/compiler_rt/floattidf.zig+1-1
...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
6const DBL_MANT_DIG = 53;6const DBL_MANT_DIG = 53;
77
8pub extern fn __floattidf(arg: i128) f64 {8pub fn __floattidf(arg: i128) callconv(.C) f64 {
9 @setRuntimeSafety(is_test);9 @setRuntimeSafety(is_test);
1010
11 if (arg == 0)11 if (arg == 0)
lib/std/special/compiler_rt/floattisf.zig+1-1
...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
6const FLT_MANT_DIG = 24;6const FLT_MANT_DIG = 24;
77
8pub extern fn __floattisf(arg: i128) f32 {8pub fn __floattisf(arg: i128) callconv(.C) f32 {
9 @setRuntimeSafety(is_test);9 @setRuntimeSafety(is_test);
1010
11 if (arg == 0)11 if (arg == 0)
lib/std/special/compiler_rt/floattitf.zig+1-1
...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
6const LDBL_MANT_DIG = 113;6const LDBL_MANT_DIG = 113;
77
8pub extern fn __floattitf(arg: i128) f128 {8pub fn __floattitf(arg: i128) callconv(.C) f128 {
9 @setRuntimeSafety(is_test);9 @setRuntimeSafety(is_test);
1010
11 if (arg == 0)11 if (arg == 0)
lib/std/special/compiler_rt/floatundidf.zig+1-1
...@@ -5,7 +5,7 @@ const twop52: f64 = 0x1.0p52;...@@ -5,7 +5,7 @@ const twop52: f64 = 0x1.0p52;
5const twop84: f64 = 0x1.0p84;5const twop84: f64 = 0x1.0p84;
6const twop84_plus_twop52: f64 = 0x1.00000001p84;6const twop84_plus_twop52: f64 = 0x1.00000001p84;
77
8pub extern fn __floatundidf(a: u64) f64 {8pub fn __floatundidf(a: u64) callconv(.C) f64 {
9 @setRuntimeSafety(builtin.is_test);9 @setRuntimeSafety(builtin.is_test);
1010
11 if (a == 0) return 0;11 if (a == 0) return 0;
lib/std/special/compiler_rt/floatunditf.zig+1-1
...@@ -2,7 +2,7 @@ const builtin = @import("builtin");...@@ -2,7 +2,7 @@ const builtin = @import("builtin");
2const is_test = builtin.is_test;2const is_test = builtin.is_test;
3const std = @import("std");3const std = @import("std");
44
5pub extern fn __floatunditf(a: u128) f128 {5pub fn __floatunditf(a: u128) callconv(.C) f128 {
6 @setRuntimeSafety(is_test);6 @setRuntimeSafety(is_test);
77
8 if (a == 0) {8 if (a == 0) {
lib/std/special/compiler_rt/floatunsidf.zig+1-1
...@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;...@@ -4,7 +4,7 @@ const maxInt = std.math.maxInt;
44
5const implicitBit = @as(u64, 1) << 52;5const implicitBit = @as(u64, 1) << 52;
66
7pub extern fn __floatunsidf(arg: u32) f64 {7pub fn __floatunsidf(arg: u32) callconv(.C) f64 {
8 @setRuntimeSafety(builtin.is_test);8 @setRuntimeSafety(builtin.is_test);
99
10 if (arg == 0) return 0.0;10 if (arg == 0) return 0.0;
lib/std/special/compiler_rt/floatunsitf.zig+1-1
...@@ -2,7 +2,7 @@ const builtin = @import("builtin");...@@ -2,7 +2,7 @@ const builtin = @import("builtin");
2const is_test = builtin.is_test;2const is_test = builtin.is_test;
3const std = @import("std");3const std = @import("std");
44
5pub extern fn __floatunsitf(a: u64) f128 {5pub fn __floatunsitf(a: u64) callconv(.C) f128 {
6 @setRuntimeSafety(is_test);6 @setRuntimeSafety(is_test);
77
8 if (a == 0) {8 if (a == 0) {
lib/std/special/compiler_rt/floatuntidf.zig+1-1
...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
6const DBL_MANT_DIG = 53;6const DBL_MANT_DIG = 53;
77
8pub extern fn __floatuntidf(arg: u128) f64 {8pub fn __floatuntidf(arg: u128) callconv(.C) f64 {
9 @setRuntimeSafety(is_test);9 @setRuntimeSafety(is_test);
1010
11 if (arg == 0)11 if (arg == 0)
lib/std/special/compiler_rt/floatuntisf.zig+1-1
...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
6const FLT_MANT_DIG = 24;6const FLT_MANT_DIG = 24;
77
8pub extern fn __floatuntisf(arg: u128) f32 {8pub fn __floatuntisf(arg: u128) callconv(.C) f32 {
9 @setRuntimeSafety(is_test);9 @setRuntimeSafety(is_test);
1010
11 if (arg == 0)11 if (arg == 0)
lib/std/special/compiler_rt/floatuntitf.zig+1-1
...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;...@@ -5,7 +5,7 @@ const maxInt = std.math.maxInt;
55
6const LDBL_MANT_DIG = 113;6const LDBL_MANT_DIG = 113;
77
8pub extern fn __floatuntitf(arg: u128) f128 {8pub fn __floatuntitf(arg: u128) callconv(.C) f128 {
9 @setRuntimeSafety(is_test);9 @setRuntimeSafety(is_test);
1010
11 if (arg == 0)11 if (arg == 0)
lib/std/special/compiler_rt/lshrti3.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const compiler_rt = @import("../compiler_rt.zig");2const 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 {
5 var input = twords{ .all = a };5 var input = twords{ .all = a };
6 var result: twords = undefined;6 var result: twords = undefined;
77
lib/std/special/compiler_rt/modti3.zig+2-2
...@@ -6,7 +6,7 @@ const udivmod = @import("udivmod.zig").udivmod;...@@ -6,7 +6,7 @@ const udivmod = @import("udivmod.zig").udivmod;
6const builtin = @import("builtin");6const builtin = @import("builtin");
7const compiler_rt = @import("../compiler_rt.zig");7const 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 {
10 @setRuntimeSafety(builtin.is_test);10 @setRuntimeSafety(builtin.is_test);
1111
12 const s_a = a >> (i128.bit_count - 1); // s = a < 0 ? -1 : 012 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 {...@@ -21,7 +21,7 @@ pub extern fn __modti3(a: i128, b: i128) i128 {
21}21}
2222
23const v128 = @Vector(2, u64);23const 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 {
25 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __modti3, .{25 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __modti3, .{
26 @bitCast(i128, a),26 @bitCast(i128, a),
27 @bitCast(i128, b),27 @bitCast(i128, b),
lib/std/special/compiler_rt/mulXf3.zig+3-3
...@@ -6,13 +6,13 @@ const std = @import("std");...@@ -6,13 +6,13 @@ const std = @import("std");
6const builtin = @import("builtin");6const builtin = @import("builtin");
7const compiler_rt = @import("../compiler_rt.zig");7const 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 {
10 return mulXf3(f128, a, b);10 return mulXf3(f128, a, b);
11}11}
12pub extern fn __muldf3(a: f64, b: f64) f64 {12pub fn __muldf3(a: f64, b: f64) callconv(.C) f64 {
13 return mulXf3(f64, a, b);13 return mulXf3(f64, a, b);
14}14}
15pub extern fn __mulsf3(a: f32, b: f32) f32 {15pub fn __mulsf3(a: f32, b: f32) callconv(.C) f32 {
16 return mulXf3(f32, a, b);16 return mulXf3(f32, a, b);
17}17}
1818
lib/std/special/compiler_rt/muldi3.zig+1-1
...@@ -39,7 +39,7 @@ fn __muldsi3(a: u32, b: u32) i64 {...@@ -39,7 +39,7 @@ fn __muldsi3(a: u32, b: u32) i64 {
39 return r.all;39 return r.all;
40}40}
4141
42pub extern fn __muldi3(a: i64, b: i64) i64 {42pub fn __muldi3(a: i64, b: i64) callconv(.C) i64 {
43 @setRuntimeSafety(builtin.is_test);43 @setRuntimeSafety(builtin.is_test);
4444
45 const x = dwords{ .all = a };45 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");...@@ -3,7 +3,7 @@ const compiler_rt = @import("../compiler_rt.zig");
3const maxInt = std.math.maxInt;3const maxInt = std.math.maxInt;
4const minInt = std.math.minInt;4const 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 {
7 @setRuntimeSafety(builtin.is_test);7 @setRuntimeSafety(builtin.is_test);
88
9 const min = @bitCast(i64, @as(u64, 1 << (i64.bit_count - 1)));9 const min = @bitCast(i64, @as(u64, 1 << (i64.bit_count - 1)));
lib/std/special/compiler_rt/muloti4.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const compiler_rt = @import("../compiler_rt.zig");2const 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 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
66
7 const min = @bitCast(i128, @as(u128, 1 << (i128.bit_count - 1)));7 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");...@@ -5,7 +5,7 @@ const compiler_rt = @import("../compiler_rt.zig");
5// ae684fad6d34858c014c94da69c15e7774a633c35// ae684fad6d34858c014c94da69c15e7774a633c3
6// 2018-08-136// 2018-08-13
77
8pub extern fn __multi3(a: i128, b: i128) i128 {8pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
9 @setRuntimeSafety(builtin.is_test);9 @setRuntimeSafety(builtin.is_test);
10 const x = twords{ .all = a };10 const x = twords{ .all = a };
11 const y = twords{ .all = b };11 const y = twords{ .all = b };
...@@ -15,7 +15,7 @@ pub extern fn __multi3(a: i128, b: i128) i128 {...@@ -15,7 +15,7 @@ pub extern fn __multi3(a: i128, b: i128) i128 {
15}15}
1616
17const v128 = @Vector(2, u64);17const 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 {
19 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{19 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
20 @bitCast(i128, a),20 @bitCast(i128, a),
21 @bitCast(i128, b),21 @bitCast(i128, b),
lib/std/special/compiler_rt/negXf2.zig+2-2
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1const std = @import("std");1const std = @import("std");
22
3pub extern fn __negsf2(a: f32) f32 {3pub fn __negsf2(a: f32) callconv(.C) f32 {
4 return negXf2(f32, a);4 return negXf2(f32, a);
5}5}
66
7pub extern fn __negdf2(a: f64) f64 {7pub fn __negdf2(a: f64) callconv(.C) f64 {
8 return negXf2(f64, a);8 return negXf2(f64, a);
9}9}
1010
lib/std/special/compiler_rt/popcountdi2.zig+1-1
...@@ -2,7 +2,7 @@ const builtin = @import("builtin");...@@ -2,7 +2,7 @@ const builtin = @import("builtin");
2const compiler_rt = @import("../compiler_rt.zig");2const compiler_rt = @import("../compiler_rt.zig");
33
4// ported from llvm compiler-rt 8.0.0rc3 95e1c294cb0415a377a7b1d6c7c7d4f89e1c04e44// ported from llvm compiler-rt 8.0.0rc3 95e1c294cb0415a377a7b1d6c7c7d4f89e1c04e4
5pub extern fn __popcountdi2(a: i64) i32 {5pub fn __popcountdi2(a: i64) callconv(.C) i32 {
6 var x2 = @bitCast(u64, a);6 var x2 = @bitCast(u64, a);
7 x2 = x2 - ((x2 >> 1) & 0x5555555555555555);7 x2 = x2 - ((x2 >> 1) & 0x5555555555555555);
8 // Every 2 bits holds the sum of every pair of bits (32)8 // 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 @@...@@ -1,22 +1,22 @@
1const std = @import("std");1const std = @import("std");
22
3pub extern fn __truncsfhf2(a: f32) u16 {3pub fn __truncsfhf2(a: f32) callconv(.C) u16 {
4 return @bitCast(u16, truncXfYf2(f16, f32, a));4 return @bitCast(u16, truncXfYf2(f16, f32, a));
5}5}
66
7pub extern fn __truncdfhf2(a: f64) u16 {7pub fn __truncdfhf2(a: f64) callconv(.C) u16 {
8 return @bitCast(u16, truncXfYf2(f16, f64, a));8 return @bitCast(u16, truncXfYf2(f16, f64, a));
9}9}
1010
11pub extern fn __trunctfsf2(a: f128) f32 {11pub fn __trunctfsf2(a: f128) callconv(.C) f32 {
12 return truncXfYf2(f32, f128, a);12 return truncXfYf2(f32, f128, a);
13}13}
1414
15pub extern fn __trunctfdf2(a: f128) f64 {15pub fn __trunctfdf2(a: f128) callconv(.C) f64 {
16 return truncXfYf2(f64, f128, a);16 return truncXfYf2(f64, f128, a);
17}17}
1818
19pub extern fn __truncdfsf2(a: f64) f32 {19pub fn __truncdfsf2(a: f64) callconv(.C) f32 {
20 return truncXfYf2(f32, f64, a);20 return truncXfYf2(f32, f64, a);
21}21}
2222
lib/std/special/compiler_rt/udivmoddi4.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const udivmod = @import("udivmod.zig").udivmod;1const udivmod = @import("udivmod.zig").udivmod;
2const builtin = @import("builtin");2const 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 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return udivmod(u64, a, b, maybe_rem);6 return udivmod(u64, a, b, maybe_rem);
7}7}
lib/std/special/compiler_rt/udivmodti4.zig+2-2
...@@ -2,13 +2,13 @@ const udivmod = @import("udivmod.zig").udivmod;...@@ -2,13 +2,13 @@ const udivmod = @import("udivmod.zig").udivmod;
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const compiler_rt = @import("../compiler_rt.zig");3const 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 {
6 @setRuntimeSafety(builtin.is_test);6 @setRuntimeSafety(builtin.is_test);
7 return udivmod(u128, a, b, maybe_rem);7 return udivmod(u128, a, b, maybe_rem);
8}8}
99
10const v128 = @Vector(2, u64);10const 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 {
12 @setRuntimeSafety(builtin.is_test);12 @setRuntimeSafety(builtin.is_test);
13 return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem));13 return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem));
14}14}
lib/std/special/compiler_rt/udivti3.zig+2-2
...@@ -1,13 +1,13 @@...@@ -1,13 +1,13 @@
1const udivmodti4 = @import("udivmodti4.zig");1const udivmodti4 = @import("udivmodti4.zig");
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4pub extern fn __udivti3(a: u128, b: u128) u128 {4pub fn __udivti3(a: u128, b: u128) callconv(.C) u128 {
5 @setRuntimeSafety(builtin.is_test);5 @setRuntimeSafety(builtin.is_test);
6 return udivmodti4.__udivmodti4(a, b, null);6 return udivmodti4.__udivmodti4(a, b, null);
7}7}
88
9const v128 = @Vector(2, u64);9const 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 {
11 @setRuntimeSafety(builtin.is_test);11 @setRuntimeSafety(builtin.is_test);
12 return udivmodti4.__udivmodti4_windows_x86_64(a, b, null);12 return udivmodti4.__udivmodti4_windows_x86_64(a, b, null);
13}13}
lib/std/special/compiler_rt/umodti3.zig+2-2
...@@ -2,7 +2,7 @@ const udivmodti4 = @import("udivmodti4.zig");...@@ -2,7 +2,7 @@ const udivmodti4 = @import("udivmodti4.zig");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const compiler_rt = @import("../compiler_rt.zig");3const 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 {
6 @setRuntimeSafety(builtin.is_test);6 @setRuntimeSafety(builtin.is_test);
7 var r: u128 = undefined;7 var r: u128 = undefined;
8 _ = udivmodti4.__udivmodti4(a, b, &r);8 _ = udivmodti4.__udivmodti4(a, b, &r);
...@@ -10,7 +10,7 @@ pub extern fn __umodti3(a: u128, b: u128) u128 {...@@ -10,7 +10,7 @@ pub extern fn __umodti3(a: u128, b: u128) u128 {
10}10}
1111
12const v128 = @Vector(2, u64);12const 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 {
14 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __umodti3, .{14 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __umodti3, .{
15 @bitCast(u128, a),15 @bitCast(u128, a),
16 @bitCast(u128, b),16 @bitCast(u128, b),
lib/std/start.zig+4-8
...@@ -43,11 +43,7 @@ comptime {...@@ -43,11 +43,7 @@ comptime {
43 }43 }
44}44}
4545
46fn _DllMainCRTStartup(46fn _DllMainCRTStartup(hinstDLL: std.os.windows.HINSTANCE, fdwReason: std.os.windows.DWORD, lpReserved: std.os.windows.LPVOID) callconv(.Stdcall) std.os.windows.BOOL {
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 {
51 if (@hasDecl(root, "DllMain")) {47 if (@hasDecl(root, "DllMain")) {
52 return root.DllMain(hinstDLL, fdwReason, lpReserved);48 return root.DllMain(hinstDLL, fdwReason, lpReserved);
53 }49 }
...@@ -55,13 +51,13 @@ fn _DllMainCRTStartup(...@@ -55,13 +51,13 @@ fn _DllMainCRTStartup(
55 return std.os.windows.TRUE;51 return std.os.windows.TRUE;
56}52}
5753
58extern fn wasm_freestanding_start() void {54fn wasm_freestanding_start() callconv(.C) void {
59 // This is marked inline because for some reason LLVM in release mode fails to inline it,55 // This is marked inline because for some reason LLVM in release mode fails to inline it,
60 // and we want fewer call frames in stack traces.56 // and we want fewer call frames in stack traces.
61 _ = @call(.{ .modifier = .always_inline }, callMain, .{});57 _ = @call(.{ .modifier = .always_inline }, callMain, .{});
62}58}
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 {
65 const bad_efi_main_ret = "expected return type of main to be 'void', 'noreturn', or 'usize'";61 const bad_efi_main_ret = "expected return type of main to be 'void', 'noreturn', or 'usize'";
66 uefi.handle = handle;62 uefi.handle = handle;
67 uefi.system_table = system_table;63 uefi.system_table = system_table;
...@@ -198,7 +194,7 @@ fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 {...@@ -198,7 +194,7 @@ fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 {
198 return initEventLoopAndCallMain();194 return initEventLoopAndCallMain();
199}195}
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 {
202 var env_count: usize = 0;198 var env_count: usize = 0;
203 while (c_envp[env_count] != null) : (env_count += 1) {}199 while (c_envp[env_count] != null) : (env_count += 1) {}
204 const envp = @ptrCast([*][*:0]u8, c_envp)[0..env_count];200 const envp = @ptrCast([*][*:0]u8, c_envp)[0..env_count];
lib/std/thread.zig+3-3
...@@ -156,7 +156,7 @@ pub const Thread = struct {...@@ -156,7 +156,7 @@ pub const Thread = struct {
156 thread: Thread,156 thread: Thread,
157 inner: Context,157 inner: Context,
158 };158 };
159 extern fn threadMain(raw_arg: windows.LPVOID) windows.DWORD {159 fn threadMain(raw_arg: windows.LPVOID) callconv(.C) windows.DWORD {
160 const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*;160 const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*;
161 switch (@typeId(@TypeOf(startFn).ReturnType)) {161 switch (@typeId(@TypeOf(startFn).ReturnType)) {
162 .Int => {162 .Int => {
...@@ -198,7 +198,7 @@ pub const Thread = struct {...@@ -198,7 +198,7 @@ pub const Thread = struct {
198 }198 }
199199
200 const MainFuncs = struct {200 const MainFuncs = struct {
201 extern fn linuxThreadMain(ctx_addr: usize) u8 {201 fn linuxThreadMain(ctx_addr: usize) callconv(.C) u8 {
202 const arg = if (@sizeOf(Context) == 0) {} else @intToPtr(*const Context, ctx_addr).*;202 const arg = if (@sizeOf(Context) == 0) {} else @intToPtr(*const Context, ctx_addr).*;
203203
204 switch (@typeId(@TypeOf(startFn).ReturnType)) {204 switch (@typeId(@TypeOf(startFn).ReturnType)) {
...@@ -212,7 +212,7 @@ pub const Thread = struct {...@@ -212,7 +212,7 @@ pub const Thread = struct {
212 else => @compileError("expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"),212 else => @compileError("expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"),
213 }213 }
214 }214 }
215 extern fn posixThreadMain(ctx: ?*c_void) ?*c_void {215 fn posixThreadMain(ctx: ?*c_void) callconv(.C) ?*c_void {
216 if (@sizeOf(Context) == 0) {216 if (@sizeOf(Context) == 0) {
217 _ = startFn({});217 _ = startFn({});
218 return null;218 return null;
lib/std/unicode/throughput_test.zig+1-1
...@@ -22,7 +22,7 @@ pub fn main() !void {...@@ -22,7 +22,7 @@ pub fn main() !void {
22 const elapsed_ns_orig = timer.lap();22 const elapsed_ns_orig = timer.lap();
23 @fence(.SeqCst);23 @fence(.SeqCst);
2424
25 var buffer2: [32767] u16 align(4096) = undefined;25 var buffer2: [32767]u16 align(4096) = undefined;
26 _ = try std.unicode.utf8ToUtf16Le_better(&buffer2, args[1]);26 _ = try std.unicode.utf8ToUtf16Le_better(&buffer2, args[1]);
2727
28 @fence(.SeqCst);28 @fence(.SeqCst);
test/compile_errors.zig+3-3
...@@ -2972,7 +2972,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -2972,7 +2972,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
2972 \\ foo(bar);2972 \\ foo(bar);
2973 \\}2973 \\}
2974 \\2974 \\
2975 \\extern fn bar(x: *void) void { }2975 \\fn bar(x: *void) callconv(.C) void { }
2976 \\export fn entry2() void {2976 \\export fn entry2() void {
2977 \\ bar(&{});2977 \\ bar(&{});
2978 \\}2978 \\}
...@@ -3871,7 +3871,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -3871,7 +3871,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
3871 \\3871 \\
3872 \\export fn entry() usize { return @sizeOf(@TypeOf(fns)); }3872 \\export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
3873 , &[_][]const u8{3873 , &[_][]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'",
3875 });3875 });
38763876
3877 cases.add("colliding invalid top level functions",3877 cases.add("colliding invalid top level functions",
...@@ -5618,7 +5618,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {...@@ -5618,7 +5618,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
5618 });5618 });
56195619
5620 cases.add("wrong types given to @export",5620 cases.add("wrong types given to @export",
5621 \\extern fn entry() void { }5621 \\fn entry() callconv(.C) void { }
5622 \\comptime {5622 \\comptime {
5623 \\ @export("entry", entry, @as(u32, 1234));5623 \\ @export("entry", entry, @as(u32, 1234));
5624 \\}5624 \\}
test/stage1/behavior/align.zig+3-3
...@@ -221,14 +221,14 @@ test "alignment of structs" {...@@ -221,14 +221,14 @@ test "alignment of structs" {
221 }) == @alignOf(usize));221 }) == @alignOf(usize));
222}222}
223223
224test "alignment of extern() void" {224test "alignment of function with c calling convention" {
225 var runtime_nothing = nothing;225 var runtime_nothing = nothing;
226 const casted1 = @ptrCast(*const u8, runtime_nothing);226 const casted1 = @ptrCast(*const u8, runtime_nothing);
227 const casted2 = @ptrCast(extern fn () void, casted1);227 const casted2 = @ptrCast(fn () callconv(.C) void, casted1);
228 casted2();228 casted2();
229}229}
230230
231extern fn nothing() void {}231fn nothing() callconv(.C) void {}
232232
233test "return error union with 128-bit integer" {233test "return error union with 128-bit integer" {
234 expect(3 == try give());234 expect(3 == try give());
test/stage1/behavior/bugs/1310.zig+2-2
...@@ -3,7 +3,7 @@ const expect = std.testing.expect;...@@ -3,7 +3,7 @@ const expect = std.testing.expect;
33
4pub const VM = ?[*]const struct_InvocationTable_;4pub const VM = ?[*]const struct_InvocationTable_;
5pub const struct_InvocationTable_ = extern struct {5pub const struct_InvocationTable_ = extern struct {
6 GetVM: ?extern fn (?[*]VM) c_int,6 GetVM: ?fn (?[*]VM) callconv(.C) c_int,
7};7};
88
9pub const struct_VM_ = extern struct {9pub const struct_VM_ = extern struct {
...@@ -15,7 +15,7 @@ pub const struct_VM_ = extern struct {...@@ -15,7 +15,7 @@ pub const struct_VM_ = extern struct {
15pub const InvocationTable_ = struct_InvocationTable_;15pub const InvocationTable_ = struct_InvocationTable_;
16pub const VM_ = struct_VM_;16pub const VM_ = struct_VM_;
1717
18extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 {18fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 {
19 return 11;19 return 11;
20}20}
2121
test/stage1/behavior/cast.zig+2-2
...@@ -477,7 +477,7 @@ test "compile time int to ptr of function" {...@@ -477,7 +477,7 @@ test "compile time int to ptr of function" {
477}477}
478478
479pub const FUNCTION_CONSTANT = @intToPtr(PFN_void, maxInt(usize));479pub 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
482fn foobar(func: PFN_void) void {482fn foobar(func: PFN_void) void {
483 std.testing.expect(@ptrToInt(func) == maxInt(usize));483 std.testing.expect(@ptrToInt(func) == maxInt(usize));
...@@ -587,7 +587,7 @@ test "peer cast *[0]T to []const T" {...@@ -587,7 +587,7 @@ test "peer cast *[0]T to []const T" {
587587
588var global_array: [4]u8 = undefined;588var global_array: [4]u8 = undefined;
589test "cast from array reference to fn" {589test "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);
591 expect(@ptrToInt(f) == @ptrToInt(&global_array));591 expect(@ptrToInt(f) == @ptrToInt(&global_array));
592}592}
593593
test/stage1/behavior/misc.zig+1-1
...@@ -19,7 +19,7 @@ comptime {...@@ -19,7 +19,7 @@ comptime {
19 @export("disabledExternFn", disabledExternFn, builtin.GlobalLinkage.Internal);19 @export("disabledExternFn", disabledExternFn, builtin.GlobalLinkage.Internal);
20}20}
2121
22extern fn disabledExternFn() void {}22fn disabledExternFn() callconv(.C) void {}
2323
24test "call disabled extern fn" {24test "call disabled extern fn" {
25 disabledExternFn();25 disabledExternFn();
test/stage1/behavior/struct.zig+2-2
...@@ -580,7 +580,7 @@ test "default struct initialization fields" {...@@ -580,7 +580,7 @@ test "default struct initialization fields" {
580 expectEqual(1239, x.a + x.b);580 expectEqual(1239, x.a + x.b);
581}581}
582582
583test "extern fn returns struct by value" {583test "fn with C calling convention returns struct by value" {
584 const S = struct {584 const S = struct {
585 fn entry() void {585 fn entry() void {
586 var x = makeBar(10);586 var x = makeBar(10);
...@@ -591,7 +591,7 @@ test "extern fn returns struct by value" {...@@ -591,7 +591,7 @@ test "extern fn returns struct by value" {
591 handle: i32,591 handle: i32,
592 };592 };
593593
594 extern fn makeBar(t: i32) ExternBar {594 fn makeBar(t: i32) callconv(.C) ExternBar {
595 return ExternBar{595 return ExternBar{
596 .handle = t,596 .handle = t,
597 };597 };
test/standalone/load_dynamic_library/main.zig+1-1
...@@ -9,7 +9,7 @@ pub fn main() !void {...@@ -9,7 +9,7 @@ pub fn main() !void {
9 var lib = try std.DynLib.open(dynlib_name);9 var lib = try std.DynLib.open(dynlib_name);
10 defer lib.close();10 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
14 const result = addFn(12, 34);14 const result = addFn(12, 34);
15 std.debug.assert(result == 46);15 std.debug.assert(result == 46);
test/translate_c.zig+2-2
...@@ -238,7 +238,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -238,7 +238,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
238 \\pub extern fn foo() void;238 \\pub extern fn foo() void;
239 \\pub export fn bar() void {239 \\pub export fn bar() void {
240 \\ var func_ptr: ?*c_void = @ptrCast(?*c_void, foo);240 \\ 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)));
242 \\}242 \\}
243 });243 });
244244
...@@ -2297,7 +2297,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {...@@ -2297,7 +2297,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
2297 \\}2297 \\}
2298 , &[_][]const u8{2298 , &[_][]const u8{
2299 \\pub fn bar() callconv(.C) void {}2299 \\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 {
2301 \\ var baz = arg_baz;2301 \\ var baz = arg_baz;
2302 \\ bar();2302 \\ bar();
2303 \\ _ = baz.?();2303 \\ _ = baz.?();