[committed] libstdc++: Remove handling for underscore-prefixed libm functions [PR111638]

Message ID 20231111004433.66232-1-jwakely@redhat.com
State Accepted
Headers
Series [committed] libstdc++: Remove handling for underscore-prefixed libm functions [PR111638] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jonathan Wakely Nov. 11, 2023, 12:43 a.m. UTC
  Tested x86_64-linux. Pushed to trunk.

-- >8 --

The checks in linkage.m4 try to support math functions prefixed with
underscores, like _acosf and _isinf. However, that doesn't work because
they're renamed to the standard names using a macro, but then <cmath>
undefines that macro again.

This simply removes everything related to those underscored functions.

libstdc++-v3/ChangeLog:

	PR libstdc++/111638
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* linkage.m4 (GLIBCXX_MAYBE_UNDERSCORED_FUNCS): Remove.
	(GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1): Do not check for _foo.
	(GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1): Likewise.
	(GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2): Likewise.
	(GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3): Likewise.
	(GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2): Do not use
	GLIBCXX_MAYBE_UNDERSCORED_FUNCS.
---
 libstdc++-v3/config.h.in |   506 -
 libstdc++-v3/configure   | 19292 -------------------------------------
 libstdc++-v3/linkage.m4  |    51 -
 3 files changed, 19849 deletions(-)

;
  

Patch

diff --git a/libstdc++-v3/linkage.m4 b/libstdc++-v3/linkage.m4
index 45a09cdf445..29b31447c98 100644
--- a/libstdc++-v3/linkage.m4
+++ b/libstdc++-v3/linkage.m4
@@ -28,27 +28,10 @@  AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_1], [
 ])
 
 
-dnl 
-dnl Define autoheader template for using the underscore functions
-dnl For each parameter, create a macro where if func doesn't exist,
-dnl but _func does, then it will "#define func _func".
-dnl
-dnl GLIBCXX_MAYBE_UNDERSCORED_FUNCS
-AC_DEFUN([GLIBCXX_MAYBE_UNDERSCORED_FUNCS], 
-[AC_FOREACH([glibcxx_ufunc], [$1],
-  [AH_VERBATIM(_[]glibcxx_ufunc,
-[#if defined (]AS_TR_CPP(HAVE__[]glibcxx_ufunc)[) && ! defined (]AS_TR_CPP(HAVE_[]glibcxx_ufunc)[)
-# define ]AS_TR_CPP(HAVE_[]glibcxx_ufunc)[ 1
-# define ]glibcxx_ufunc[ _]glibcxx_ufunc[
-#endif])])
-])
-
-
 dnl
 dnl Check to see if the (math function) argument passed is
 dnl 1) declared when using the c++ compiler
 dnl 2) has "C" linkage
-dnl 3) if not, see if 1) and 2) for argument prepended with '_'
 dnl
 dnl Define HAVE_CARGF etc if "cargf" is declared and links
 dnl
@@ -61,13 +44,7 @@  AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1], [
   GLIBCXX_CHECK_MATH_DECL_1($1)
   if test x$glibcxx_cv_func_$1_use = x"yes"; then
     AC_CHECK_FUNCS($1)
-  else
-    GLIBCXX_CHECK_MATH_DECL_1(_$1)
-    if test x$glibcxx_cv_func__$1_use = x"yes"; then
-      AC_CHECK_FUNCS(_$1)
-    fi
   fi
-  GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
 ])
 
 
@@ -90,22 +67,7 @@  AC_DEFUN([GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1], [
   AC_MSG_RESULT($glibcxx_cv_func_$2_use)
   if test x$glibcxx_cv_func_$2_use = x"yes"; then
     AC_CHECK_FUNCS(funclist)
-  else
-    AC_MSG_CHECKING([for _$1 functions])
-    AC_CACHE_VAL(glibcxx_cv_func__$2_use, [
-      AC_LANG_SAVE
-      AC_LANG_CPLUSPLUS
-      AC_TRY_COMPILE([#include <math.h>],
-                     patsubst(funclist,[\w+],[_\& (0);]),
-                     [glibcxx_cv_func__$2_use=yes],
-                     [glibcxx_cv_func__$2_use=no])
-      AC_LANG_RESTORE])
-    AC_MSG_RESULT($glibcxx_cv_func__$2_use)
-    if test x$glibcxx_cv_func__$2_use = x"yes"; then
-      AC_CHECK_FUNCS(patsubst(funclist,[\w+],[_\&]))
-    fi
   fi
-  GLIBCXX_MAYBE_UNDERSCORED_FUNCS(funclist)
   undefine([funclist])
 ])
 
@@ -146,13 +108,7 @@  AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2], [
   GLIBCXX_CHECK_MATH_DECL_2($1)
   if test x$glibcxx_cv_func_$1_use = x"yes"; then
     AC_CHECK_FUNCS($1)
-  else
-    GLIBCXX_CHECK_MATH_DECL_2(_$1)
-    if test x$glibcxx_cv_func__$1_use = x"yes"; then
-      AC_CHECK_FUNCS(_$1)
-    fi
   fi
-  GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
 ])
 
 
@@ -193,13 +149,7 @@  AC_DEFUN([GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3], [
   GLIBCXX_CHECK_MATH_DECL_3($1)
   if test x$glibcxx_cv_func_$1_use = x"yes"; then
     AC_CHECK_FUNCS($1)
-  else
-    GLIBCXX_CHECK_MATH_DECL_3(_$1)
-    if test x$glibcxx_cv_func__$1_use = x"yes"; then
-      AC_CHECK_FUNCS(_$1)
-    fi
   fi
-  GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
 ])
 
 
@@ -287,7 +237,6 @@  AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2], [
   if test x$glibcxx_cv_func_$1_use = x"yes"; then
     AC_CHECK_FUNCS($1)
   fi
-  GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
 ])