summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-09-16 07:34:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-09-16 07:34:32 -0700
commitd041d90629f26b071fb71bebda785eb0b262f806 (patch)
tree2009abf956bf44714edbf6c9e89d8fdd457e12c7 /lib.h
parent60fa0cd314d283c99af60a650ba4f6c04ee1870a (diff)
downloadtxr-d041d90629f26b071fb71bebda785eb0b262f806.tar.gz
txr-d041d90629f26b071fb71bebda785eb0b262f806.tar.bz2
txr-d041d90629f26b071fb71bebda785eb0b262f806.zip
nan-boxing: build on older gcc.
Older GCC 4.x versions do not support diagnostic pragmas in functions and don't have push pragmas for diagnostics. * arith.c (flo): Put the diagnostic disabling pragma stuff outside of the function. Instead saving and restoring the status with push and pop, we just disable the aliasing warning and re-instate it as a warning. * lib.h (c_f): Likewise.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h15
1 files changed, 8 insertions, 7 deletions
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) | \