Skip to content
Snippets Groups Projects
Commit 729441fd authored by Pieter Willemsen's avatar Pieter Willemsen
Browse files

assert: add static_assert if using c11

parent 9e9a1d6f
No related branches found
No related tags found
No related merge requests found
...@@ -109,6 +109,20 @@ NORETURN void _assert_failure(const char *file, unsigned line); ...@@ -109,6 +109,20 @@ NORETURN void _assert_failure(const char *file, unsigned line);
#define assert(cond) ((cond) ? (void)0 : core_panic(PANIC_ASSERT_FAIL, assert_crash_message)) #define assert(cond) ((cond) ? (void)0 : core_panic(PANIC_ASSERT_FAIL, assert_crash_message))
#endif #endif
#if !defined __cplusplus
#if __STDC_VERSION__ >= 201112L
/**
* @brief c11 static_assert() macro
*/
#define static_assert(...) _Static_assert(__VA_ARGS__)
#else
/**
* @brief static_assert dummy for c-version < c11
*/
#define static_assert(...) struct static_assert_dummy
#endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment