1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #9279 from ZetaR60/RIOT_c99_static_assert

core/assert: provide static_assert for c99
This commit is contained in:
Francisco Acosta 2018-06-03 19:50:04 +02:00 committed by GitHub
commit 5e5773c631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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