aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-10-25 11:34:09 +0100
committergingerBill <bill@gingerbill.org>2023-10-25 11:34:09 +0100
commitf3f0ab6e2ccac1f69358ea435edec27e3d42efcc (patch)
treed51c562152bed934377dcc974c75b7cb26f9c4ca
parent5a771732bd42be2b239b67e5c1d781031b01186d (diff)
On `-disable-assert`, `panic` will still work but not print the caller location
-rw-r--r--core/runtime/core.odin6
-rw-r--r--core/runtime/core_builtin.odin1
2 files changed, 4 insertions, 3 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index 8abe9938d..2d176f909 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -664,8 +664,10 @@ default_assertion_failure_proc :: proc(prefix, message: string, loc: Source_Code
when ODIN_OS == .Freestanding {
// Do nothing
} else {
- print_caller_location(loc)
- print_string(" ")
+ when !ODIN_DISABLE_ASSERT {
+ print_caller_location(loc)
+ print_string(" ")
+ }
print_string(prefix)
if len(message) > 0 {
print_string(": ")
diff --git a/core/runtime/core_builtin.odin b/core/runtime/core_builtin.odin
index 6ddd12a5e..45ecb0a7b 100644
--- a/core/runtime/core_builtin.odin
+++ b/core/runtime/core_builtin.odin
@@ -817,7 +817,6 @@ assert :: proc(condition: bool, message := "", loc := #caller_location) {
}
@builtin
-@(disabled=ODIN_DISABLE_ASSERT)
panic :: proc(message: string, loc := #caller_location) -> ! {
p := context.assertion_failure_proc
if p == nil {