summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arith.c15
-rw-r--r--lib.h15
2 files changed, 16 insertions, 14 deletions
diff --git a/arith.c b/arith.c
index d135e2a4..fad3e15b 100644
--- a/arith.c
+++ b/arith.c
@@ -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
diff --git a/lib.h b/lib.h
index c2f42408..c15e1ff5 100644
--- a/lib.h
+++ b/lib.h
@@ -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) | \