1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #8642 from OTAkeys/feat/static_assert

assert: add static_assert if using c11
This commit is contained in:
Kaspar Schleiser 2018-04-03 22:10:46 +02:00 committed by GitHub
commit d9993cc8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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