diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2022-12-22 09:18:05 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@github.mail.kapsi.fi> | 2022-12-23 09:32:17 +0300 |
commit | ed530007aa04b31b32fc056e49df4a8fd1080da5 (patch) | |
tree | 11c7d2e4b85ea9e3a414cbcd43181480f17b0e61 | |
parent | 01ca6298754b43b518390e433ee30162a65dd05b (diff) |
Use static_assert keyword on MSVC in C89 mode (#843)
-rw-r--r-- | pb.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -170,6 +170,9 @@ extern "C" { # if defined(__ICCARM__) /* IAR has static_assert keyword but no _Static_assert */ # define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); +# elif defined(_MSC_VER) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112) + /* MSVC in C89 mode supports static_assert() keyword anyway */ +# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); # elif defined(PB_C99_STATIC_ASSERT) /* Classic negative-size-array static assert mechanism */ # define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; |