From f421e442c6fce95cd6e27f845e18cb70ad5208f4 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 1 May 2018 22:47:33 +0000 Subject: [PATCH] PR libstdc++/84654 Disable __float128 specializations for -mno-float128 2018-05-01 Tulio Magno Quites Machado Filho PR libstdc++/84654 * acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128. * config.h.in: Remove references to _GLIBCXX_USE_FLOAT128. * configure: Regenerate. * include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128 based on ENABLE_FLOAT128. * include/Makefile.in: Regenerate. * include/bits/c++config: Define _GLIBCXX_USE_FLOAT128. [!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine _GLIBCXX_USE_FLOAT128. From-SVN: r259813 --- libstdc++-v3/ChangeLog | 13 ++++++++++ libstdc++-v3/acinclude.m4 | 5 ++-- libstdc++-v3/config.h.in | 3 --- libstdc++-v3/configure | 37 +++++++++++++++++++---------- libstdc++-v3/include/Makefile.am | 13 +++++++++- libstdc++-v3/include/Makefile.in | 10 +++++++- libstdc++-v3/include/bits/c++config | 6 +++++ 7 files changed, 67 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index acdc6ffd124..9ef88a8de9a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2018-05-01 Tulio Magno Quites Machado Filho + + PR libstdc++/84654 + * acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128. + * config.h.in: Remove references to _GLIBCXX_USE_FLOAT128. + * configure: Regenerate. + * include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128 + based on ENABLE_FLOAT128. + * include/Makefile.in: Regenerate. + * include/bits/c++config: Define _GLIBCXX_USE_FLOAT128. + [!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine + _GLIBCXX_USE_FLOAT128. + 2018-04-24 H.J. Lu * configure: Regenerated. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 3bd669a4cc8..4f37b6a6498 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3062,7 +3062,7 @@ dnl Note: also checks that the types aren't standard types. dnl dnl Defines: dnl _GLIBCXX_USE_INT128 -dnl _GLIBCXX_USE_FLOAT128 +dnl ENABLE_FLOAT128 dnl AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [ @@ -3117,13 +3117,12 @@ EOF AC_MSG_CHECKING([for __float128]) if AC_TRY_EVAL(ac_compile); then - AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1, - [Define if __float128 is supported on this host.]) enable_float128=yes else enable_float128=no fi AC_MSG_RESULT($enable_float128) + GLIBCXX_CONDITIONAL(ENABLE_FLOAT128, test $enable_float128 = yes) rm -f conftest* AC_LANG_RESTORE diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 5a0f0678439..765cedc6edf 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -918,9 +918,6 @@ /* Define if fchmodat is available in . */ #undef _GLIBCXX_USE_FCHMODAT -/* Define if __float128 is supported on this host. */ -#undef _GLIBCXX_USE_FLOAT128 - /* Defined if gettimeofday is available. */ #undef _GLIBCXX_USE_GETTIMEOFDAY diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index ba094be6f15..c9dbaa139d5 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -729,6 +729,8 @@ BASIC_FILE_H CSTDIO_H SECTION_FLAGS WERROR +ENABLE_FLOAT128_FALSE +ENABLE_FLOAT128_TRUE thread_header glibcxx_PCHFLAGS GLIBCXX_BUILD_PCH_FALSE @@ -11606,7 +11608,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11609 "configure" +#line 11611 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11712,7 +11714,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11715 "configure" +#line 11717 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15398,7 +15400,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15401 "configure" +#line 15403 "configure" int main() { typedef bool atomic_type; @@ -15433,7 +15435,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15436 "configure" +#line 15438 "configure" int main() { typedef short atomic_type; @@ -15468,7 +15470,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15471 "configure" +#line 15473 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15504,7 +15506,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15507 "configure" +#line 15509 "configure" int main() { typedef long long atomic_type; @@ -15585,7 +15587,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15588 "configure" +#line 15590 "configure" int main() { _Decimal32 d1; @@ -15627,7 +15629,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15630 "configure" +#line 15632 "configure" template struct same { typedef T2 type; }; @@ -15661,7 +15663,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15664 "configure" +#line 15666 "configure" template struct same { typedef T2 type; }; @@ -15683,15 +15685,13 @@ $as_echo_n "checking for __float128... " >&6; } ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - -$as_echo "#define _GLIBCXX_USE_FLOAT128 1" >>confdefs.h - enable_float128=yes else enable_float128=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_float128" >&5 $as_echo "$enable_float128" >&6; } + rm -f conftest* ac_ext=c @@ -81248,6 +81248,15 @@ else fi + if test $enable_float128 = yes; then + ENABLE_FLOAT128_TRUE= + ENABLE_FLOAT128_FALSE='#' +else + ENABLE_FLOAT128_TRUE='#' + ENABLE_FLOAT128_FALSE= +fi + + if test $enable_libstdcxx_allocator_flag = new; then ENABLE_ALLOCATOR_NEW_TRUE= ENABLE_ALLOCATOR_NEW_FALSE='#' @@ -81791,6 +81800,10 @@ if test -z "${GLIBCXX_BUILD_PCH_TRUE}" && test -z "${GLIBCXX_BUILD_PCH_FALSE}"; as_fn_error "conditional \"GLIBCXX_BUILD_PCH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_FLOAT128_TRUE}" && test -z "${ENABLE_FLOAT128_FALSE}"; then + as_fn_error "conditional \"ENABLE_FLOAT128\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_ALLOCATOR_NEW_TRUE}" && test -z "${ENABLE_ALLOCATOR_NEW_FALSE}"; then as_fn_error "conditional \"ENABLE_ALLOCATOR_NEW\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 70a662fa2f9..ba5adda95bd 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -1230,6 +1230,14 @@ stamp-allocator-new: echo 0 > stamp-allocator-new endif +if ENABLE_FLOAT128 +stamp-float128: + echo 1 > stamp-float128 +else +stamp-float128: + echo 0 > stamp-float128 +endif + # NB: The non-empty default ldbl_compat works around an AIX sed # oddity, see libstdc++/31957 for details. ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ @@ -1241,7 +1249,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ stamp-extern-template \ stamp-dual-abi \ stamp-cxx11-abi \ - stamp-allocator-new + stamp-allocator-new \ + stamp-float128 @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\ release=`sed 's/^\([0-9]*\).*$$/\1/' ${toplevel_srcdir}/gcc/BASE-VER` ;\ ns_version=`cat stamp-namespace-version` ;\ @@ -1250,6 +1259,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ dualabi=`cat stamp-dual-abi` ;\ cxx11abi=`cat stamp-cxx11-abi` ;\ allocatornew=`cat stamp-allocator-new` ;\ + float128=`cat stamp-float128` ;\ ldbl_compat='s,g,g,' ;\ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \ ${CONFIG_HEADER} > /dev/null 2>&1 \ @@ -1262,6 +1272,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \ -e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \ -e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \ + -e "s,define _GLIBCXX_USE_FLOAT128, define _GLIBCXX_USE_FLOAT128 $$float128," \ -e "$$ldbl_compat" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 790887a259c..41ccc7befe4 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -1662,6 +1662,11 @@ stamp-host: ${host_headers} ${bits_host_headers} ${ext_host_headers} ${host_head @ENABLE_ALLOCATOR_NEW_FALSE@stamp-allocator-new: @ENABLE_ALLOCATOR_NEW_FALSE@ echo 0 > stamp-allocator-new +@ENABLE_FLOAT128_TRUE@stamp-float128: +@ENABLE_FLOAT128_TRUE@ echo 1 > stamp-float128 +@ENABLE_FLOAT128_FALSE@stamp-float128: +@ENABLE_FLOAT128_FALSE@ echo 0 > stamp-float128 + # NB: The non-empty default ldbl_compat works around an AIX sed # oddity, see libstdc++/31957 for details. ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ @@ -1673,7 +1678,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ stamp-extern-template \ stamp-dual-abi \ stamp-cxx11-abi \ - stamp-allocator-new + stamp-allocator-new \ + stamp-float128 @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\ release=`sed 's/^\([0-9]*\).*$$/\1/' ${toplevel_srcdir}/gcc/BASE-VER` ;\ ns_version=`cat stamp-namespace-version` ;\ @@ -1682,6 +1688,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ dualabi=`cat stamp-dual-abi` ;\ cxx11abi=`cat stamp-cxx11-abi` ;\ allocatornew=`cat stamp-allocator-new` ;\ + float128=`cat stamp-float128` ;\ ldbl_compat='s,g,g,' ;\ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \ ${CONFIG_HEADER} > /dev/null 2>&1 \ @@ -1694,6 +1701,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \ -e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \ -e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \ + -e "s,define _GLIBCXX_USE_FLOAT128, define _GLIBCXX_USE_FLOAT128 $$float128," \ -e "$$ldbl_compat" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 1eb4679f67c..e34524117d6 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -609,4 +609,10 @@ namespace std # endif #endif +/* Define if __float128 is supported on this host. */ +#define _GLIBCXX_USE_FLOAT128 +#if !defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__) +#undef _GLIBCXX_USE_FLOAT128 +#endif + // End of prewritten config; the settings discovered at configure time follow. -- 2.30.2