Skip to content
Snippets Groups Projects
Commit 2bd1d7f0 authored by Matthew Blue's avatar Matthew Blue
Browse files

core/assert: provide static_assert for c99

parent 75291335
No related branches found
No related tags found
No related merge requests found
......@@ -114,9 +114,12 @@ NORETURN void _assert_failure(const char *file, unsigned line);
#define static_assert(...) _Static_assert(__VA_ARGS__)
#else
/**
* @brief static_assert dummy for c-version < c11
* @brief static_assert for c-version < c11
*
* Generates a division by zero compile error when cond is false
*/
#define static_assert(...) struct static_assert_dummy
#define static_assert(cond, ...) \
enum { static_assert_failed_on_div_by_0 = 1 / (!!(cond)) }
#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