assert: static_assert is not support in c standard C89,C99.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
1a7d81c942
commit
913c7148e5
1 changed files with 7 additions and 1 deletions
|
|
@ -77,7 +77,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#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
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue