diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-11 22:33:44 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-08-11 22:33:44 +0900 |
| commit | 2aa70e96904772d26b5199ace25757b058fe09cd (patch) | |
| tree | 41e593f94b12f4ed265e3f7ed4ee2d19b7a117aa /include/mruby.h | |
| parent | ae09a219d5eaed3749de801a09cbff66cdfb381b (diff) | |
| parent | bab7e9f032e7ddf7a1c29dc37a8afee47106dddf (diff) | |
| download | mruby-2aa70e96904772d26b5199ace25757b058fe09cd.tar.gz mruby-2aa70e96904772d26b5199ace25757b058fe09cd.zip | |
Merge pull request #5062 from shuujii/use-normal-static_assert-in-mrb_static_assert-as-much-as-possible
Use normal `static_assert` in `mrb_static_assert` as much as possible
Diffstat (limited to 'include/mruby.h')
| -rw-r--r-- | include/mruby.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/mruby.h b/include/mruby.h index 8625d4521..1ca87b390 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -62,12 +62,16 @@ #define mrb_assert_int_fit(t1,n,t2,max) ((void)0) #endif -#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L) || \ - (defined __cplusplus && __cplusplus >= 201103L) -# include <assert.h> +#if (defined __cplusplus && __cplusplus >= 201103L) || \ + (defined _WIN32 && !defined __MINGW32__) || \ + (defined __GXX_EXPERIMENTAL_CXX0X__) /* for old G++/Clang++ */ # define mrb_static_assert(exp, str) static_assert(exp, str) +#elif defined __STDC_VERSION__ && \ + ((__STDC_VERSION__ >= 201112L) || \ + (defined __GNUC__ && __GNUC__ * 100 + __GNUC_MINOR__ >= 406)) +# define mrb_static_assert(exp, str) _Static_assert(exp, str) #else -/* C version of static_assert() */ +# /* alternative implementation of static_assert() */ # define _mrb_static_assert_cat0(a, b) a##b # define _mrb_static_assert_cat(a, b) _mrb_static_assert_cat0(a, b) # ifdef __COUNTER__ |
