aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-10-08 21:16:35 +0100
committermlugg <mlugg@mlugg.co.uk>2024-10-19 19:15:23 +0100
commitbc797a97b1f7476b620567ff32b7a396ebdb4c9c (patch)
tree368d8fbb1d1dd5fb0b84b8499392ec4f69ea2693 /lib/std/start.zig
parent36405b9b43237960733a86d0b1eeac1bc047311c (diff)
downloadzig-bc797a97b1f7476b620567ff32b7a396ebdb4c9c.tar.gz
zig-bc797a97b1f7476b620567ff32b7a396ebdb4c9c.zip
std: update for new `CallingConvention`
The old `CallingConvention` type is replaced with the new `NewCallingConvention`. References to `NewCallingConvention` in the compiler are updated accordingly. In addition, a few parts of the standard library are updated to use the new type correctly.
Diffstat (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 01a33522d0..a70d9e609e 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -55,7 +55,7 @@ comptime {
if (builtin.link_libc and @hasDecl(root, "main")) {
if (native_arch.isWasm()) {
@export(&mainWithoutEnv, .{ .name = "main" });
- } else if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) {
+ } else if (!@typeInfo(@TypeOf(root.main)).@"fn".calling_convention.eql(.c)) {
@export(&main, .{ .name = "main" });
}
} else if (native_os == .windows) {
@@ -102,12 +102,11 @@ fn main2() callconv(.C) c_int {
return 0;
}
-fn _start2() callconv(.C) noreturn {
+fn _start2() callconv(.withStackAlign(.c, 1)) noreturn {
callMain2();
}
fn callMain2() noreturn {
- @setAlignStack(16);
root.main();
exit2(0);
}
@@ -428,8 +427,7 @@ fn _start() callconv(.Naked) noreturn {
);
}
-fn WinStartup() callconv(std.os.windows.WINAPI) noreturn {
- @setAlignStack(16);
+fn WinStartup() callconv(.withStackAlign(.winapi, 1)) noreturn {
if (!builtin.single_threaded and !builtin.link_libc) {
_ = @import("os/windows/tls.zig");
}
@@ -439,8 +437,7 @@ fn WinStartup() callconv(std.os.windows.WINAPI) noreturn {
std.os.windows.ntdll.RtlExitUserProcess(callMain());
}
-fn wWinMainCRTStartup() callconv(std.os.windows.WINAPI) noreturn {
- @setAlignStack(16);
+fn wWinMainCRTStartup() callconv(.withStackAlign(.winapi, 1)) noreturn {
if (!builtin.single_threaded and !builtin.link_libc) {
_ = @import("os/windows/tls.zig");
}