diff options
| author | Nick Erdmann <n@nirf.de> | 2020-03-10 00:56:47 +0100 |
|---|---|---|
| committer | Nick Erdmann <n@nirf.de> | 2020-03-12 23:23:12 +0100 |
| commit | 92beb13914a680f4b41fe459ab095684076daa07 (patch) | |
| tree | ffe72c388f6ab704d6f3660cae3b54325d10378d /lib/std/start.zig | |
| parent | 6c368b9e7310af0b994e736e5bd5aee4a5723c95 (diff) | |
| download | zig-92beb13914a680f4b41fe459ab095684076daa07.tar.gz zig-92beb13914a680f4b41fe459ab095684076daa07.zip | |
std/os/uefi: status reform
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'"), } } |
