diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-03-13 15:17:53 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-03-13 15:17:53 -0400 |
| commit | 656ba530d80e67bc7bb9c40e5c2db26a40743a15 (patch) | |
| tree | 767f4d57000922cf122ae965dc825f87c62ec64e /lib/std/start.zig | |
| parent | 96c07674fc2293fa040212ab797c05436dc515b1 (diff) | |
| parent | 3eff77bfb52accbc16eb831753ff4917fc2b4873 (diff) | |
| download | zig-656ba530d80e67bc7bb9c40e5c2db26a40743a15.tar.gz zig-656ba530d80e67bc7bb9c40e5c2db26a40743a15.zip | |
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'lib/std/start.zig')
| -rw-r--r-- | lib/std/start.zig | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig index b8e3e97f94..857af03b56 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -55,25 +55,24 @@ fn wasm_freestanding_start() callconv(.C) void { } fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize { - const bad_efi_main_ret = "expected return type of main to be 'void', 'noreturn', or 'usize'"; uefi.handle = handle; uefi.system_table = system_table; - switch (@typeInfo(@TypeOf(root.main).ReturnType)) { - .NoReturn => { + switch (@TypeOf(root.main).ReturnType) { + noreturn => { root.main(); }, - .Void => { + void => { root.main(); return 0; }, - .Int => |info| { - if (info.bits != @typeInfo(usize).Int.bits) { - @compileError(bad_efi_main_ret); - } + usize => { return root.main(); }, - else => @compileError(bad_efi_main_ret), + uefi.Status => { + return @enumToInt(root.main()); + }, + else => @compileError("expected return type of main to be 'void', 'noreturn', 'usize', or 'std.os.uefi.Status'"), } } |
