Browse Source

On `-disable-assert`, `panic` will still work but not print the caller location

gingerBill 1 year ago
parent
commit
f3f0ab6e2c
2 changed files with 4 additions and 3 deletions
  1. 4 2
      core/runtime/core.odin
  2. 0 1
      core/runtime/core_builtin.odin

+ 4 - 2
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(": ")

+ 0 - 1
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 {