| ... | @@ -29,7 +29,7 @@ comptime { | ... | @@ -29,7 +29,7 @@ comptime { |
| 29 | if (simplified_logic) { | 29 | if (simplified_logic) { |
| 30 | if (builtin.output_mode == .Exe) { | 30 | if (builtin.output_mode == .Exe) { |
| 31 | if ((builtin.link_libc or builtin.object_format == .c) and @hasDecl(root, "main")) { | 31 | if ((builtin.link_libc or builtin.object_format == .c) and @hasDecl(root, "main")) { |
| 32 | if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) { | 32 | if (!@typeInfo(@TypeOf(root.main)).@"fn".calling_convention.eql(.c)) { |
| 33 | @export(&main2, .{ .name = "main" }); | 33 | @export(&main2, .{ .name = "main" }); |
| 34 | } | 34 | } |
| 35 | } else if (builtin.os.tag == .windows) { | 35 | } else if (builtin.os.tag == .windows) { |
| ... | @@ -96,7 +96,7 @@ comptime { | ... | @@ -96,7 +96,7 @@ comptime { |
| 96 | | 96 | |
| 97 | // Simplified start code for stage2 until it supports more language features /// | 97 | // Simplified start code for stage2 until it supports more language features /// |
| 98 | | 98 | |
| 99 | fn main2() callconv(.C) c_int { | 99 | fn main2() callconv(.c) c_int { |
| 100 | root.main(); | 100 | root.main(); |
| 101 | return 0; | 101 | return 0; |
| 102 | } | 102 | } |
| ... | @@ -110,11 +110,11 @@ fn callMain2() noreturn { | ... | @@ -110,11 +110,11 @@ fn callMain2() noreturn { |
| 110 | exit2(0); | 110 | exit2(0); |
| 111 | } | 111 | } |
| 112 | | 112 | |
| 113 | fn spirvMain2() callconv(.Kernel) void { | 113 | fn spirvMain2() callconv(.kernel) void { |
| 114 | root.main(); | 114 | root.main(); |
| 115 | } | 115 | } |
| 116 | | 116 | |
| 117 | fn wWinMainCRTStartup2() callconv(.C) noreturn { | 117 | fn wWinMainCRTStartup2() callconv(.c) noreturn { |
| 118 | root.main(); | 118 | root.main(); |
| 119 | exit2(0); | 119 | exit2(0); |
| 120 | } | 120 | } |
| ... | @@ -172,7 +172,7 @@ fn _DllMainCRTStartup( | ... | @@ -172,7 +172,7 @@ fn _DllMainCRTStartup( |
| 172 | hinstDLL: std.os.windows.HINSTANCE, | 172 | hinstDLL: std.os.windows.HINSTANCE, |
| 173 | fdwReason: std.os.windows.DWORD, | 173 | fdwReason: std.os.windows.DWORD, |
| 174 | lpReserved: std.os.windows.LPVOID, | 174 | lpReserved: std.os.windows.LPVOID, |
| 175 | ) callconv(std.os.windows.WINAPI) std.os.windows.BOOL { | 175 | ) callconv(.winapi) std.os.windows.BOOL { |
| 176 | if (!builtin.single_threaded and !builtin.link_libc) { | 176 | if (!builtin.single_threaded and !builtin.link_libc) { |
| 177 | _ = @import("os/windows/tls.zig"); | 177 | _ = @import("os/windows/tls.zig"); |
| 178 | } | 178 | } |
| ... | @@ -184,13 +184,13 @@ fn _DllMainCRTStartup( | ... | @@ -184,13 +184,13 @@ fn _DllMainCRTStartup( |
| 184 | return std.os.windows.TRUE; | 184 | return std.os.windows.TRUE; |
| 185 | } | 185 | } |
| 186 | | 186 | |
| 187 | fn wasm_freestanding_start() callconv(.C) void { | 187 | fn wasm_freestanding_start() callconv(.c) void { |
| 188 | // This is marked inline because for some reason LLVM in | 188 | // This is marked inline because for some reason LLVM in |
| 189 | // release mode fails to inline it, and we want fewer call frames in stack traces. | 189 | // release mode fails to inline it, and we want fewer call frames in stack traces. |
| 190 | _ = @call(.always_inline, callMain, .{}); | 190 | _ = @call(.always_inline, callMain, .{}); |
| 191 | } | 191 | } |
| 192 | | 192 | |
| 193 | fn wasi_start() callconv(.C) void { | 193 | fn wasi_start() callconv(.c) void { |
| 194 | // The function call is marked inline because for some reason LLVM in | 194 | // The function call is marked inline because for some reason LLVM in |
| 195 | // release mode fails to inline it, and we want fewer call frames in stack traces. | 195 | // release mode fails to inline it, and we want fewer call frames in stack traces. |
| 196 | switch (builtin.wasi_exec_model) { | 196 | switch (builtin.wasi_exec_model) { |
| ... | @@ -199,7 +199,7 @@ fn wasi_start() callconv(.C) void { | ... | @@ -199,7 +199,7 @@ fn wasi_start() callconv(.C) void { |
| 199 | } | 199 | } |
| 200 | } | 200 | } |
| 201 | | 201 | |
| 202 | fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize { | 202 | fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.c) usize { |
| 203 | uefi.handle = handle; | 203 | uefi.handle = handle; |
| 204 | uefi.system_table = system_table; | 204 | uefi.system_table = system_table; |
| 205 | | 205 | |
| ... | @@ -221,7 +221,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv | ... | @@ -221,7 +221,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv |
| 221 | } | 221 | } |
| 222 | } | 222 | } |
| 223 | | 223 | |
| 224 | fn _start() callconv(.Naked) noreturn { | 224 | fn _start() callconv(.naked) noreturn { |
| 225 | // TODO set Top of Stack on non x86_64-plan9 | 225 | // TODO set Top of Stack on non x86_64-plan9 |
| 226 | if (native_os == .plan9 and native_arch == .x86_64) { | 226 | if (native_os == .plan9 and native_arch == .x86_64) { |
| 227 | // from /sys/src/libc/amd64/main9.s | 227 | // from /sys/src/libc/amd64/main9.s |
| ... | @@ -447,7 +447,7 @@ fn wWinMainCRTStartup() callconv(.withStackAlign(.winapi, 1)) noreturn { | ... | @@ -447,7 +447,7 @@ fn wWinMainCRTStartup() callconv(.withStackAlign(.winapi, 1)) noreturn { |
| 447 | std.os.windows.ntdll.RtlExitUserProcess(@as(std.os.windows.UINT, @bitCast(result))); | 447 | std.os.windows.ntdll.RtlExitUserProcess(@as(std.os.windows.UINT, @bitCast(result))); |
| 448 | } | 448 | } |
| 449 | | 449 | |
| 450 | fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { | 450 | fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.c) noreturn { |
| 451 | // We're not ready to panic until thread local storage is initialized. | 451 | // We're not ready to panic until thread local storage is initialized. |
| 452 | @setRuntimeSafety(false); | 452 | @setRuntimeSafety(false); |
| 453 | // Code coverage instrumentation might try to use thread local variables. | 453 | // Code coverage instrumentation might try to use thread local variables. |
| ... | @@ -514,11 +514,11 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { | ... | @@ -514,11 +514,11 @@ fn posixCallMainAndExit(argc_argv_ptr: [*]usize) callconv(.C) noreturn { |
| 514 | // to ask for more stack space. | 514 | // to ask for more stack space. |
| 515 | expandStackSize(phdrs); | 515 | expandStackSize(phdrs); |
| 516 | | 516 | |
| 517 | const opt_init_array_start = @extern([*]*const fn () callconv(.C) void, .{ | 517 | const opt_init_array_start = @extern([*]*const fn () callconv(.c) void, .{ |
| 518 | .name = "__init_array_start", | 518 | .name = "__init_array_start", |
| 519 | .linkage = .weak, | 519 | .linkage = .weak, |
| 520 | }); | 520 | }); |
| 521 | const opt_init_array_end = @extern([*]*const fn () callconv(.C) void, .{ | 521 | const opt_init_array_end = @extern([*]*const fn () callconv(.c) void, .{ |
| 522 | .name = "__init_array_end", | 522 | .name = "__init_array_end", |
| 523 | .linkage = .weak, | 523 | .linkage = .weak, |
| 524 | }); | 524 | }); |
| ... | @@ -577,7 +577,7 @@ inline fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 { | ... | @@ -577,7 +577,7 @@ inline fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 { |
| 577 | return callMain(); | 577 | return callMain(); |
| 578 | } | 578 | } |
| 579 | | 579 | |
| 580 | fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) callconv(.C) c_int { | 580 | fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) callconv(.c) c_int { |
| 581 | var env_count: usize = 0; | 581 | var env_count: usize = 0; |
| 582 | while (c_envp[env_count] != null) : (env_count += 1) {} | 582 | while (c_envp[env_count] != null) : (env_count += 1) {} |
| 583 | const envp = @as([*][*:0]u8, @ptrCast(c_envp))[0..env_count]; | 583 | const envp = @as([*][*:0]u8, @ptrCast(c_envp))[0..env_count]; |
| ... | @@ -592,7 +592,7 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal | ... | @@ -592,7 +592,7 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal |
| 592 | return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp); | 592 | return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp); |
| 593 | } | 593 | } |
| 594 | | 594 | |
| 595 | fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.C) c_int { | 595 | fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.c) c_int { |
| 596 | std.os.argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@as(usize, @intCast(c_argc))]; | 596 | std.os.argv = @as([*][*:0]u8, @ptrCast(c_argv))[0..@as(usize, @intCast(c_argc))]; |
| 597 | return callMain(); | 597 | return callMain(); |
| 598 | } | 598 | } |
| ... | @@ -702,4 +702,4 @@ fn maybeIgnoreSigpipe() void { | ... | @@ -702,4 +702,4 @@ fn maybeIgnoreSigpipe() void { |
| 702 | } | 702 | } |
| 703 | } | 703 | } |
| 704 | | 704 | |
| 705 | fn noopSigHandler(_: i32) callconv(.C) void {} | 705 | fn noopSigHandler(_: i32) callconv(.c) void {} |