From dfd26dbbeb1b89dbefccf9e3fb523df70cd729de Mon Sep 17 00:00:00 2001 From: Peter Bigot Date: Mon, 19 Aug 2019 14:48:47 -0500 Subject: [PATCH] libc/minimal/assert: conditionalize static_assert macro static_assert was not added to C until C11. Zephyr builds default to C99. To preserve compatibility with newlib avoid defining the macro at standard levels where it did not exist. Relates to #17738 and #11754. Signed-off-by: Peter Bigot --- lib/libc/minimal/include/assert.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libc/minimal/include/assert.h b/lib/libc/minimal/include/assert.h index aabec612a4d..9d09484d4bb 100644 --- a/lib/libc/minimal/include/assert.h +++ b/lib/libc/minimal/include/assert.h @@ -13,8 +13,10 @@ #ifdef __cplusplus extern "C" { #else +#if __STDC_VERSION__ >= 201112L #define static_assert _Static_assert -#endif +#endif /* __STDC_VERSION__ */ +#endif /* __cplusplus */ #ifndef NDEBUG #ifndef assert