diff options
-rw-r--r-- | arith.c | 15 | ||||
-rw-r--r-- | lib.h | 15 |
2 files changed, 16 insertions, 14 deletions
@@ -4268,20 +4268,17 @@ INLINE int bad_float(double d) #define bad_float(d) (0) #endif +#if CONFIG_NAN_BOXING && defined __GNUC__ +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + val flo(double n) { if (bad_float(n)) { uw_throw(numeric_error_s, lit("out-of-range floating-point result")); } else { #if CONFIG_NAN_BOXING -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif ucnum u = *(ucnum *) &n + NAN_FLNUM_DELTA; -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif return coerce(val, u); #else val obj = make_obj(); @@ -4292,6 +4289,10 @@ val flo(double n) } } +#if CONFIG_NAN_BOXING && defined __GNUC__ +#pragma GCC diagnostic warning "-Wstrict-aliasing" +#endif + double c_flo(val num, val self) { #if CONFIG_NAN_BOXING @@ -621,23 +621,24 @@ INLINE ucnum c_u(val num) #endif } +#if CONFIG_NAN_BOXING && defined __GNUC__ +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + INLINE double c_f(val num) { #if CONFIG_NAN_BOXING ucnum u = coerce(ucnum, num) - NAN_FLNUM_DELTA; -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif return *coerce(double *, &u); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif #else return num->fl.n; #endif } +#if CONFIG_NAN_BOXING && defined __GNUC__ +#pragma GCC diagnostic warning "-Wstrict-aliasing" +#endif + #if SIZEOF_WCHAR_T < 4 && !CONFIG_NAN_BOXING #define lit_noex(strlit) coerce(obj_t *,\ coerce(cnum, L"\0" L ## strlit L"\0" + 1) | \ |