Patchwork [2/2] Remove math-finite.h

login
register
mail settings
Submitter Wilco Dijkstra
Date May 24, 2019, 10:31 a.m.
Message ID <VI1PR0801MB21279FB1B7ED049AF7CEC1C383010@VI1PR0801MB2127.eurprd08.prod.outlook.com>
Download mbox | patch
Permalink /patch/32844/
State New
Headers show

Comments

Wilco Dijkstra - May 24, 2019, 10:31 a.m.
Part 2 removes the finite-math tests from the testsuite - these are no 
longer useful after removing math-finite.h header.

Passes buildmanyglibc.

2019-05-13  Wilco Dijkstra  <wdijkstr@arm.com>

        * math/Makefile: Update to remove finite-math tests.
        * math/gen-libm-test.py: Remove setting of NON_FINITE.
        * math/libm-test-driver.c: Remove TEST_FINITE, flag_test_finite.
        * math/libm-test-support.h: Remove flag_test_finite declartion.
        * math/libm-test-support.c: Remove NON_FINITE support.
        * math/test-finite-macros.c: Remove file.
        * math/test-math-finite.h: Likewise.
        * math/test-math-inline.h: Remove TEST_FINITE.
        * math/test-math-no-finite.h : Remove file.
        * math/test-math-vector.h: Remove TEST_FINITE.
	* math/test-signgam-finite.c: Remove test.
        * math/test-signgam-finite-c11.c: Likewise.
        * math/test-signgam-finite-c99.c: Likewise.

--

Patch

diff --git a/math/Makefile b/math/Makefile
index 8d754ed02c4e60dc9becc63e2b604e8c0d6557f7..d6eb0c430afd1586a7bcf9ebdb6e3c841dc2839e 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -228,8 +228,7 @@  tests = test-matherr-3 test-fenv basic-test \
 	test-tgmath-ret bug-nextafter bug-nexttoward bug-tgmath1 \
 	test-tgmath-int test-tgmath2 test-powl tst-CMPLX tst-CMPLX2 test-snan \
 	test-fenv-tls test-fenv-preserve test-fenv-return test-fenvinline \
-	test-nearbyint-except test-fenv-clear test-signgam-finite \
-	test-signgam-finite-c99 test-signgam-finite-c11 \
+	test-nearbyint-except test-fenv-clear \
 	test-nearbyint-except-2 test-signgam-uchar test-signgam-uchar-init \
 	test-signgam-uint test-signgam-uint-init test-signgam-ullong \
 	test-signgam-ullong-init test-nan-overflow test-nan-payload \
@@ -238,7 +237,7 @@  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-finite-macros test-narrow-macros \
+	test-fe-snans-always-signal test-narrow-macros \
 	test-nan-const $(tests-static)
 tests-static = test-fpucw-static test-fpucw-ieee-static \
 	       test-signgam-uchar-static test-signgam-uchar-init-static \
@@ -297,17 +296,13 @@  generated += libm-test-ulps.h $(libm-test-c-auto) $(libm-test-c-noauto) \
 	     $(libm-test-c-narrow)
 
 libm-tests-base-normal = $(foreach t,$(test-types),test-$(t))
-libm-tests-base-finite = $(foreach t,$(test-types),test-$(t)-finite)
 libm-tests-base-inline = $(foreach t,$(test-types),test-i$(t))
 libm-tests-base-narrow = $(foreach t,$(test-type-pairs),test-$(t))
-libm-tests-base = $(libm-tests-base-normal) $(libm-tests-base-finite) \
-		  $(libm-tests-base-inline) $(libm-vec-tests)
+libm-tests-base = $(libm-tests-base-normal) $(libm-tests-base-inline) \
+		  $(libm-vec-tests)
 libm-tests-normal = $(foreach t,$(libm-tests-base-normal),\
 				$(foreach f,$(libm-test-funcs-all),\
 					    $(t)-$(f)))
-libm-tests-finite = $(foreach t,$(libm-tests-base-finite),\
-				$(foreach f,$(libm-test-funcs-all),\
-					    $(t)-$(f)))
 libm-tests-inline = $(foreach t,$(libm-tests-base-inline),\
 				$(foreach f,$(libm-test-funcs-all),\
 					    $(t)-$(f)))
@@ -316,11 +311,10 @@  libm-tests-narrow = $(foreach t,$(libm-tests-base-narrow),\
 					    $(t)-$(f)))
 libm-tests-vector = $(foreach t,$(libmvec-tests),\
 				$(foreach f,$($(t)-funcs),test-$(t)-$(f)))
-libm-tests = $(libm-tests-normal) $(libm-tests-finite) $(libm-tests-inline) \
+libm-tests = $(libm-tests-normal) $(libm-tests-inline) \
 	     $(libm-tests-narrow) $(libm-tests-vector)
 libm-tests-for-type = $(foreach f,$(libm-test-funcs-all),\
-				  test-$(1)-$(f) test-$(1)-finite-$(f) \
-				  test-i$(1)-$(f)) \
+				  test-$(1)-$(f) test-i$(1)-$(f)) \
 		      $(filter test-$(1)-%,$(libm-tests-vector) \
 					   $(libm-tests-narrow))
 
@@ -398,8 +392,6 @@  CFLAGS-test-float-vlen16-wrappers.c += $(float-vlen16-arch-ext-cflags)
 # validated.
 libm-test-no-inline-cflags = -fno-inline -ffloat-store -fno-builtin \
 			     -fsignaling-nans
-libm-test-finite-cflags = $(libm-test-no-inline-cflags) \
-			  -U__FINITE_MATH_ONLY__ -D__FINITE_MATH_ONLY__=1
 libm-test-inline-cflags = $(libm-test-fast-math-cflags)
 CFLAGS-test-tgmath.c += -fno-builtin
 # The following testcase uses very long lines (>3 million), so it may take a
@@ -411,9 +403,6 @@  CFLAGS-test-powl.c += -fno-builtin
 
 CFLAGS-test-snan.c += -fsignaling-nans
 
-CFLAGS-test-signgam-finite.c += -ffinite-math-only
-CFLAGS-test-signgam-finite-c99.c += -ffinite-math-only -std=c99
-CFLAGS-test-signgam-finite-c11.c += -ffinite-math-only -std=c11
 CFLAGS-test-signgam-uchar.c += -std=c99
 CFLAGS-test-signgam-uchar-init.c += -std=c99
 CFLAGS-test-signgam-uchar-static.c += -std=c99
@@ -440,8 +429,6 @@  CFLAGS-test-flt-eval-method.c += -fexcess-precision=standard
 
 CFLAGS-test-fe-snans-always-signal.c += -fsignaling-nans
 
-CFLAGS-test-finite-macros.c += -ffinite-math-only
-
 CFLAGS-test-nan-const.c += -fno-builtin
 
 include ../Rules
@@ -480,25 +467,13 @@  $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
 	func=$${type_func#*-}; \
 	( \
 	  echo "#include <test-$$type.h>"; \
-	  echo "#include <test-math-no-finite.h>"; \
+	  echo "#define TEST_EXCEPTIONS 1"; \
 	  echo "#include <test-math-no-inline.h>"; \
 	  echo "#include <test-math-errno.h>"; \
 	  echo "#include <test-math-scalar.h>"; \
 	  echo "#include <libm-test-$$func.c>"; \
 	) > $@
 
-$(foreach t,$(libm-tests-finite),$(objpfx)$(t).c): $(objpfx)test-%.c:
-	type_func=$*; \
-	type=$${type_func%%-*}; \
-	func=$${type_func#*-finite-}; \
-	( \
-	  echo "#include <test-$$type.h>"; \
-	  echo "#include <test-math-finite.h>"; \
-	  echo "#include <test-math-no-inline.h>"; \
-	  echo "#include <test-math-scalar.h>"; \
-	  echo "#include <libm-test-$$func.c>"; \
-	) > $@
-
 $(foreach t,$(libm-tests-inline),$(objpfx)$(t).c): $(objpfx)test-i%.c:
 	type_func=$*; \
 	type=$${type_func%%-*}; \
@@ -519,7 +494,7 @@  $(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
 	( \
 	  echo "#include <test-$$ret_type.h>"; \
 	  echo "#include <test-arg-$$arg_type.h>"; \
-	  echo "#include <test-math-no-finite.h>"; \
+	  echo "#define TEST_EXCEPTIONS 1"; \
 	  echo "#include <test-math-no-inline.h>"; \
 	  echo "#include <test-math-errno.h>"; \
 	  echo "#include <test-math-narrow.h>"; \
@@ -571,13 +546,6 @@  include $(o-iterator)
 
 define o-iterator-doit
 $(foreach f,$(libm-test-funcs-all),\
-	    $(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-finite-cflags)
-endef
-object-suffixes-left := $(libm-tests-base-finite)
-include $(o-iterator)
-
-define o-iterator-doit
-$(foreach f,$(libm-test-funcs-all),\
 	    $(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-inline-cflags)
 endef
 object-suffixes-left := $(libm-tests-base-inline)
diff --git a/math/gen-libm-test.py b/math/gen-libm-test.py
index 4574215fec7b385b0513f85622f3cdd69c8171ab..b98a69622f5c6988dfa5ccd60e5bf9c2d271849f 100755
--- a/math/gen-libm-test.py
+++ b/math/gen-libm-test.py
@@ -341,9 +341,6 @@  def apply_lit(arg, macro):
 
 def gen_test_args_res(descr_args, descr_res, args, res_rm):
     """Generate a test given the arguments and per-rounding-mode results."""
-    # Determine whether any arguments or results, for any rounding
-    # mode, are non-finite.
-    non_finite = False
     test_snan = False
     all_args_res = list(args)
     for r in res_rm:
@@ -351,10 +348,6 @@  def gen_test_args_res(descr_args, descr_res, args, res_rm):
     for a in all_args_res:
         if 'snan_value' in a:
             test_snan = True
-            non_finite = True
-        elif ('qnan_value' in a or 'plus_infty' in a or 'minus_infty' in a
-              or 'plus_oflow' in a or 'minus_oflow' in a):
-            non_finite = True
     # Process the arguments.
     args_disp = []
     args_c = []
@@ -422,8 +415,6 @@  def gen_test_args_res(descr_args, descr_res, args, res_rm):
         flags = []
         if ignore_result_any:
             flags.append('IGNORE_RESULT')
-        if non_finite:
-            flags.append('NON_FINITE')
         if test_snan:
             flags.append('TEST_SNAN')
         flags.append(res[res_pos])
diff --git a/math/libm-test-driver.c b/math/libm-test-driver.c
index 4640f30d64ae800687c6fe737b43c0d305847eb2..7623df549f86775b85194bbf60ec685cd4a2745f 100644
--- a/math/libm-test-driver.c
+++ b/math/libm-test-driver.c
@@ -23,7 +23,6 @@ 
 /* Flags set by the including file.  */
 const int flag_test_errno = TEST_ERRNO;
 const int flag_test_exceptions = TEST_EXCEPTIONS;
-const int flag_test_finite = TEST_FINITE;
 const int flag_test_inline = TEST_INLINE;
 const int flag_test_mathvec = TEST_MATHVEC;
 
@@ -44,8 +43,6 @@  const int snan_tests_arg = SNAN_TESTS (FLOAT);
 # define TEST_MSG "testing " STR_FLOAT " (vector length " STR_VEC_LEN ")\n"
 #elif TEST_INLINE
 # define TEST_MSG "testing " STR_FLOAT " (inline functions)\n"
-#elif TEST_FINITE
-# define TEST_MSG "testing " STR_FLOAT " (finite-math-only)\n"
 #elif TEST_NARROW
 # define TEST_MSG "testing " STR_FLOAT " (argument " STR_ARG_FLOAT ")\n"
 #else
diff --git a/math/libm-test-support.h b/math/libm-test-support.h
index 2b8d5a3d889a76cc1e678d5db190944d84058cc4..028cf5647027ca5c9c8c7e70f33bd2ea51871afd 100644
--- a/math/libm-test-support.h
+++ b/math/libm-test-support.h
@@ -34,7 +34,6 @@ 
 
 extern const int flag_test_errno;
 extern const int flag_test_exceptions;
-extern const int flag_test_finite;
 extern const int flag_test_inline;
 extern const int flag_test_mathvec;
 extern const int snan_tests_arg;
@@ -69,7 +68,6 @@  extern const char doc[];
 #define ERRNO_ERANGE			0x20000
 /* Flags generated by gen-libm-test.py, not entered here manually.  */
 #define IGNORE_RESULT			0x40000
-#define NON_FINITE			0x80000
 #define TEST_SNAN			0x100000
 #define NO_TEST_MATHVEC			0x200000
 
diff --git a/math/libm-test-support.c b/math/libm-test-support.c
index 5f986da75229746e62368583d4d6d8602b86d25b..ca70722720f0b6a8fb7a2e4194e7d419e5ac047c 100644
--- a/math/libm-test-support.c
+++ b/math/libm-test-support.c
@@ -983,8 +983,6 @@  enable_test (int exceptions)
     return 0;
   if (flag_test_inline && (exceptions & NO_TEST_INLINE))
     return 0;
-  if (flag_test_finite && (exceptions & NON_FINITE) != 0)
-    return 0;
   if ((!SNAN_TESTS (FLOAT) || !snan_tests_arg)
       && (exceptions & TEST_SNAN) != 0)
     return 0;
diff --git a/math/test-finite-macros.c b/math/test-finite-macros.c
deleted file mode 100644
index 14524a357b837d020f48aec10d05ed9ca1855c4f..0000000000000000000000000000000000000000
--- a/math/test-finite-macros.c
+++ /dev/null
@@ -1,35 +0,0 @@ 
-/* Test finite-math-only code does not conflict with user macros (bug 22028).
-   Copyright (C) 2017-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* The main test is that the inclusion of <math.h> compiles.  */
-#define f first test macro
-#define l second test macro
-#define f128 third test macro
-
-#include <math.h>
-
-volatile float a, b;
-
-static int
-do_test (void)
-{
-  b = acosf (a);
-  return 0;
-}
-
-#include <support/test-driver.c>
diff --git a/math/test-math-finite.h b/math/test-math-finite.h
deleted file mode 100644
index e3c8e0a2b9f9aa547c8af0d8a38b26c6830ab6ca..0000000000000000000000000000000000000000
--- a/math/test-math-finite.h
+++ /dev/null
@@ -1,21 +0,0 @@ 
-/* Common definitions for libm tests for finite-math-only.
-   Copyright (C) 2015-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define TEST_FINITE 1
-#define TEST_ERRNO 0
-#define TEST_EXCEPTIONS 1
diff --git a/math/test-math-inline.h b/math/test-math-inline.h
index b51cf52901b693aba3088da3774964c3b852e912..14553dda6ca6e82bdcf42b6122d8a65a9dd06dba 100644
--- a/math/test-math-inline.h
+++ b/math/test-math-inline.h
@@ -17,7 +17,6 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #define TEST_INLINE 1
-#define TEST_FINITE 0
 #define TEST_ERRNO 0
 #define TEST_EXCEPTIONS 0
 
diff --git a/math/test-math-no-finite.h b/math/test-math-no-finite.h
deleted file mode 100644
index e3456aae756375f41ef7d4cf47bb68a24dfdddfc..0000000000000000000000000000000000000000
--- a/math/test-math-no-finite.h
+++ /dev/null
@@ -1,20 +0,0 @@ 
-/* Common definitions for libm tests for no-finite-math-only.
-   Copyright (C) 2015-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define TEST_FINITE 0
-#define TEST_EXCEPTIONS 1
diff --git a/math/test-math-vector.h b/math/test-math-vector.h
index b211ddebec08daafb76a8673dbfc7bf11659c0ac..775198867e097f0f8b1e3266aba2eba5a75e94a7 100644
--- a/math/test-math-vector.h
+++ b/math/test-math-vector.h
@@ -18,7 +18,6 @@ 
 
 #define TEST_MATHVEC 1
 #define TEST_NARROW 0
-#define TEST_FINITE 0
 #define TEST_ERRNO 0
 #define TEST_EXCEPTIONS 0
 
diff --git a/math/test-signgam-finite-c11.c b/math/test-signgam-finite-c11.c
deleted file mode 100644
index dff132df934fdb2ceb593ed9326e821b4349bd8f..0000000000000000000000000000000000000000
--- a/math/test-signgam-finite-c11.c
+++ /dev/null
@@ -1 +0,0 @@ 
-#include "test-signgam-finite-c99.c"
diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c
deleted file mode 100644
index 9be03a9edc1222953b3f5c331fb729f3dfab3335..0000000000000000000000000000000000000000
--- a/math/test-signgam-finite-c99.c
+++ /dev/null
@@ -1,63 +0,0 @@ 
-/* Test lgamma functions do not set signgam for -ffinite-math-only for ISO C.
-   Copyright (C) 2015-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef _LIBC
-#undef __LIBC_INTERNAL_MATH_INLINES
-#undef _GNU_SOURCE
-
-#include <math.h>
-#include <stdio.h>
-
-int signgam;
-
-#define RUN_TESTS(FUNC, TYPE)					\
-  do								\
-    {								\
-      volatile TYPE a, b, c __attribute__ ((unused));		\
-      a = 0.5;							\
-      b = -0.5;							\
-      signgam = 123;						\
-      c = FUNC (a);						\
-      if (signgam == 123)					\
-	puts ("PASS: " #FUNC " (0.5) setting signgam");		\
-      else							\
-	{							\
-	  puts ("FAIL: " #FUNC " (0.5) setting signgam");	\
-	  result = 1;						\
-	}							\
-      signgam = 123;						\
-      c = FUNC (b);						\
-      if (signgam == 123)					\
-	puts ("PASS: " #FUNC " (-0.5) setting signgam");	\
-      else							\
-	{							\
-	  puts ("FAIL: " #FUNC " (-0.5) setting signgam");	\
-	  result = 1;						\
-	}							\
-    }								\
-  while (0)
-
-int
-main (void)
-{
-  int result = 0;
-  RUN_TESTS (lgammaf, float);
-  RUN_TESTS (lgamma, double);
-  RUN_TESTS (lgammal, long double);
-  return result;
-}
diff --git a/math/test-signgam-finite.c b/math/test-signgam-finite.c
deleted file mode 100644
index 5ec697c7738d81b87099d9585ac14b58b3d091c2..0000000000000000000000000000000000000000
--- a/math/test-signgam-finite.c
+++ /dev/null
@@ -1,63 +0,0 @@ 
-/* Test lgamma functions set signgam for -ffinite-math-only (bug 19211).
-   Copyright (C) 2015-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <stdio.h>
-
-#define RUN_TESTS(FUNC, TYPE)					\
-  do								\
-    {								\
-      volatile TYPE a, b, c __attribute__ ((unused));		\
-      a = 0.5;							\
-      b = -0.5;							\
-      signgam = 123;						\
-      c = FUNC (a);						\
-      if (signgam == 1)						\
-	puts ("PASS: " #FUNC " (0.5) setting signgam");		\
-      else							\
-	{							\
-	  puts ("FAIL: " #FUNC " (0.5) setting signgam");	\
-	  result = 1;						\
-	}							\
-      signgam = 123;						\
-      c = FUNC (b);						\
-      if (signgam == -1)					\
-	puts ("PASS: " #FUNC " (-0.5) setting signgam");	\
-      else							\
-	{							\
-	  puts ("FAIL: " #FUNC " (-0.5) setting signgam");	\
-	  result = 1;						\
-	}							\
-    }								\
-  while (0)
-
-static int
-do_test (void)
-{
-  int result = 0;
-  RUN_TESTS (lgammaf, float);
-  RUN_TESTS (gammaf, float);
-  RUN_TESTS (lgamma, double);
-  RUN_TESTS (gamma, double);
-  RUN_TESTS (lgammal, long double);
-  RUN_TESTS (gammal, long double);
-  return result;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"