about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-06-12 12:41:25 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-06-12 12:41:25 +0000
commit94f2c076692a5a4beaa9a85eb10dbe4d891acb1e (patch)
tree48e2f584064a6ed75bfa90cdb66d2d6ce71924c7
parente0e50a0a31ff04c325513ade44197f8ae8dd324b (diff)
downloadglibc-94f2c076692a5a4beaa9a85eb10dbe4d891acb1e.tar.gz
glibc-94f2c076692a5a4beaa9a85eb10dbe4d891acb1e.tar.xz
glibc-94f2c076692a5a4beaa9a85eb10dbe4d891acb1e.zip
Make more libm tests condition exceptions tests with math-tests.h.
-rw-r--r--ChangeLog12
-rw-r--r--math/bug-nextafter.c49
-rw-r--r--math/bug-nexttoward.c49
-rw-r--r--math/test-misc.c7
4 files changed, 66 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e1a9ce4cb..d38c96a9e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-06-12  Joseph Myers  <joseph@codesourcery.com>
+
+	* math/bug-nextafter.c: Include <math-tests.h>.
+	(main): Only test for exceptions if EXCEPTION_TESTS is true for
+	the relevant type.
+	* math/bug-nexttoward.c: Include <math-tests.h>.
+	(main): Only test for exceptions if EXCEPTION_TESTS is true for
+	the relevant type.
+	* math/test-misc.c: Include <math-tests.h>.
+	(main): Only test for exceptions if EXCEPTION_TESTS is true for
+	the relevant type.
+
 2013-06-12  Andreas Jaeger  <aj@suse.de>
 
 	* po/ia.po: Update Interlingua translation from translation
diff --git a/math/bug-nextafter.c b/math/bug-nextafter.c
index 558b158391..d48bca288d 100644
--- a/math/bug-nextafter.c
+++ b/math/bug-nextafter.c
@@ -3,6 +3,7 @@
 #include <float.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <math-tests.h>
 
 #if !defined(FE_OVERFLOW) && !defined(FE_UNDERFLOW)
 /* If there's no support for the exceptions this test is checking,
@@ -26,7 +27,7 @@ main (void)
       puts ("nextafterf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nextafterf+ did not overflow");
       ++result;
@@ -37,7 +38,7 @@ main (void)
       puts ("nextafterf- failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nextafterf- did not overflow");
       ++result;
@@ -52,7 +53,7 @@ main (void)
       puts ("nextafterf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterf+ did not underflow");
       ++result;
@@ -65,7 +66,7 @@ main (void)
       puts ("nextafterf- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterf- did not underflow");
       ++result;
@@ -78,7 +79,7 @@ main (void)
       puts ("nextafterf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterf+ did not underflow");
       ++result;
@@ -89,7 +90,7 @@ main (void)
       puts ("nextafterf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterf+ did not underflow");
       ++result;
@@ -101,7 +102,7 @@ main (void)
       puts ("nextafterf- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterf- did not underflow");
       ++result;
@@ -112,7 +113,7 @@ main (void)
       puts ("nextafterf- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterf- did not underflow");
       ++result;
@@ -126,7 +127,7 @@ main (void)
       puts ("nextafter+ failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nextafter+ did not overflow");
       ++result;
@@ -137,7 +138,7 @@ main (void)
       puts ("nextafter failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nextafter- did not overflow");
       ++result;
@@ -152,7 +153,7 @@ main (void)
       puts ("nextafter+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafter+ did not underflow");
       ++result;
@@ -165,7 +166,7 @@ main (void)
       puts ("nextafter- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafter- did not underflow");
       ++result;
@@ -178,7 +179,7 @@ main (void)
       puts ("nextafter+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafter+ did not underflow");
       ++result;
@@ -189,7 +190,7 @@ main (void)
       puts ("nextafter+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafter+ did not underflow");
       ++result;
@@ -201,7 +202,7 @@ main (void)
       puts ("nextafter- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafter- did not underflow");
       ++result;
@@ -212,7 +213,7 @@ main (void)
       puts ("nextafter- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafter- did not underflow");
       ++result;
@@ -227,7 +228,7 @@ main (void)
       puts ("nextafterl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nextafterl+ did not overflow");
       ++result;
@@ -238,7 +239,7 @@ main (void)
       puts ("nextafterl failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nextafterl- did not overflow");
       ++result;
@@ -253,7 +254,7 @@ main (void)
       puts ("nextafterl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterl+ did not underflow");
       ++result;
@@ -266,7 +267,7 @@ main (void)
       puts ("nextafterl- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterl- did not underflow");
       ++result;
@@ -279,7 +280,7 @@ main (void)
       puts ("nextafterl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterl+ did not underflow");
       ++result;
@@ -290,7 +291,7 @@ main (void)
       puts ("nextafterl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterl+ did not underflow");
       ++result;
@@ -302,7 +303,7 @@ main (void)
       puts ("nextafterl- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterl- did not underflow");
       ++result;
@@ -313,7 +314,7 @@ main (void)
       puts ("nextafterl- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nextafterl- did not underflow");
       ++result;
diff --git a/math/bug-nexttoward.c b/math/bug-nexttoward.c
index cedb7767b6..c42bc35767 100644
--- a/math/bug-nexttoward.c
+++ b/math/bug-nexttoward.c
@@ -3,6 +3,7 @@
 #include <float.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <math-tests.h>
 
 #if !defined(FE_OVERFLOW) && !defined(FE_UNDERFLOW)
 /* If there's no support for the exceptions this test is checking,
@@ -27,7 +28,7 @@ main (void)
       puts ("nexttowardf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nexttowardf+ did not overflow");
       ++result;
@@ -38,7 +39,7 @@ main (void)
       puts ("nexttowardf- failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nexttowardf- did not overflow");
       ++result;
@@ -53,7 +54,7 @@ main (void)
       puts ("nexttowardf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardf+ did not underflow");
       ++result;
@@ -66,7 +67,7 @@ main (void)
       puts ("nexttowardf- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardf- did not underflow");
       ++result;
@@ -79,7 +80,7 @@ main (void)
       puts ("nexttowardf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardf+ did not underflow");
       ++result;
@@ -90,7 +91,7 @@ main (void)
       puts ("nexttowardf+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardf+ did not underflow");
       ++result;
@@ -102,7 +103,7 @@ main (void)
       puts ("nexttowardf- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardf- did not underflow");
       ++result;
@@ -113,7 +114,7 @@ main (void)
       puts ("nexttowardf- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (float) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardf- did not underflow");
       ++result;
@@ -128,7 +129,7 @@ main (void)
       puts ("nexttoward+ failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nexttoward+ did not overflow");
       ++result;
@@ -139,7 +140,7 @@ main (void)
       puts ("nexttoward- failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nexttoward- did not overflow");
       ++result;
@@ -154,7 +155,7 @@ main (void)
       puts ("nexttoward+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttoward+ did not underflow");
       ++result;
@@ -167,7 +168,7 @@ main (void)
       puts ("nexttoward- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttoward- did not underflow");
       ++result;
@@ -180,7 +181,7 @@ main (void)
       puts ("nexttoward+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttoward+ did not underflow");
       ++result;
@@ -191,7 +192,7 @@ main (void)
       puts ("nexttoward+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttoward+ did not underflow");
       ++result;
@@ -203,7 +204,7 @@ main (void)
       puts ("nexttoward- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttoward- did not underflow");
       ++result;
@@ -214,7 +215,7 @@ main (void)
       puts ("nexttoward- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttoward- did not underflow");
       ++result;
@@ -229,7 +230,7 @@ main (void)
       puts ("nexttowardl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nexttowardl+ did not overflow");
       ++result;
@@ -240,7 +241,7 @@ main (void)
       puts ("nexttowardl failed");
       ++result;
     }
-  if (fetestexcept (FE_OVERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_OVERFLOW) == 0)
     {
       puts ("nexttowardl- did not overflow");
       ++result;
@@ -255,7 +256,7 @@ main (void)
       puts ("nexttowardl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardl+ did not underflow");
       ++result;
@@ -268,7 +269,7 @@ main (void)
       puts ("nexttowardl- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardl- did not underflow");
       ++result;
@@ -281,7 +282,7 @@ main (void)
       puts ("nexttowardl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardl+ did not underflow");
       ++result;
@@ -292,7 +293,7 @@ main (void)
       puts ("nexttowardl+ failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardl+ did not underflow");
       ++result;
@@ -304,7 +305,7 @@ main (void)
       puts ("nexttowardl- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardl- did not underflow");
       ++result;
@@ -315,7 +316,7 @@ main (void)
       puts ("nexttowardl- failed");
       ++result;
     }
-  if (fetestexcept (FE_UNDERFLOW) == 0)
+  if (EXCEPTION_TESTS (long double) && fetestexcept (FE_UNDERFLOW) == 0)
     {
       puts ("nexttowardl- did not underflow");
       ++result;
diff --git a/math/test-misc.c b/math/test-misc.c
index c13bafa117..94c7c1531f 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -22,6 +22,7 @@
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
+#include <math-tests.h>
 
 
 int
@@ -1188,7 +1189,7 @@ main (void)
   f2 += f1;
 #if defined(FE_OVERFLOW) && defined(FE_INEXACT)
   int fe = fetestexcept (FE_ALL_EXCEPT);
-  if (fe != (FE_OVERFLOW | FE_INEXACT))
+  if (EXCEPTION_TESTS (float) && fe != (FE_OVERFLOW | FE_INEXACT))
     {
       printf ("float overflow test failed: %x\n", fe);
       result = 1;
@@ -1203,7 +1204,7 @@ main (void)
   d2 += d1;
 #if defined(FE_OVERFLOW) && defined(FE_INEXACT)
   fe = fetestexcept (FE_ALL_EXCEPT);
-  if (fe != (FE_OVERFLOW | FE_INEXACT))
+  if (EXCEPTION_TESTS (double) && fe != (FE_OVERFLOW | FE_INEXACT))
     {
       printf ("double overflow test failed: %x\n", fe);
       result = 1;
@@ -1219,7 +1220,7 @@ main (void)
   ld2 += ld1;
 # if defined(FE_OVERFLOW) && defined(FE_INEXACT)
   fe = fetestexcept (FE_ALL_EXCEPT);
-  if (fe != (FE_OVERFLOW | FE_INEXACT))
+  if (EXCEPTION_TESTS (long double) && fe != (FE_OVERFLOW | FE_INEXACT))
     {
       printf ("long double overflow test failed: %x\n", fe);
       result = 1;