aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-06-28 16:01:20 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-06-28 16:01:20 +0000
commit51737193a9810ceb1c516a2a71444fa70bcf8500 (patch)
treea8afcc09879d8dcea321bf5e38bf270f5f937922
parent2dd0aec531ad03e8e1642f8642930451b23fe2ba (diff)
downloadglibc-51737193a9810ceb1c516a2a71444fa70bcf8500.tar
glibc-51737193a9810ceb1c516a2a71444fa70bcf8500.tar.gz
glibc-51737193a9810ceb1c516a2a71444fa70bcf8500.tar.bz2
glibc-51737193a9810ceb1c516a2a71444fa70bcf8500.zip
Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).
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].
-rw-r--r--ChangeLog24
-rw-r--r--math/basic-test.c4
-rw-r--r--math/bug-nextafter.c2
-rw-r--r--math/bug-nexttoward.c2
-rw-r--r--math/test-math-isinff.cc4
-rw-r--r--math/test-math-iszero.cc2
-rw-r--r--math/test-nan-overflow.c2
-rw-r--r--math/test-nan-payload.c2
-rw-r--r--math/test-nearbyint-except-2.c4
-rw-r--r--math/test-nearbyint-except.c4
-rw-r--r--math/test-powl.c4
-rw-r--r--math/test-signgam-finite-c99.c2
-rw-r--r--math/test-signgam-finite.c2
-rw-r--r--math/test-signgam-main.c2
-rw-r--r--math/test-snan.c4
-rw-r--r--math/test-tgmath-ret.c6
-rw-r--r--math/test-tgmath.c7
-rw-r--r--math/test-tgmath2.c7
18 files changed, 36 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index b5a6a7a9d1..880486dbec 100644
--- 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.
diff --git a/math/basic-test.c b/math/basic-test.c
index 43badbc6aa..f17d374ade 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 d48bca288d..6d7212ec6a 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 c42bc35767..fc57e50d31 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 39d8dabeea..30728bede4 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 fe9700527c..027e972654 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 62e5dd4265..7ffeef2dc1 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 9a86394153..a9d8fede00 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 217b6ad2e9..43de189ffe 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 e33846c1d0..16daaf82c9 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 081e420125..96c894466e 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 3dacef5147..07fdcda9b3 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 f24ac8a275..df194e216f 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 e3cecf7fa1..81b6ffb7c1 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 ffc8bf4bca..41037afed4 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 89c7f5337d..84f81b4db0 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 b38138b764..dc24cd64f5 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 518849d497..3ff27353d8 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