mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-24 16:37:54 +00:00
Add unimplemented and unreachable procedures; make os.exit a diverging procedure
This commit is contained in:
@@ -139,7 +139,7 @@ foreign libc {
|
||||
@(link_name="calloc") _unix_calloc :: proc(num, size: int) -> rawptr ---;
|
||||
@(link_name="free") _unix_free :: proc(ptr: rawptr) ---;
|
||||
@(link_name="realloc") _unix_realloc :: proc(ptr: rawptr, size: int) -> rawptr ---;
|
||||
@(link_name="getenv") _unix_getenv :: proc(cstring) -> cstring ---;
|
||||
@(link_name="getenv") _unix_getenv :: proc(cstring) -> cstring --- -> !;
|
||||
|
||||
@(link_name="exit") _unix_exit :: proc(status: int) ---;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ getenv :: proc(name: string) -> (string, bool) {
|
||||
return string(cstr), true;
|
||||
}
|
||||
|
||||
exit :: proc(code: int) {
|
||||
exit :: proc(code: int) -> ! {
|
||||
_unix_exit(code);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ getenv :: proc(name: string) -> (string, bool) {
|
||||
return string(cstr), true;
|
||||
}
|
||||
|
||||
exit :: inline proc(code: int) {
|
||||
exit :: inline proc(code: int) -> ! {
|
||||
_unix_exit(code);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ heap_free :: proc(ptr: rawptr) {
|
||||
}
|
||||
|
||||
|
||||
exit :: proc(code: int) {
|
||||
exit :: proc(code: int) -> ! {
|
||||
win32.exit_process(u32(code));
|
||||
}
|
||||
|
||||
|
||||
@@ -590,6 +590,28 @@ panic :: proc "contextless" (message: string, loc := #caller_location) -> ! {
|
||||
p("Panic", message, loc);
|
||||
}
|
||||
|
||||
@(builtin)
|
||||
unimplemented :: proc "contextless" (message := "", loc := #caller_location) -> ! {
|
||||
p := context.assertion_failure_proc;
|
||||
if p == nil {
|
||||
p = default_assertion_failure_proc;
|
||||
}
|
||||
p("not yet implemented", message, loc);
|
||||
}
|
||||
|
||||
@(builtin)
|
||||
unreachable :: proc "contextless" (message := "", loc := #caller_location) -> ! {
|
||||
p := context.assertion_failure_proc;
|
||||
if p == nil {
|
||||
p = default_assertion_failure_proc;
|
||||
}
|
||||
if message != "" {
|
||||
p("internal error", message, loc);
|
||||
} else {
|
||||
p("internal error", "entered unreachable code", loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Dynamic Array
|
||||
|
||||
|
||||
Reference in New Issue
Block a user