From 01d32c19f8be682daac065f2571c55caed5e9951 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 11 Aug 2020 17:18:46 -0400 Subject: [PATCH] chore: replace asserts with abort to be use NDEBUG --- runtime/include/sandbox.h | 2 +- runtime/src/arch_context.c | 4 ++-- runtime/src/libc/uvio.c | 3 ++- runtime/src/worker_thread.c | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/runtime/include/sandbox.h b/runtime/include/sandbox.h index cb40124..71743ad 100644 --- a/runtime/include/sandbox.h +++ b/runtime/include/sandbox.h @@ -181,7 +181,7 @@ sandbox_state_stringify(sandbox_state_t state) return "Error"; default: /* Crash, as this should be exclusive */ - assert(0); + abort(); } } diff --git a/runtime/src/arch_context.c b/runtime/src/arch_context.c index 1e8befc..cbd763a 100644 --- a/runtime/src/arch_context.c +++ b/runtime/src/arch_context.c @@ -1,7 +1,7 @@ -#include #include #include #include +#include /** * Called by the inline assembly in arch_context_switch to send a SIGUSR1 in order to restore a previously preempted @@ -12,5 +12,5 @@ void __attribute__((noinline)) __attribute__((noreturn)) arch_context_restore_preempted(void) { pthread_kill(pthread_self(), SIGUSR1); - assert(false); + abort(); } diff --git a/runtime/src/libc/uvio.c b/runtime/src/libc/uvio.c index a48d94d..d3ce0f5 100644 --- a/runtime/src/libc/uvio.c +++ b/runtime/src/libc/uvio.c @@ -1,3 +1,4 @@ +#include #include #include "current_sandbox.h" @@ -627,7 +628,7 @@ wasm_fcntl(uint32_t file_descriptor, uint32_t cmd, uint32_t arg_or_lock_ptr) case WF_SETLK: return 0; default: - assert(0); + abort(); } } diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index a5f8d98..baa5601 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -311,5 +312,5 @@ worker_thread_on_sandbox_exit(struct sandbox *exiting_sandbox) assert(!software_interrupt_is_enabled()); worker_thread_dump_lock_overhead(); worker_thread_switch_to_base_context(); - assert(0); + abort(); }