This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Fix / clean-up config vs crosses (5/n): remove [GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT]


Hi,

in this case, I'm trying to remove something that seems very badly obsolete to me. First, of the various builtins checked only 4 results are actually used, in libmath/mathconf.h. In turn, the latter uses (in order to possibly replace normal library functions in math.h?!?) would be certainly unsafe these days, because [GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1] tries to compile and link calls with a compile-time constant argument, which are completely optimized out.

Thus, I'm going to wait until tomorrow in case I'm missing something, then will apply.

Paolo.

/////////////////////
2008-08-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* linkage.m4 ([GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1],
	[GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT]): Remove 
	* configure.ac: Do not call the latter.
	* crossconfig.m4: Likewise.
	* libmath/mathconf.h: Adjust.
	* configure: Regenerate.
	* config.h.in: Likewise.
Index: linkage.m4
===================================================================
*** linkage.m4	(revision 139533)
--- linkage.m4	(working copy)
*************** AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_
*** 291,384 ****
  ])
  
  dnl
- dnl Because the builtins are picky picky picky about the arguments they take,
- dnl do an explict linkage tests here.
- 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
- dnl Define HAVE_CARGF etc if "cargf" is declared and links
- dnl
- dnl argument 1 is name of function to check
- dnl
- dnl ASSUMES argument is a math function with ONE parameter
- dnl
- dnl GLIBCXX_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
- AC_DEFUN([GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1], [
-   AC_MSG_CHECKING([for $1 declaration])
-   if test x${glibcxx_cv_func_$1_use+set} != xset; then
-     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
-       AC_LANG_SAVE
-       AC_LANG_CPLUSPLUS
-       AC_TRY_COMPILE([#include <math.h>],
-                      [ $1(0);],
-                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
-       AC_LANG_RESTORE
-     ])
-   fi
-   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
-   if test x$glibcxx_cv_func_$1_use = x"yes"; then
-     AC_MSG_CHECKING([for $1 linkage])
-     if test x${glibcxx_cv_func_$1_link+set} != xset; then
-       AC_CACHE_VAL(glibcxx_cv_func_$1_link, [
-         AC_TRY_LINK([#include <math.h>],
-                     [ $1(0);],
-                     [glibcxx_cv_func_$1_link=yes], [glibcxx_cv_func_$1_link=no])
-       ])
-     fi
-     AC_MSG_RESULT($glibcxx_cv_func_$1_link)
-     define([NAME], [translit([$1],[abcdefghijklmnopqrstuvwxyz],
-     				  [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
-     if test x$glibcxx_cv_func_$1_link = x"yes"; then
-       AC_DEFINE([HAVE_]NAME, 1, [Define if the compiler/host combination has $1.])
-     fi
-     undefine([NAME])
-   fi
- ])
- 
- 
- dnl
- dnl Check to see what builtin math functions are supported
- dnl
- dnl check for __builtin_abs
- dnl check for __builtin_fabsf
- dnl check for __builtin_fabs
- dnl check for __builtin_fabl
- dnl check for __builtin_labs
- dnl check for __builtin_sqrtf
- dnl check for __builtin_sqrtl
- dnl check for __builtin_sqrt
- dnl check for __builtin_sinf
- dnl check for __builtin_sin
- dnl check for __builtin_sinl
- dnl check for __builtin_cosf
- dnl check for __builtin_cos
- dnl check for __builtin_cosl
- dnl
- dnl GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
- AC_DEFUN([GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT], [
-   dnl Test for builtin math functions.
-   dnl These are made in gcc/c-common.c
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
- 
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
- 
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
- 
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
-   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
- ])
- 
- dnl
  dnl Check to see what the underlying c library is like
  dnl These checks need to do two things:
  dnl 1) make sure the name is declared when using the c++ compiler
--- 291,296 ----
Index: configure.ac
===================================================================
*** configure.ac	(revision 139533)
--- configure.ac	(working copy)
*************** if $GLIBCXX_IS_NATIVE; then
*** 167,173 ****
  
    GLIBCXX_CHECK_LINKER_FEATURES
    GLIBCXX_CHECK_MATH_SUPPORT
-   GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
    GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
    GLIBCXX_CHECK_STDLIB_SUPPORT
  
--- 167,172 ----
*************** else
*** 211,217 ****
    fi
  
    # Construct crosses by hand, eliminating bits that need ld...
-   # GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
    # GLIBCXX_CHECK_MATH_SUPPORT
  
    # First, test for "known" system libraries.  We may be using newlib even
--- 210,215 ----
Index: libmath/mathconf.h
===================================================================
*** libmath/mathconf.h	(revision 139533)
--- libmath/mathconf.h	(working copy)
***************
*** 1,6 ****
  /* Configuration data for libmath subpart of libstdc++. */
  
! /* Copyright (C) 1997-1999, 2000, 2001 Free Software Foundation, Inc.
  
     This file is part of the GNU ISO C++ Library.  This library is free
     software; you can redistribute it and/or modify it under the
--- 1,7 ----
  /* Configuration data for libmath subpart of libstdc++. */
  
! /* Copyright (C) 1997-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
!    2007, 2008 Free Software Foundation, Inc.
  
     This file is part of the GNU ISO C++ Library.  This library is free
     software; you can redistribute it and/or modify it under the
*************** do {								\
*** 263,272 ****
  
  
  /* Replacement for non-existing float functions.  */
! #if !defined(HAVE_FABSF) && !defined(HAVE___BUILTIN_FABSF)
  # define fabsf(x) fabs (x)
  #endif
! #if !defined(HAVE_COSF) && !defined(HAVE___BUILTIN_COSF)
  # define cosf(x) cos (x)
  #endif
  #ifndef HAVE_COSHF
--- 264,273 ----
  
  
  /* Replacement for non-existing float functions.  */
! #ifndef HAVE_FABSF
  # define fabsf(x) fabs (x)
  #endif
! #ifndef HAVE_COSF
  # define cosf(x) cos (x)
  #endif
  #ifndef HAVE_COSHF
*************** do {								\
*** 284,296 ****
  #ifndef HAVE_POWF
  # define powf(x, y) pow (x, y)
  #endif
! #if !defined(HAVE_SINF) && !defined(HAVE___BUILTIN_SINF)
  # define sinf(x) sin (x)
  #endif
  #ifndef HAVE_SINHF
  # define sinhf(x) sinh (x)
  #endif
! #if !defined(HAVE_SQRTF) && !defined(HAVE___BUILTIN_SQRTF)
  # define sqrtf(x) sqrt (x)
  #endif
  #ifndef HAVE_TANF
--- 285,297 ----
  #ifndef HAVE_POWF
  # define powf(x, y) pow (x, y)
  #endif
! #ifndef HAVE_SINF
  # define sinf(x) sin (x)
  #endif
  #ifndef HAVE_SINHF
  # define sinhf(x) sinh (x)
  #endif
! #ifndef HAVE_SQRTF
  # define sqrtf(x) sqrt (x)
  #endif
  #ifndef HAVE_TANF
*************** do {								\
*** 306,309 ****
  #ifdef __cplusplus
  }
  #endif
- 
--- 307,309 ----
Index: crossconfig.m4
===================================================================
*** crossconfig.m4	(revision 139533)
--- crossconfig.m4	(working copy)
*************** case "${host}" in
*** 16,22 ****
      GLIBCXX_CHECK_COMPILER_FEATURES
      GLIBCXX_CHECK_LINKER_FEATURES
      GLIBCXX_CHECK_MATH_SUPPORT
-     GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
      GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
      GLIBCXX_CHECK_STDLIB_SUPPORT
  
--- 16,21 ----
*************** case "${host}" in
*** 39,45 ****
  
      # Don't call GLIBCXX_CHECK_LINKER_FEATURES, Darwin doesn't have a GNU ld
      GLIBCXX_CHECK_MATH_SUPPORT
-     GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
      GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
      GLIBCXX_CHECK_STDLIB_SUPPORT
      ;;
--- 38,43 ----
*************** case "${host}" in
*** 53,73 ****
      AC_DEFINE(HAVE_COPYSIGN)
      AC_DEFINE(HAVE_SINCOS)
      AC_DEFINE(HAVE_HYPOT)
-     # GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
-     AC_DEFINE(HAVE___BUILTIN_ABS)
-     AC_DEFINE(HAVE___BUILTIN_FABSF)
-     AC_DEFINE(HAVE___BUILTIN_FABS)
-     AC_DEFINE(HAVE___BUILTIN_FABSL)
-     AC_DEFINE(HAVE___BUILTIN_LABS)
-     AC_DEFINE(HAVE___BUILTIN_SQRTF)
-     AC_DEFINE(HAVE___BUILTIN_SQRT)
-     AC_DEFINE(HAVE___BUILTIN_SQRTL)
-     AC_DEFINE(HAVE___BUILTIN_SINF)
-     AC_DEFINE(HAVE___BUILTIN_SIN)
-     AC_DEFINE(HAVE___BUILTIN_SINL)
-     AC_DEFINE(HAVE___BUILTIN_COSF)
-     AC_DEFINE(HAVE___BUILTIN_COS)
-     AC_DEFINE(HAVE___BUILTIN_COSL)
      # GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
      # GLIBCXX_CHECK_STDLIB_SUPPORT
      AC_DEFINE(HAVE_COPYSIGN)
--- 51,56 ----
*************** case "${host}" in
*** 147,153 ****
      GLIBCXX_CHECK_COMPILER_FEATURES
      GLIBCXX_CHECK_LINKER_FEATURES
      GLIBCXX_CHECK_MATH_SUPPORT
-     GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
      GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
      GLIBCXX_CHECK_STDLIB_SUPPORT
  
--- 130,135 ----
*************** case "${host}" in
*** 225,244 ****
          ;;
      esac
      case "$target" in
-       sparc*-*-solaris2.8 | sparc*-*-solaris2.9 | sparc*-*-solaris2.10)
-         # I saw these on sparc-sun-solaris2.8, but not 2.6, and not on i386
-         AC_DEFINE(HAVE___BUILTIN_ABS)
-         AC_DEFINE(HAVE___BUILTIN_LABS)
-         AC_DEFINE(HAVE___BUILTIN_FABS)
-         AC_DEFINE(HAVE___BUILTIN_FABSF)
-         AC_DEFINE(HAVE___BUILTIN_FABSL)
-         AC_DEFINE(HAVE___BUILTIN_COS)
-         AC_DEFINE(HAVE___BUILTIN_COSF)
-         AC_DEFINE(HAVE___BUILTIN_SIN)
-         AC_DEFINE(HAVE___BUILTIN_SINF)
-        ;;
-     esac
-     case "$target" in
        *-*-solaris2.10)
        # These two C99 functions are present only in Solaris >= 10
        AC_DEFINE(HAVE_STRTOF)
--- 207,212 ----
Index: config.h.in
===================================================================
*** config.h.in	(revision 139533)
--- config.h.in	(working copy)
***************
*** 631,678 ****
  /* Define to 1 if you have the `_tanl' function. */
  #undef HAVE__TANL
  
- /* Define if the compiler/host combination has __builtin_abs. */
- #undef HAVE___BUILTIN_ABS
- 
- /* Define if the compiler/host combination has __builtin_cos. */
- #undef HAVE___BUILTIN_COS
- 
- /* Define if the compiler/host combination has __builtin_cosf. */
- #undef HAVE___BUILTIN_COSF
- 
- /* Define if the compiler/host combination has __builtin_cosl. */
- #undef HAVE___BUILTIN_COSL
- 
- /* Define if the compiler/host combination has __builtin_fabs. */
- #undef HAVE___BUILTIN_FABS
- 
- /* Define if the compiler/host combination has __builtin_fabsf. */
- #undef HAVE___BUILTIN_FABSF
- 
- /* Define if the compiler/host combination has __builtin_fabsl. */
- #undef HAVE___BUILTIN_FABSL
- 
- /* Define if the compiler/host combination has __builtin_labs. */
- #undef HAVE___BUILTIN_LABS
- 
- /* Define if the compiler/host combination has __builtin_sin. */
- #undef HAVE___BUILTIN_SIN
- 
- /* Define if the compiler/host combination has __builtin_sinf. */
- #undef HAVE___BUILTIN_SINF
- 
- /* Define if the compiler/host combination has __builtin_sinl. */
- #undef HAVE___BUILTIN_SINL
- 
- /* Define if the compiler/host combination has __builtin_sqrt. */
- #undef HAVE___BUILTIN_SQRT
- 
- /* Define if the compiler/host combination has __builtin_sqrtf. */
- #undef HAVE___BUILTIN_SQRTF
- 
- /* Define if the compiler/host combination has __builtin_sqrtl. */
- #undef HAVE___BUILTIN_SQRTL
- 
  /* Define to 1 if you have the `__signbit' function. */
  #undef HAVE___SIGNBIT
  
--- 631,636 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]