diff options
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r-- | libcr/coroutine.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c index 568de4e..e080644 100644 --- a/libcr/coroutine.c +++ b/libcr/coroutine.c @@ -17,26 +17,26 @@ #include "config.h" #ifndef CONFIG_COROUTINE_DEFAULT_STACK_SIZE -# error config.h must define CONFIG_COROUTINE_DEFAULT_STACK_SIZE + #error config.h must define CONFIG_COROUTINE_DEFAULT_STACK_SIZE #endif #ifndef CONFIG_COROUTINE_NUM -# error config.h must define CONFIG_COROUTINE_NUM + #error config.h must define CONFIG_COROUTINE_NUM #endif #ifndef CONFIG_COROUTINE_MEASURE_STACK -# error config.h must define CONFIG_COROUTINE_MEASURE_STACK + #error config.h must define CONFIG_COROUTINE_MEASURE_STACK #endif #ifndef CONFIG_COROUTINE_PROTECT_STACK -# error config.h must define CONFIG_COROUTINE_PROTECT_STACK + #error config.h must define CONFIG_COROUTINE_PROTECT_STACK #endif #ifndef CONFIG_COROUTINE_DEBUG -# error config.h must define CONFIG_COROUTINE_DEBUG + #error config.h must define CONFIG_COROUTINE_DEBUG #endif #ifndef CONFIG_COROUTINE_VALGRIND -# error config.h must define CONFIG_COROUTINE_VALGRIND + #error config.h must define CONFIG_COROUTINE_VALGRIND #endif #if CONFIG_COROUTINE_VALGRIND -# include <valgrind/valgrind.h> + #include <valgrind/valgrind.h> #endif /* Implementation *************************************************************/ @@ -309,10 +309,10 @@ static const uint8_t stack_pattern[] = { }; #endif #if CONFIG_COROUTINE_PROTECT_STACK -# define STACK_GUARD_SIZE \ + #define STACK_GUARD_SIZE \ ROUND_UP(sizeof(stack_pattern), CR_PLAT_STACK_ALIGNMENT) #else -# define STACK_GUARD_SIZE 0 + #define STACK_GUARD_SIZE 0 #endif /* global variables ***********************************************************/ @@ -358,20 +358,20 @@ static cid_t coroutine_running = 0; #define errorf(...) fprintf(stderr, "error: " __VA_ARGS__) #define infof(...) printf("info: " __VA_ARGS__) #if CONFIG_COROUTINE_DEBUG -# define debugf(...) printf("dbg: " __VA_ARGS__) + #define debugf(...) printf("dbg: " __VA_ARGS__) #else -# define debugf(...) + #define debugf(...) #endif #ifdef __GLIBC__ -# define assertf(expr, ...) ({ \ + #define assertf(expr, ...) ({ \ if (!(expr)) { \ errorf("assertion: " __VA_ARGS__); \ __assert_fail(#expr, __FILE__, __LINE__, __func__); \ } \ }) #else -# define assertf(expr, ...) assert(expr) + #define assertf(expr, ...) assert(expr) #endif static inline const char* coroutine_state_str(enum coroutine_state state) { @@ -406,10 +406,10 @@ static inline void assert_cid(cid_t cid) { #endif } -#define assert_cid_state(cid, expr) do { \ - assert_cid(cid); \ +#define assert_cid_state(cid, expr) do { \ + assert_cid(cid); \ cid_t state = coroutine_table[(cid)-1].state; \ - assert(expr); \ + assert(expr); \ } while (0) |