This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607) [committed]


As noted in bug 21607, NO_LONG_DOUBLE conditionals in libm tests are
no longer effective.  For most this is harmless - they were only
present because of long double functions not being declared with _LIBC
defined, and _LIBC is no longer defined for building most tests.  For
the few where this is actually relevant to the test, testing
LDBL_MANT_DIG > DBL_MANT_DIG is more appropriate as that limits the
test to public APIs.  This patch fixes the tests accordingly.

Tested for x86_64 and arm.  Committed.

2017-06-28  Joseph Myers  <joseph@codesourcery.com>

	[BZ #21607]
	* math/basic-test.c [!NO_LONG_DOUBLE]: Change conditionals to
	[LDBL_MANT_DIG > DBL_MANT_DIG].
	* math/bug-nextafter.c [!NO_LONG_DOUBLE]: Remove conditionals.
	* math/bug-nexttoward.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-math-isinff.cc [!NO_LONG_DOUBLE]: Likewise.
	* math/test-math-iszero.cc [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nan-overflow.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nan-payload.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nearbyint-except-2.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-nearbyint-except.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-powl.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-signgam-finite-c99.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-signgam-finite.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-signgam-main.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-snan.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-tgmath-ret.c [!NO_LONG_DOUBLE]: Likewise.
	* math/test-tgmath.c: Include <float.h>.
	[!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
	DBL_MANT_DIG].
	* math/test-tgmath2.c: Include <float.h>.
	[!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
	DBL_MANT_DIG].

diff --git a/math/basic-test.c b/math/basic-test.c
index 43badbc..f17d374 100644
--- a/math/basic-test.c
+++ b/math/basic-test.c
@@ -191,7 +191,7 @@ TEST_FUNC (float_test, float, f, FLT_EPSILON, HUGE_VALF)
 TEST_FUNC (double_test, double, , DBL_EPSILON, HUGE_VAL)
 TEST_CONVERT (convert_dfsf_test, float, double, )
 TEST_CONVERT (convert_sfdf_test, double, float, f)
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 TEST_FUNC (ldouble_test, long double, l, LDBL_EPSILON, HUGE_VALL)
 TEST_CONVERT (convert_tfsf_test, float, long double, l)
 TEST_CONVERT (convert_sftf_test, long double, float, f)
@@ -207,7 +207,7 @@ do_test (void)
   convert_dfsf_test();
   convert_sfdf_test();
 
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
   ldouble_test ();
   convert_tfsf_test();
   convert_sftf_test();
diff --git a/math/bug-nextafter.c b/math/bug-nextafter.c
index d48bca2..6d7212e 100644
--- a/math/bug-nextafter.c
+++ b/math/bug-nextafter.c
@@ -219,7 +219,6 @@ main (void)
       ++result;
     }
 
-#ifndef NO_LONG_DOUBLE
   long double li = INFINITY;
   long double lm = LDBL_MAX;
   feclearexcept (FE_ALL_EXCEPT);
@@ -319,7 +318,6 @@ main (void)
       puts ("nextafterl- did not underflow");
       ++result;
     }
-#endif
 
   return result;
 }
diff --git a/math/bug-nexttoward.c b/math/bug-nexttoward.c
index c42bc35..fc57e50 100644
--- a/math/bug-nexttoward.c
+++ b/math/bug-nexttoward.c
@@ -221,7 +221,6 @@ main (void)
       ++result;
     }
 
-#ifndef NO_LONG_DOUBLE
   long double li = INFINITY;
   long double lm = LDBL_MAX;
   feclearexcept (FE_ALL_EXCEPT);
@@ -321,7 +320,6 @@ main (void)
       puts ("nexttowardl- did not underflow");
       ++result;
     }
-#endif
 
   return result;
 }
diff --git a/math/test-math-isinff.cc b/math/test-math-isinff.cc
index 39d8dab..30728be 100644
--- a/math/test-math-isinff.cc
+++ b/math/test-math-isinff.cc
@@ -30,16 +30,12 @@ do_test (void)
      header fix this test will not compile.  */
   if (isinff (1.0f)
       || !isinff (INFINITY)
-#ifndef NO_LONG_DOUBLE
       || isinfl (1.0L)
       || !isinfl (INFINITY)
-#endif
       || isnanf (2.0f)
       || !isnanf (NAN)
-#ifndef NO_LONG_DOUBLE
       || isnanl (2.0L)
       || !isnanl (NAN)
-#endif
       )
     {
       printf ("FAIL: Failed to call is* functions.\n");
diff --git a/math/test-math-iszero.cc b/math/test-math-iszero.cc
index fe97005..027e972 100644
--- a/math/test-math-iszero.cc
+++ b/math/test-math-iszero.cc
@@ -77,9 +77,7 @@ do_test (void)
 {
   check_type<float> ();
   check_type<double> ();
-#ifndef NO_LONG_DOUBLE
   check_type<long double> ();
-#endif
   return errors;
 }
 
diff --git a/math/test-nan-overflow.c b/math/test-nan-overflow.c
index 62e5dd4..7ffeef2 100644
--- a/math/test-nan-overflow.c
+++ b/math/test-nan-overflow.c
@@ -57,9 +57,7 @@ do_test (void)
   while (0)
   NAN_TEST (float, nanf);
   NAN_TEST (double, nan);
-#ifndef NO_LONG_DOUBLE
   NAN_TEST (long double, nanl);
-#endif
   return result;
 }
 
diff --git a/math/test-nan-payload.c b/math/test-nan-payload.c
index 9a86394..a9d8fed 100644
--- a/math/test-nan-payload.c
+++ b/math/test-nan-payload.c
@@ -112,9 +112,7 @@ do_test (void)
   int result = 0;
   RUN_TESTS (float, strtof, nanf, FLT_MANT_DIG);
   RUN_TESTS (double, strtod, nan, DBL_MANT_DIG);
-#ifndef NO_LONG_DOUBLE
   RUN_TESTS (long double, strtold, nanl, LDBL_MANT_DIG);
-#endif
   return result;
 }
 
diff --git a/math/test-nearbyint-except-2.c b/math/test-nearbyint-except-2.c
index 217b6ad..43de189 100644
--- a/math/test-nearbyint-except-2.c
+++ b/math/test-nearbyint-except-2.c
@@ -46,9 +46,7 @@ NAME (void)								\
 
 TEST_FUNC (float_test, float, f)
 TEST_FUNC (double_test, double, )
-#ifndef NO_LONG_DOUBLE
 TEST_FUNC (ldouble_test, long double, l)
-#endif
 
 static int
 do_test (void)
@@ -61,10 +59,8 @@ do_test (void)
   int result = float_test ();
   feenableexcept (FE_INEXACT);
   result |= double_test ();
-#ifndef NO_LONG_DOUBLE
   feenableexcept (FE_INEXACT);
   result |= ldouble_test ();
-#endif
   return result;
 }
 
diff --git a/math/test-nearbyint-except.c b/math/test-nearbyint-except.c
index e33846c..16daaf8 100644
--- a/math/test-nearbyint-except.c
+++ b/math/test-nearbyint-except.c
@@ -69,18 +69,14 @@ NAME (void)								\
 
 TEST_FUNC (float_test, float, f)
 TEST_FUNC (double_test, double, )
-#ifndef NO_LONG_DOUBLE
 TEST_FUNC (ldouble_test, long double, l)
-#endif
 
 static int
 do_test (void)
 {
   int result = float_test ();
   result |= double_test ();
-#ifndef NO_LONG_DOUBLE
   result |= ldouble_test ();
-#endif
   if (!any_supported)
     return 77;
   return result;
diff --git a/math/test-powl.c b/math/test-powl.c
index 081e420..96c8944 100644
--- a/math/test-powl.c
+++ b/math/test-powl.c
@@ -26,8 +26,7 @@ do_test (void)
 {
   int result = 0;
 
-#ifndef NO_LONG_DOUBLE
-# if LDBL_MANT_DIG == 64
+#if LDBL_MANT_DIG == 64
     {
       long double x = 1e-20;
       union ieee854_long_double u;
@@ -43,7 +42,6 @@ do_test (void)
 	  result = 1;
 	}
     }
-# endif
 #endif
 
   return result;
diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c
index 3dacef5..07fdcda 100644
--- a/math/test-signgam-finite-c99.c
+++ b/math/test-signgam-finite-c99.c
@@ -59,8 +59,6 @@ main (void)
   int result = 0;
   RUN_TESTS (lgammaf, float);
   RUN_TESTS (lgamma, double);
-#ifndef NO_LONG_DOUBLE
   RUN_TESTS (lgammal, long double);
-#endif
   return result;
 }
diff --git a/math/test-signgam-finite.c b/math/test-signgam-finite.c
index f24ac8a..df194e2 100644
--- a/math/test-signgam-finite.c
+++ b/math/test-signgam-finite.c
@@ -54,10 +54,8 @@ do_test (void)
   RUN_TESTS (gammaf, float);
   RUN_TESTS (lgamma, double);
   RUN_TESTS (gamma, double);
-#ifndef NO_LONG_DOUBLE
   RUN_TESTS (lgammal, long double);
   RUN_TESTS (gammal, long double);
-#endif
   return result;
 }
 
diff --git a/math/test-signgam-main.c b/math/test-signgam-main.c
index e3cecf7..81b6ffb 100644
--- a/math/test-signgam-main.c
+++ b/math/test-signgam-main.c
@@ -64,8 +64,6 @@ main (void)
   int result = 0;
   RUN_TESTS (lgammaf, float);
   RUN_TESTS (lgamma, double);
-#ifndef NO_LONG_DOUBLE
   RUN_TESTS (lgammal, long double);
-#endif
   return result;
 }
diff --git a/math/test-snan.c b/math/test-snan.c
index ffc8bf4..41037af 100644
--- a/math/test-snan.c
+++ b/math/test-snan.c
@@ -123,9 +123,7 @@ NAME (void)								      \
 
 TEST_FUNC (float_test, float, f)
 TEST_FUNC (double_test, double, )
-#ifndef NO_LONG_DOUBLE
 TEST_FUNC (ldouble_test, long double, l)
-#endif
 
 static int
 do_test (void)
@@ -134,9 +132,7 @@ do_test (void)
 
   float_test ();
   double_test ();
-#ifndef NO_LONG_DOUBLE
   ldouble_test ();
-#endif
 
   return errors != 0;
 }
diff --git a/math/test-tgmath-ret.c b/math/test-tgmath-ret.c
index 89c7f53..84f81b4 100644
--- a/math/test-tgmath-ret.c
+++ b/math/test-tgmath-ret.c
@@ -47,12 +47,8 @@ our_error (const char *c)
   CHECK_RET_CONST_TYPE (func, rettype, fx, float, ## __VA_ARGS__)
 #define CHECK_RET_CONST_DOUBLE(func, rettype, ...)			\
   CHECK_RET_CONST_TYPE (func, rettype, dx, double, ## __VA_ARGS__)
-#ifdef NO_LONG_DOUBLE
-# define CHECK_RET_CONST_LDOUBLE(func, rettype, ...)
-#else
-# define CHECK_RET_CONST_LDOUBLE(func, rettype, ...)			\
+#define CHECK_RET_CONST_LDOUBLE(func, rettype, ...)			\
   CHECK_RET_CONST_TYPE (func, rettype, lx, long double, ## __VA_ARGS__)
-#endif
 
 #define CHECK_RET_CONST(func, rettype, ...)			\
 static void							\
diff --git a/math/test-tgmath.c b/math/test-tgmath.c
index b38138b..dc24cd6 100644
--- a/math/test-tgmath.c
+++ b/math/test-tgmath.c
@@ -21,6 +21,7 @@
 #ifndef HAVE_MAIN
 #undef __NO_MATH_INLINES
 #define __NO_MATH_INLINES 1
+#include <float.h>
 #include <math.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -30,7 +31,7 @@
 
 static void compile_test (void);
 static void compile_testf (void);
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 static void compile_testl (void);
 #endif
 
@@ -135,7 +136,7 @@ do_test (void)
       result = 1;
     }
 
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
   count_float = count_double = count_ldouble = 0;
   count_cfloat = count_cdouble = count_cldouble = 0;
   compile_testl ();
@@ -200,7 +201,7 @@ do_test (void)
 #define ccount count_cfloat
 #include "test-tgmath.c"
 
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 #define F(name) name##l
 #define TYPE long double
 #define x lx
diff --git a/math/test-tgmath2.c b/math/test-tgmath2.c
index 518849d..3ff2735 100644
--- a/math/test-tgmath2.c
+++ b/math/test-tgmath2.c
@@ -20,6 +20,7 @@
 #ifndef HAVE_MAIN
 #undef __NO_MATH_INLINES
 #define __NO_MATH_INLINES 1
+#include <float.h>
 #include <math.h>
 #include <complex.h>
 #include <stdio.h>
@@ -30,7 +31,7 @@
 
 typedef complex float cfloat;
 typedef complex double cdouble;
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 typedef long double ldouble;
 typedef complex long double cldouble;
 #else
@@ -62,7 +63,7 @@ enum
     Tcfloat,
     Tdouble,
     Tcdouble,
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
     Tldouble,
     Tcldouble,
 #else
@@ -470,7 +471,7 @@ do_test (void)
 #define C Tcfloat
 #include "test-tgmath2.c"
 
-#ifndef NO_LONG_DOUBLE
+#if LDBL_MANT_DIG > DBL_MANT_DIG
 #define F(name) name##l
 #define TYPE ldouble
 #define CTYPE cldouble

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]