From 3a92a4e3d82bc2b7b07a7d817df824233bb770f7 Mon Sep 17 00:00:00 2001 From: dearblue Date: Mon, 23 Nov 2020 21:22:50 +0900 Subject: Avoid warnings from clang's "-Wembedded-directive" If it gives clang-11.0 `-Wembedded-directive`, a warning will be reported in `include/mruby/boxing_nan.h`. ``` include/mruby/boxing_nan.h:48:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] include/mruby/boxing_nan.h:52:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] ``` The cause of this is #5117. ref. e993b83c509912f2d90ffece32c969a642f5df01 --- include/mruby/boxing_nan.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/mruby/boxing_nan.h b/include/mruby/boxing_nan.h index 5f99ced6d..05f1d953c 100644 --- a/include/mruby/boxing_nan.h +++ b/include/mruby/boxing_nan.h @@ -41,15 +41,14 @@ union mrb_value_ { uint64_t u; #ifdef MRB_64BIT void *p; +# define BOXNAN_IMMEDIATE_VALUE uint32_t i +#else +# define BOXNAN_IMMEDIATE_VALUE union { uint32_t i; void *p; } #endif struct { MRB_ENDIAN_LOHI( uint32_t ttt; -#ifdef MRB_64BIT - ,uint32_t i; -#else - ,union { uint32_t i; void *p; }; -#endif + ,BOXNAN_IMMEDIATE_VALUE; ) }; mrb_value value; -- cgit v1.2.3