]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 28 Jun 2017 16:01:20 +0000 (16:01 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 28 Jun 2017 16:01:20 +0000 (16:01 +0000)
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.

[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].

18 files changed:
ChangeLog
math/basic-test.c
math/bug-nextafter.c
math/bug-nexttoward.c
math/test-math-isinff.cc
math/test-math-iszero.cc
math/test-nan-overflow.c
math/test-nan-payload.c
math/test-nearbyint-except-2.c
math/test-nearbyint-except.c
math/test-powl.c
math/test-signgam-finite-c99.c
math/test-signgam-finite.c
math/test-signgam-main.c
math/test-snan.c
math/test-tgmath-ret.c
math/test-tgmath.c
math/test-tgmath2.c

index b5a6a7a9d161cded8a72d06c1c95d42ee06e40fc..880486dbecdfdde47a6b93dfa811c6f440b67da6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 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].
+
        * math/gen-tgmath-tests.py: New file.
        * math/Makefile [PYTHON] (tests): Add test-tgmath3.
        [PYTHON] (generated): Add test-tgmath3.c.
index 43badbc6aa0e87a846b4f221d6f92318a3f261c4..f17d374ade09e885c1f0392f44d8d4cfdb91ab03 100644 (file)
@@ -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();
index d48bca288d63f001a6ee82dbe70f5b11256145e5..6d7212ec6ad2a44ef5365fd87e80350fd3f105a2 100644 (file)
@@ -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;
 }
index c42bc35767866a596913f410c657f437d98f046a..fc57e50d317fe6490070883d94699605435a4c32 100644 (file)
@@ -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;
 }
index 39d8dabeea7338528af83467c0ff4efb45639f22..30728bede4f97eaa935878f9741e824acdc08df5 100644 (file)
@@ -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");
index fe9700527c4b16b9bd4814b2a03f2dbf0542f92e..027e9726543880ff806391e5231af981a0c5f3ff 100644 (file)
@@ -77,9 +77,7 @@ do_test (void)
 {
   check_type<float> ();
   check_type<double> ();
-#ifndef NO_LONG_DOUBLE
   check_type<long double> ();
-#endif
   return errors;
 }
 
index 62e5dd426501901be80ff47b6133b8c71cedc7b8..7ffeef2dc16c3fabbd4169ab46f8126d6bf5ba75 100644 (file)
@@ -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;
 }
 
index 9a86394153604ae138d349ba6c7e905bd698dd10..a9d8fede003895ec7bd5a84047fbba1f5242acd8 100644 (file)
@@ -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;
 }
 
index 217b6ad2e9b3e0c226b8ec256f87c41e12cf4e99..43de189ffea0ed0c23a5b9540116ecf1c9a15aeb 100644 (file)
@@ -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;
 }
 
index e33846c1d0974c89af96e1dcaf06188a237ddbd2..16daaf82c93631cd43c0d1fe8b447eb9d0333ce4 100644 (file)
@@ -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;
index 081e4201252154a0eb9b3afafc0d192c0d983e23..96c894466e35006416a13802ed090bcfafb4cc3f 100644 (file)
@@ -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;
index 3dacef5147f23a4fb8aee494ad462e79a87d3e2e..07fdcda9b385a7c57dbafb7ce225f19183e5a19a 100644 (file)
@@ -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;
 }
index f24ac8a275c8ba9c9c6cb27f3473eff60f1c605e..df194e216fb43af5feb308b27de4b0324b74eb52 100644 (file)
@@ -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;
 }
 
index e3cecf7fa131f5d5922bbf943eee71763f3410f6..81b6ffb7c182c49fae487c515520ecd2c15885b4 100644 (file)
@@ -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;
 }
index ffc8bf4bcaa54bb0698b887fc53c387171258b00..41037afed4ccd510ee61732787bf389e58d67b60 100644 (file)
@@ -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;
 }
index 89c7f5337d05ddc0de1a38f115f5f47249474511..84f81b4db06f40573af3ac50c63c8757fcdaa063 100644 (file)
@@ -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                                                    \
index b38138b764ee1d7d2da501fc10468e6a2ee4b3ee..dc24cd64f5c0c1ea7e8b5e0ef947446b125ee7f5 100644 (file)
@@ -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
index 518849d4975a1cdf20fe569ba3d8fe16ba511cb4..3ff27353d856bd78429320e0cbb503ff7ef3a29e 100644 (file)
@@ -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