summaryrefslogtreecommitdiff
path: root/libcr/coroutine.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r--libcr/coroutine.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index 41d987e..ed1c8e0 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -4,12 +4,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-#include <assert.h>
#include <setjmp.h> /* for setjmp(), longjmp(), jmp_buf */
#include <stdint.h> /* for uint8_t */
#include <stdio.h> /* for printf(), fprintf(), stderr */
#include <stdlib.h> /* for aligned_alloc(), free() */
+#include <libmisc/assert.h>
+
#include <libcr/coroutine.h>
/* Configuration **************************************************************/
@@ -363,17 +364,6 @@ static cid_t coroutine_running = 0;
#define debugf(...)
#endif
-#ifdef __GLIBC__
- #define assertf(expr, ...) ({ \
- if (!(expr)) { \
- errorf("assertion: " __VA_ARGS__); \
- __assert_fail(#expr, __FILE__, __LINE__, __func__); \
- } \
- })
-#else
- #define assertf(expr, ...) assert(expr)
-#endif
-
static inline const char* coroutine_state_str(enum coroutine_state state) {
assert(state < ARRAY_LEN(coroutine_state_strs));
return coroutine_state_strs[state];
@@ -470,7 +460,7 @@ cid_t coroutine_add_with_stack_size(size_t stack_size, cr_fn_t fn, void *args) {
debugf("...stack_base=%p\n", stack_base);
/* run until cr_begin() */
cr_plat_call_with_stack(stack_base, fn, args);
- __builtin_unreachable(); /* should cr_begin() instead of returning */
+ assert_notreached("should cr_begin() instead of returning");
}
assert_cid_state(child, state == CR_RUNNABLE);
if (parent)