mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
fix some bugs with -disable-assert
This commit is contained in:
@@ -297,7 +297,8 @@ lock :: proc(a: ^WASM_Allocator) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(intrinsics.wasm_memory_atomic_wait32((^u32)(&a.mu), u32(new_state), -1) != 0)
|
ret := intrinsics.wasm_memory_atomic_wait32((^u32)(&a.mu), u32(new_state), -1)
|
||||||
|
assert(ret != 0)
|
||||||
intrinsics.cpu_relax()
|
intrinsics.cpu_relax()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,8 @@ _marshal_into_encoder :: proc(e: Encoder, v: any, ti: ^runtime.Type_Info) -> (er
|
|||||||
builder := strings.builder_from_slice(res[:])
|
builder := strings.builder_from_slice(res[:])
|
||||||
e.writer = strings.to_stream(&builder)
|
e.writer = strings.to_stream(&builder)
|
||||||
|
|
||||||
assert(_encode_u64(e, u64(len(str)), .Text) == nil)
|
err := _encode_u64(e, u64(len(str)), .Text)
|
||||||
|
assert(err == nil)
|
||||||
res[9] = u8(len(builder.buf))
|
res[9] = u8(len(builder.buf))
|
||||||
assert(res[9] < 10)
|
assert(res[9] < 10)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ _unmarshal_value :: proc(d: Decoder, v: any, hdr: Header, allocator := context.a
|
|||||||
ti = reflect.type_info_base(variant)
|
ti = reflect.type_info_base(variant)
|
||||||
if !reflect.is_pointer_internally(variant) {
|
if !reflect.is_pointer_internally(variant) {
|
||||||
tag := any{rawptr(uintptr(v.data) + u.tag_offset), u.tag_type.id}
|
tag := any{rawptr(uintptr(v.data) + u.tag_offset), u.tag_type.id}
|
||||||
assert(_assign_int(tag, 1))
|
assigned := _assign_int(tag, 1)
|
||||||
|
assert(assigned)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -654,8 +654,8 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
|
|||||||
#no_bounds_check pkg := report.packages_by_name[it.pkg]
|
#no_bounds_check pkg := report.packages_by_name[it.pkg]
|
||||||
pkg.frame_ready = false
|
pkg.frame_ready = false
|
||||||
|
|
||||||
fmt.assertf(thread.pool_stop_task(&pool, test_index),
|
found := thread.pool_stop_task(&pool, test_index)
|
||||||
"A signal (%v) was raised to stop test #%i %s.%s, but it was unable to be found.",
|
fmt.assertf(found, "A signal (%v) was raised to stop test #%i %s.%s, but it was unable to be found.",
|
||||||
reason, test_index, it.pkg, it.name)
|
reason, test_index, it.pkg, it.name)
|
||||||
|
|
||||||
// The order this is handled in is a little particular.
|
// The order this is handled in is a little particular.
|
||||||
|
|||||||
@@ -81,9 +81,12 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
|||||||
defer unix.pthread_attr_destroy(&attrs)
|
defer unix.pthread_attr_destroy(&attrs)
|
||||||
|
|
||||||
// NOTE(tetra, 2019-11-01): These only fail if their argument is invalid.
|
// NOTE(tetra, 2019-11-01): These only fail if their argument is invalid.
|
||||||
assert(unix.pthread_attr_setdetachstate(&attrs, unix.PTHREAD_CREATE_JOINABLE) == 0)
|
res: i32
|
||||||
|
res = unix.pthread_attr_setdetachstate(&attrs, unix.PTHREAD_CREATE_JOINABLE)
|
||||||
|
assert(res == 0)
|
||||||
when ODIN_OS != .Haiku && ODIN_OS != .NetBSD {
|
when ODIN_OS != .Haiku && ODIN_OS != .NetBSD {
|
||||||
assert(unix.pthread_attr_setinheritsched(&attrs, unix.PTHREAD_EXPLICIT_SCHED) == 0)
|
res = unix.pthread_attr_setinheritsched(&attrs, unix.PTHREAD_EXPLICIT_SCHED)
|
||||||
|
assert(res == 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
thread := new(Thread)
|
thread := new(Thread)
|
||||||
@@ -94,7 +97,6 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
|||||||
|
|
||||||
// Set thread priority.
|
// Set thread priority.
|
||||||
policy: i32
|
policy: i32
|
||||||
res: i32
|
|
||||||
when ODIN_OS != .Haiku && ODIN_OS != .NetBSD {
|
when ODIN_OS != .Haiku && ODIN_OS != .NetBSD {
|
||||||
res = unix.pthread_attr_getschedpolicy(&attrs, &policy)
|
res = unix.pthread_attr_getschedpolicy(&attrs, &policy)
|
||||||
assert(res == 0)
|
assert(res == 0)
|
||||||
|
|||||||
Vendored
+2
-1
@@ -22,5 +22,6 @@ wgpu_alloc :: proc "contextless" (size: i32) -> [^]byte {
|
|||||||
@(private="file", export)
|
@(private="file", export)
|
||||||
wgpu_free :: proc "contextless" (ptr: rawptr) {
|
wgpu_free :: proc "contextless" (ptr: rawptr) {
|
||||||
context = g_context
|
context = g_context
|
||||||
assert(free(ptr) == nil, "wgpu_free failed")
|
err := free(ptr)
|
||||||
|
assert(err == nil, "wgpu_free failed")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user