assert: static_assert is not support in c standard C89,C99.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
wangbowen6 2022-04-19 20:31:34 +08:00 committed by Xiang Xiao
parent 1a7d81c942
commit 913c7148e5

View file

@ -77,7 +77,13 @@
*/
#ifndef __cplusplus
# define static_assert _Static_assert
# if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
# define static_assert _Static_assert
# else
# define static_assert(cond, msg) \
extern int (*__static_assert_function (void)) \
[!!sizeof (struct { int __error_if_negative: (cond) ? 2 : -1; })]
# endif
#endif
/****************************************************************************