Skip to content

Commit

Permalink
Merge pull request #8642 from OTAkeys/feat/static_assert
Browse files Browse the repository at this point in the history
assert: add static_assert if using c11
  • Loading branch information
kaspar030 committed Apr 3, 2018
2 parents cff4a45 + 729441f commit d9993cc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/include/assert.h
Expand Up @@ -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))
#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
}
#endif
Expand Down

0 comments on commit d9993cc

Please sign in to comment.