about summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-07 15:09:53 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-11-01 09:46:08 -0300
commit5c5a8b99cf96b71940e36a9db66d3a61bc315016 (patch)
tree7396885b3487d9383bf477219a79ebcf68b64d9f /math
parent6ee5a9767a245455720d39eeaa3ce136825e8a42 (diff)
downloadglibc-5c5a8b99cf96b71940e36a9db66d3a61bc315016.tar.gz
glibc-5c5a8b99cf96b71940e36a9db66d3a61bc315016.tar.xz
glibc-5c5a8b99cf96b71940e36a9db66d3a61bc315016.zip
Disable use of -fsignaling-nans if compiler does not support it
Reviewed-by: Fangrui Song <maskray@google.com>
Diffstat (limited to 'math')
-rw-r--r--math/Makefile19
-rw-r--r--math/libm-test-fpclassify.inc2
-rw-r--r--math/libm-test-isfinite.inc2
-rw-r--r--math/libm-test-isinf.inc2
-rw-r--r--math/libm-test-isnan.inc2
-rw-r--r--math/libm-test-isnormal.inc2
-rw-r--r--math/libm-test-issubnormal.inc2
-rw-r--r--math/libm-test-iszero.inc2
-rw-r--r--math/test-snan.c10
9 files changed, 33 insertions, 10 deletions
diff --git a/math/Makefile b/math/Makefile
index b3dae4edf3..35a4014a66 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -248,8 +248,11 @@ tests = test-matherr-3 test-fenv basic-test \
 	test-femode-traps test-iszero-excess-precision \
 	test-iseqsig-excess-precision test-flt-eval-method \
 	test-fp-ilogb-constants test-fp-llogb-constants \
-	test-fe-snans-always-signal test-narrow-macros \
+	test-narrow-macros \
 	test-nan-const $(tests-static)
+ifneq ($(config-cflags-signaling-nans),)
+tests += test-fe-snans-always-signal
+endif
 tests-static = test-fpucw-static test-fpucw-ieee-static \
 	       test-signgam-uchar-static test-signgam-uchar-init-static \
 	       test-signgam-uint-static test-signgam-uint-init-static \
@@ -421,7 +424,7 @@ CFLAGS-test-float-vlen16-wrappers.c += $(float-vlen16-arch-ext-cflags)
 # exceptions.  Thus both versions of the classification macros are
 # validated.
 libm-test-no-inline-cflags = -fno-inline -ffloat-store -fno-builtin \
-			     -fsignaling-nans
+			     $(config-cflags-signaling-nans)
 CFLAGS-test-tgmath.c += -fno-builtin
 # The following testcase uses very long lines (>3 million), so it may take a
 # while to compile it. See: http://llvm.org/bugs/show_bug.cgi?id=14106 and
@@ -430,7 +433,7 @@ CFLAGS-test-tgmath2.c += -fno-builtin
 CFLAGS-test-tgmath-ret.c += -fno-builtin
 CFLAGS-test-powl.c += -fno-builtin
 
-CFLAGS-test-snan.c += -fsignaling-nans
+CFLAGS-test-snan.c += $(config-cflags-signaling-nans)
 
 CFLAGS-test-signgam-uchar.c += -std=c99
 CFLAGS-test-signgam-uchar-init.c += -std=c99
@@ -456,7 +459,7 @@ CFLAGS-test-iszero-excess-precision.c += -fexcess-precision=standard
 CFLAGS-test-iseqsig-excess-precision.c += -fexcess-precision=standard
 CFLAGS-test-flt-eval-method.c += -fexcess-precision=standard
 
-CFLAGS-test-fe-snans-always-signal.c += -fsignaling-nans
+CFLAGS-test-fe-snans-always-signal.c += $(config-cflags-signaling-nans)
 
 CFLAGS-test-nan-const.c += -fno-builtin
 
@@ -1001,10 +1004,10 @@ CFLAGS-s_ynf.c += -fno-builtin-ynf32
 
 # These files quiet sNaNs in a way that is optimized away without
 # -fsignaling-nans.
-CFLAGS-s_modf.c += -fsignaling-nans
-CFLAGS-s_modff.c += -fsignaling-nans
-CFLAGS-s_modfl.c += -fsignaling-nans
-CFLAGS-s_modff128.c += -fsignaling-nans
+CFLAGS-s_modf.c += $(config-cflags-signaling-nans)
+CFLAGS-s_modff.c += $(config-cflags-signaling-nans)
+CFLAGS-s_modfl.c += $(config-cflags-signaling-nans)
+CFLAGS-s_modff128.c += $(config-cflags-signaling-nans)
 
 $(addprefix $(objpfx),\
 	    $(filter-out $(tests-static) $(libm-tests-vector),\
diff --git a/math/libm-test-fpclassify.inc b/math/libm-test-fpclassify.inc
index f805ad5e23..dafb1fc6bf 100644
--- a/math/libm-test-fpclassify.inc
+++ b/math/libm-test-fpclassify.inc
@@ -22,8 +22,10 @@ static const struct test_f_i_data fpclassify_test_data[] =
   {
     TEST_f_i (fpclassify, qnan_value, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (fpclassify, -qnan_value, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_i (fpclassify, snan_value, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (fpclassify, -snan_value, FP_NAN, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
     TEST_f_i (fpclassify, plus_infty, FP_INFINITE, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (fpclassify, minus_infty, FP_INFINITE, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_i (fpclassify, plus_zero, FP_ZERO, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
diff --git a/math/libm-test-isfinite.inc b/math/libm-test-isfinite.inc
index 37a4ca4298..5b22dbce9f 100644
--- a/math/libm-test-isfinite.inc
+++ b/math/libm-test-isfinite.inc
@@ -33,8 +33,10 @@ static const struct test_f_i_data isfinite_test_data[] =
     TEST_f_b (isfinite, minus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isfinite, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isfinite, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_b (isfinite, snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isfinite, -snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 static void
diff --git a/math/libm-test-isinf.inc b/math/libm-test-isinf.inc
index 26548729e9..990babf01c 100644
--- a/math/libm-test-isinf.inc
+++ b/math/libm-test-isinf.inc
@@ -33,8 +33,10 @@ static const struct test_f_i_data isinf_test_data[] =
     TEST_f_b (isinf, minus_infty, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isinf, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isinf, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_b (isinf, snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isinf, -snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 #if TEST_COND_intel96
diff --git a/math/libm-test-isnan.inc b/math/libm-test-isnan.inc
index 026b61c216..2edfd7c62d 100644
--- a/math/libm-test-isnan.inc
+++ b/math/libm-test-isnan.inc
@@ -33,8 +33,10 @@ static const struct test_f_i_data isnan_test_data[] =
     TEST_f_b (isnan, minus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isnan, qnan_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isnan, -qnan_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_b (isnan, snan_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isnan, -snan_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 #if TEST_COND_intel96
diff --git a/math/libm-test-isnormal.inc b/math/libm-test-isnormal.inc
index e1e8a3b270..e4f6a8f74c 100644
--- a/math/libm-test-isnormal.inc
+++ b/math/libm-test-isnormal.inc
@@ -33,8 +33,10 @@ static const struct test_f_i_data isnormal_test_data[] =
     TEST_f_b (isnormal, minus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isnormal, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isnormal, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_b (isnormal, snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (isnormal, -snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 static void
diff --git a/math/libm-test-issubnormal.inc b/math/libm-test-issubnormal.inc
index 38564f2bcc..cc045435ad 100644
--- a/math/libm-test-issubnormal.inc
+++ b/math/libm-test-issubnormal.inc
@@ -33,8 +33,10 @@ static const struct test_f_i_data issubnormal_test_data[] =
     TEST_f_b (issubnormal, minus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (issubnormal, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (issubnormal, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_b (issubnormal, snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (issubnormal, -snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 static void
diff --git a/math/libm-test-iszero.inc b/math/libm-test-iszero.inc
index cfd3d1fecb..e56eac4e76 100644
--- a/math/libm-test-iszero.inc
+++ b/math/libm-test-iszero.inc
@@ -33,8 +33,10 @@ static const struct test_f_i_data iszero_test_data[] =
     TEST_f_b (iszero, minus_infty, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (iszero, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (iszero, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#ifdef __SUPPORT_SNAN__
     TEST_f_b (iszero, snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_f_b (iszero, -snan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+#endif
   };
 
 static void
diff --git a/math/test-snan.c b/math/test-snan.c
index 4d7bd54ade..fadde89764 100644
--- a/math/test-snan.c
+++ b/math/test-snan.c
@@ -25,8 +25,10 @@
 #include <setjmp.h>
 
 #include <math-tests.h>
+#include <support/check.h>
 
 
+#ifdef __SUPPORT_SNAN__
 static sigjmp_buf sigfpe_buf;
 
 static void
@@ -123,10 +125,12 @@ NAME (void)								      \
 TEST_FUNC (float_test, float, f)
 TEST_FUNC (double_test, double, )
 TEST_FUNC (ldouble_test, long double, l)
+#endif
 
 static int
 do_test (void)
 {
+#ifdef __SUPPORT_SNAN__
   signal (SIGFPE, &myFPsighandler);
 
   float_test ();
@@ -134,7 +138,9 @@ do_test (void)
   ldouble_test ();
 
   return errors != 0;
+#else
+  FAIL_UNSUPPORTED ("compiler does not support -fsignaling-nans");
+#endif
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>