From 6facb2ddab273a8798374897af23e9ad45aba899 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 5 Nov 2023 14:27:47 +0100 Subject: [PATCH] fpe-tracking: Remove module. * modules/fpe-tracking: Remove file. * m4/fpe.m4 (gl_FPE_TRACKING): Remove macro. (gl_FPE_TRAPPING): Require gl_FENV_EXCEPTIONS_TRACKING instead of gl_FPE_TRACKING. Use FENV_EXCEPTIONS_TRACKING_LIBM instead of FPE_TRACKING_LIBM. * modules/nan-tests (Depends-on): Add fenv-exceptions-tracking-c99. Remove fpe-tracking. (Makefile.am): Use FENV_EXCEPTIONS_TRACKING_LIBM instead of FPE_TRACKING_LIBM. * modules/snan-tests (Depends-on): Add fenv-exceptions-tracking-c99. Remove fpe-tracking. (Makefile.am): Use FENV_EXCEPTIONS_TRACKING_LIBM instead of FPE_TRACKING_LIBM. * tests/test-nan-1.c: Assume HAVE_FE_INVALID is 1. * tests/test-snan-1.c: Likewise. --- ChangeLog | 19 ++++++++++++++++++ m4/fpe.m4 | 47 +++----------------------------------------- modules/fpe-tracking | 27 ------------------------- modules/nan-tests | 4 ++-- modules/snan-tests | 4 ++-- tests/test-nan-1.c | 27 +++++-------------------- tests/test-snan-1.c | 27 +++++-------------------- 7 files changed, 36 insertions(+), 119 deletions(-) delete mode 100644 modules/fpe-tracking diff --git a/ChangeLog b/ChangeLog index 0955567775..3b2951ff6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2023-11-05 Bruno Haible + + fpe-tracking: Remove module. + * modules/fpe-tracking: Remove file. + * m4/fpe.m4 (gl_FPE_TRACKING): Remove macro. + (gl_FPE_TRAPPING): Require gl_FENV_EXCEPTIONS_TRACKING instead of + gl_FPE_TRACKING. Use FENV_EXCEPTIONS_TRACKING_LIBM instead of + FPE_TRACKING_LIBM. + * modules/nan-tests (Depends-on): Add fenv-exceptions-tracking-c99. + Remove fpe-tracking. + (Makefile.am): Use FENV_EXCEPTIONS_TRACKING_LIBM instead of + FPE_TRACKING_LIBM. + * modules/snan-tests (Depends-on): Add fenv-exceptions-tracking-c99. + Remove fpe-tracking. + (Makefile.am): Use FENV_EXCEPTIONS_TRACKING_LIBM instead of + FPE_TRACKING_LIBM. + * tests/test-nan-1.c: Assume HAVE_FE_INVALID is 1. + * tests/test-snan-1.c: Likewise. + 2023-11-05 Bruno Haible fenv-exceptions-trapping: Avoid test failure on NetBSD/sparc. diff --git a/m4/fpe.m4 b/m4/fpe.m4 index f8a81030a6..94ca0d5cc1 100644 --- a/m4/fpe.m4 +++ b/m4/fpe.m4 @@ -1,50 +1,9 @@ -# fpe.m4 serial 1 +# fpe.m4 serial 2 dnl Copyright (C) 2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -# Prerequisites for tracking FE_INVALID exceptions. -AC_DEFUN_ONCE([gl_FPE_TRACKING], -[ - AC_CACHE_CHECK([whether FE_INVALID exceptions can be tracked], - [gl_cv_fenv_invalid_api], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], - [[feclearexcept (FE_INVALID); - ]]) - ], - [gl_cv_fenv_invalid_api=yes], - [gl_cv_fenv_invalid_api=no]) - ]) - if test $gl_cv_fenv_invalid_api = yes; then - AC_DEFINE([HAVE_FE_INVALID], [1], - [Define if FE_INVALID exceptions can be programmatically tracked.]) - AC_CACHE_CHECK([whether feclearexcept can be used without linking with libm], - [gl_cv_func_feclearexcept_no_libm], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], - [[feclearexcept (FE_INVALID); - ]]) - ], - [gl_cv_func_feclearexcept_no_libm=yes], - [gl_cv_func_feclearexcept_no_libm=no]) - ]) - if test $gl_cv_func_feclearexcept_no_libm != yes; then - FPE_TRACKING_LIBM=-lm - else - FPE_TRACKING_LIBM= - fi - else - FPE_TRACKING_LIBM= - fi - AC_SUBST([FPE_TRACKING_LIBM]) -]) - # Prerequisites for turning FE_INVALID exceptions into a SIGFPE signal. AC_DEFUN_ONCE([gl_FPE_TRAPPING], [ @@ -109,7 +68,7 @@ AC_DEFUN_ONCE([gl_FPE_TRAPPING], fi fi fi - AC_REQUIRE([gl_FPE_TRACKING]) - FPE_TRAPPING_LIBM="$FPE_TRAPPING_LIBM $FPE_TRACKING_LIBM" + AC_REQUIRE([gl_FENV_EXCEPTIONS_TRACKING]) + FPE_TRAPPING_LIBM="$FPE_TRAPPING_LIBM $FENV_EXCEPTIONS_TRACKING_LIBM" AC_SUBST([FPE_TRAPPING_LIBM]) ]) diff --git a/modules/fpe-tracking b/modules/fpe-tracking deleted file mode 100644 index d1afcf94f0..0000000000 --- a/modules/fpe-tracking +++ /dev/null @@ -1,27 +0,0 @@ -Description: -Tracking floating-point exceptions, i.e. determining whether -a floating-point exception has occurred during a certain computation. - -Files: -m4/fpe.m4 - -Depends-on: - -configure.ac: -gl_FPE_TRACKING - -Makefile.am: - -Include: -#if HAVE_FE_INVALID -# include -#endif - -Link: -$(FPE_TRACKING_LIBM) - -License: -GPL - -Maintainer: -all diff --git a/modules/nan-tests b/modules/nan-tests index 607e35f63b..ec549b8919 100644 --- a/modules/nan-tests +++ b/modules/nan-tests @@ -4,7 +4,7 @@ tests/test-nan-2.c tests/macros.h Depends-on: -fpe-tracking +fenv-exceptions-tracking-c99 fpe-trapping configure.ac: @@ -12,5 +12,5 @@ configure.ac: Makefile.am: TESTS += test-nan-1 test-nan-2 check_PROGRAMS += test-nan-1 test-nan-2 -test_nan_1_LDADD = $(LDADD) @FPE_TRACKING_LIBM@ +test_nan_1_LDADD = $(LDADD) $(FENV_EXCEPTIONS_TRACKING_LIBM) test_nan_2_LDADD = $(LDADD) @FPE_TRAPPING_LIBM@ diff --git a/modules/snan-tests b/modules/snan-tests index 91210d2ea5..6779f6c0bf 100644 --- a/modules/snan-tests +++ b/modules/snan-tests @@ -6,7 +6,7 @@ tests/macros.h m4/math_h.m4 Depends-on: -fpe-tracking +fenv-exceptions-tracking-c99 fpe-trapping configure.ac: @@ -15,5 +15,5 @@ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) Makefile.am: TESTS += test-snan-1 test-snan-2.sh check_PROGRAMS += test-snan-1 test-snan-2 -test_snan_1_LDADD = $(LDADD) @FPE_TRACKING_LIBM@ +test_snan_1_LDADD = $(LDADD) $(FENV_EXCEPTIONS_TRACKING_LIBM) test_snan_2_LDADD = $(LDADD) @FPE_TRAPPING_LIBM@ diff --git a/tests/test-nan-1.c b/tests/test-nan-1.c index 4ebe013e3c..9b48a6853f 100644 --- a/tests/test-nan-1.c +++ b/tests/test-nan-1.c @@ -21,11 +21,9 @@ /* Specification. */ #include "nan.h" -#include +#if defined __GLIBC__ && defined __arm__ && defined __SOFTFP__ -#if HAVE_FE_INVALID - -# if defined __GLIBC__ && defined __arm__ && defined __SOFTFP__ +# include /* The arm software floating-point emulation (used e.g. on armv5) does not set the floating-point exception bits. */ @@ -37,11 +35,11 @@ main () return 77; } -# else +#else -# include +# include -# include "macros.h" +# include "macros.h" float volatile resultf; double volatile resultd; @@ -80,19 +78,4 @@ main () return 0; } -# endif - -#else - -/* No available. - We could use the various alternative approaches from - libgfortran/config/fpu-*.h, but that's not worth it. */ - -int -main () -{ - fputs ("Skipping test: feclearexcept, fetestexcept, FE_INVALID not available\n", stderr); - return 77; -} - #endif diff --git a/tests/test-snan-1.c b/tests/test-snan-1.c index 7b71b9a57b..3b1e0e9427 100644 --- a/tests/test-snan-1.c +++ b/tests/test-snan-1.c @@ -21,11 +21,9 @@ /* Specification. */ #include "snan.h" -#include +#if defined __GLIBC__ && defined __arm__ && defined __SOFTFP__ -#if HAVE_FE_INVALID - -# if defined __GLIBC__ && defined __arm__ && defined __SOFTFP__ +# include /* The arm software floating-point emulation (used e.g. on armv5) does not set the floating-point exception bits. */ @@ -37,11 +35,11 @@ main () return 77; } -# else +#else -# include +# include -# include "macros.h" +# include "macros.h" float volatile resultf; double volatile resultd; @@ -105,19 +103,4 @@ main () return 0; } -# endif - -#else - -/* No available. - We could use the various alternative approaches from - libgfortran/config/fpu-*.h, but that's not worth it. */ - -int -main () -{ - fputs ("Skipping test: feclearexcept, fetestexcept, FE_INVALID not available\n", stderr); - return 77; -} - #endif -- 2.39.5