Reference: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg259436.html https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ad0a3be4df5eecc79075d899fd79179d0f61270e https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=29a9de9b40277af98515eabebb75be1f154e9505 We don't need to decide whether to use __int128 when running configure, we can do so at compilation time by seeing if __SIZEOF_INT128__ is defined and if it's greater than __SIZEOF_LONG_LONG__. This removes another unnecessary architecture-specific config macro in <bits/c++config.h>, so the same header can work for 32-bit or 64-bit compilation on AIX.
374 lines
14 KiB
Diff
374 lines
14 KiB
Diff
From ecd9ba562bc51325560d8a5a83f123d72c96a377 Mon Sep 17 00:00:00 2001
|
|
From: root <root@localhost.localdomain>
|
|
Date: Thu, 14 Apr 2022 18:54:12 +0800
|
|
Subject: [PATCH] Remove _GLIBCXX_USE_INT128 autoconf macro
|
|
[Backport] libstdc++: Remove _GLIBCXX_USE_INT128 autoconf macro
|
|
|
|
Reference: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg259436.html
|
|
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ad0a3be4df5eecc79075d899fd79179d0f61270e
|
|
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=29a9de9b40277af98515eabebb75be1f154e9505
|
|
|
|
We don't need to decide whether to use __int128 when running configure,
|
|
we can do so at compilation time by seeing if __SIZEOF_INT128__ is
|
|
defined and if it's greater than __SIZEOF_LONG_LONG__.
|
|
|
|
This removes another unnecessary architecture-specific config macro in
|
|
<bits/c++config.h>, so the same header can work for 32-bit or 64-bit
|
|
compilation on AIX.
|
|
|
|
---
|
|
libstdc++-v3/acinclude.m4 | 36 +++----------------
|
|
libstdc++-v3/config.h.in | 3 --
|
|
libstdc++-v3/configure | 36 +------------------
|
|
libstdc++-v3/configure.ac | 2 +-
|
|
libstdc++-v3/include/bits/random.h | 2 +-
|
|
.../18_support/numeric_limits/40856.cc | 2 +-
|
|
.../18_support/numeric_limits/dr559.cc | 2 +-
|
|
.../18_support/numeric_limits/lowest.cc | 2 +-
|
|
.../18_support/numeric_limits/max_digits10.cc | 2 +-
|
|
.../20_util/is_floating_point/value.cc | 2 +-
|
|
.../testsuite/20_util/is_integral/value.cc | 2 +-
|
|
.../testsuite/20_util/is_signed/value.cc | 2 +-
|
|
.../testsuite/20_util/is_unsigned/value.cc | 2 +-
|
|
.../make_signed/requirements/typedefs-1.cc | 2 +-
|
|
.../make_signed/requirements/typedefs-2.cc | 2 +-
|
|
.../make_unsigned/requirements/typedefs-1.cc | 2 +-
|
|
.../make_unsigned/requirements/typedefs-2.cc | 2 +-
|
|
.../testsuite/util/testsuite_common_types.h | 4 +--
|
|
18 files changed, 21 insertions(+), 86 deletions(-)
|
|
|
|
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
|
|
index a3f1fdbf6..0fc23b75d 100644
|
|
--- a/libstdc++-v3/acinclude.m4
|
|
+++ b/libstdc++-v3/acinclude.m4
|
|
@@ -3056,15 +3056,14 @@ EOF
|
|
])
|
|
|
|
dnl
|
|
-dnl Check for GNU 128-bit integer and floating point types.
|
|
+dnl Check for GNU 128-bit floating point type.
|
|
dnl
|
|
-dnl Note: also checks that the types aren't standard types.
|
|
+dnl Note: also checks that the type isn't a standard types.
|
|
dnl
|
|
dnl Defines:
|
|
-dnl _GLIBCXX_USE_INT128
|
|
dnl _GLIBCXX_USE_FLOAT128
|
|
dnl
|
|
-AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [
|
|
+AC_DEFUN([GLIBCXX_ENABLE_FLOAT128], [
|
|
|
|
AC_LANG_SAVE
|
|
AC_LANG_CPLUSPLUS
|
|
@@ -3072,34 +3071,7 @@ AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [
|
|
# Fake what AC_TRY_COMPILE does, without linking as this is
|
|
# unnecessary for this test.
|
|
|
|
- cat > conftest.$ac_ext << EOF
|
|
-[#]line __oline__ "configure"
|
|
-template<typename T1, typename T2>
|
|
- struct same
|
|
- { typedef T2 type; };
|
|
-
|
|
-template<typename T>
|
|
- struct same<T, T>;
|
|
-
|
|
-int main()
|
|
-{
|
|
- typename same<long, __int128>::type i1;
|
|
- typename same<long long, __int128>::type i2;
|
|
-}
|
|
-EOF
|
|
-
|
|
- AC_MSG_CHECKING([for __int128])
|
|
- if AC_TRY_EVAL(ac_compile); then
|
|
- AC_DEFINE(_GLIBCXX_USE_INT128, 1,
|
|
- [Define if __int128 is supported on this host.])
|
|
- enable_int128=yes
|
|
- else
|
|
- enable_int128=no
|
|
- fi
|
|
- AC_MSG_RESULT($enable_int128)
|
|
- rm -f conftest*
|
|
-
|
|
- cat > conftest.$ac_ext << EOF
|
|
+ cat > conftest.$ac_ext << EOF
|
|
[#]line __oline__ "configure"
|
|
template<typename T1, typename T2>
|
|
struct same
|
|
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
|
|
index 26790630a..34733c1ab 100644
|
|
--- a/libstdc++-v3/config.h.in
|
|
+++ b/libstdc++-v3/config.h.in
|
|
@@ -921,9 +921,6 @@
|
|
/* Define if get_nprocs is available in <sys/sysinfo.h>. */
|
|
#undef _GLIBCXX_USE_GET_NPROCS
|
|
|
|
-/* Define if __int128 is supported on this host. */
|
|
-#undef _GLIBCXX_USE_INT128
|
|
-
|
|
/* Define if LFS support is available. */
|
|
#undef _GLIBCXX_USE_LFS
|
|
|
|
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
|
|
index 20c4d0120..3c15e43a6 100755
|
|
--- a/libstdc++-v3/configure
|
|
+++ b/libstdc++-v3/configure
|
|
@@ -15392,7 +15392,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
|
|
|
|
# Fake what AC_TRY_COMPILE does.
|
|
|
|
- cat > conftest.$ac_ext << EOF
|
|
+ cat > conftest.$ac_ext << EOF
|
|
#line 15396 "configure"
|
|
int main()
|
|
{
|
|
@@ -15630,40 +15630,6 @@ template<typename T1, typename T2>
|
|
template<typename T>
|
|
struct same<T, T>;
|
|
|
|
-int main()
|
|
-{
|
|
- typename same<long, __int128>::type i1;
|
|
- typename same<long long, __int128>::type i2;
|
|
-}
|
|
-EOF
|
|
-
|
|
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128" >&5
|
|
-$as_echo_n "checking for __int128... " >&6; }
|
|
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
|
- (eval $ac_compile) 2>&5
|
|
- ac_status=$?
|
|
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
- test $ac_status = 0; }; then
|
|
-
|
|
-$as_echo "#define _GLIBCXX_USE_INT128 1" >>confdefs.h
|
|
-
|
|
- enable_int128=yes
|
|
- else
|
|
- enable_int128=no
|
|
- fi
|
|
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_int128" >&5
|
|
-$as_echo "$enable_int128" >&6; }
|
|
- rm -f conftest*
|
|
-
|
|
- cat > conftest.$ac_ext << EOF
|
|
-#line 15659 "configure"
|
|
-template<typename T1, typename T2>
|
|
- struct same
|
|
- { typedef T2 type; };
|
|
-
|
|
-template<typename T>
|
|
- struct same<T, T>;
|
|
-
|
|
int main()
|
|
{
|
|
typename same<double, __float128>::type f1;
|
|
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
|
|
index 9c679ae58..0a757c959 100644
|
|
--- a/libstdc++-v3/configure.ac
|
|
+++ b/libstdc++-v3/configure.ac
|
|
@@ -151,7 +151,7 @@ GLIBCXX_ENABLE_PCH($is_hosted)
|
|
GLIBCXX_ENABLE_THREADS
|
|
GLIBCXX_ENABLE_ATOMIC_BUILTINS
|
|
GLIBCXX_ENABLE_DECIMAL_FLOAT
|
|
-GLIBCXX_ENABLE_INT128_FLOAT128
|
|
+GLIBCXX_ENABLE_FLOAT128
|
|
if test "$enable_float128" = yes; then
|
|
port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/abi/pre/float128.ver"
|
|
fi
|
|
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
|
|
index d39cc3e06..785367463 100644
|
|
--- a/libstdc++-v3/include/bits/random.h
|
|
+++ b/libstdc++-v3/include/bits/random.h
|
|
@@ -101,7 +101,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
|
|
struct _Select_uint_least_t<__s, 2>
|
|
{ typedef unsigned long long type; };
|
|
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#if __SIZEOF_INT128__ > __SIZEOF_LONG_LONG__
|
|
template<int __s>
|
|
struct _Select_uint_least_t<__s, 1>
|
|
{ typedef unsigned __int128 type; };
|
|
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc
|
|
index 8e585509a..1be30385c 100644
|
|
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc
|
|
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/40856.cc
|
|
@@ -20,7 +20,7 @@
|
|
#include <limits>
|
|
|
|
// libstdc++/40856
|
|
-#if defined _GLIBCXX_USE_INT128 && ! defined __STRICT_ANSI__
|
|
+#if defined __SIZEOF_INT128__
|
|
static_assert(std::numeric_limits<__int128>::is_specialized == true, "");
|
|
static_assert(std::numeric_limits<unsigned __int128>::is_specialized == true,
|
|
"");
|
|
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc
|
|
index 10ac39593..fe6775645 100644
|
|
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc
|
|
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/dr559.cc
|
|
@@ -95,7 +95,7 @@ int main()
|
|
do_test<long long>();
|
|
do_test<unsigned long long>();
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
do_test<__int128>();
|
|
do_test<unsigned __int128>();
|
|
#endif
|
|
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
|
|
index 4e3a54187..ecd11cf3b 100644
|
|
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
|
|
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
|
|
@@ -71,7 +71,7 @@ void test01()
|
|
do_test<unsigned long long>();
|
|
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
do_test<__int128>();
|
|
do_test<unsigned __int128>();
|
|
#endif
|
|
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc
|
|
index 9cffe4dea..371668cc5 100644
|
|
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc
|
|
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/max_digits10.cc
|
|
@@ -46,7 +46,7 @@ test01()
|
|
VERIFY( std::numeric_limits<char32_t>::max_digits10 == 0 );
|
|
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
VERIFY( std::numeric_limits<__int128>::max_digits10 == 0 );
|
|
VERIFY( std::numeric_limits<unsigned __int128>::max_digits10 == 0 );
|
|
#endif
|
|
diff --git a/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc b/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc
|
|
index a54079592..3735e43e5 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc
|
|
@@ -53,7 +53,7 @@ void test01()
|
|
static_assert(test_category<is_floating_point, __float128>(true), "");
|
|
#endif
|
|
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
static_assert(test_category<is_floating_point, __int128>(false), "");
|
|
static_assert(test_category<is_floating_point,
|
|
unsigned __int128>(false), "");
|
|
diff --git a/libstdc++-v3/testsuite/20_util/is_integral/value.cc b/libstdc++-v3/testsuite/20_util/is_integral/value.cc
|
|
index 359665ea1..ab28830b1 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/is_integral/value.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/is_integral/value.cc
|
|
@@ -52,7 +52,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
static_assert(test_category<is_integral, __int128>(true), "");
|
|
static_assert(test_category<is_integral, unsigned __int128>(true), "");
|
|
#endif
|
|
diff --git a/libstdc++-v3/testsuite/20_util/is_signed/value.cc b/libstdc++-v3/testsuite/20_util/is_signed/value.cc
|
|
index bff874fce..6cc5c0767 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/is_signed/value.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/is_signed/value.cc
|
|
@@ -51,7 +51,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
static_assert(test_category<is_signed, __int128>(true), "");
|
|
static_assert(test_category<is_signed, unsigned __int128>(false), "");
|
|
#endif
|
|
diff --git a/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc b/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
|
|
index bde019d63..32ef472e2 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
|
|
@@ -51,7 +51,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
static_assert(test_category<is_unsigned, unsigned __int128>(true), "");
|
|
static_assert(test_category<is_unsigned, __int128>(false), "");
|
|
#endif
|
|
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
|
|
index 0bdd3be98..0f55e1e24 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
|
|
@@ -68,7 +68,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
typedef make_signed<unsigned __int128>::type test25_type;
|
|
static_assert( is_same<test25_type, __int128>::value,
|
|
"make_signed<unsigned __int128>" );
|
|
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
|
|
index 18b9445d4..7d5506e15 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
|
|
@@ -61,7 +61,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
typedef make_signed<unsigned __int128>::type test25_type;
|
|
static_assert(is_same<test25_type, __int128>::value, "");
|
|
|
|
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
|
|
index 9f58fd746..51f3e44ec 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
|
|
@@ -62,7 +62,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#if __SIZEOF_INT128__
|
|
typedef make_unsigned<unsigned __int128>::type test25_type;
|
|
static_assert(is_same<test25_type, unsigned __int128>::value, "");
|
|
|
|
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
|
|
index 2fdd68cb8..74f1b18a3 100644
|
|
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
|
|
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
|
|
@@ -61,7 +61,7 @@ void test01()
|
|
|
|
#ifndef __STRICT_ANSI__
|
|
// GNU Extensions.
|
|
-#ifdef _GLIBCXX_USE_INT128
|
|
+#ifdef __SIZEOF_INT128__
|
|
typedef make_unsigned<unsigned __int128>::type test25_type;
|
|
static_assert(is_same<test25_type, unsigned __int128>::value, "");
|
|
|
|
diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h
|
|
index d2efe3af5..ff9121d26 100644
|
|
--- a/libstdc++-v3/testsuite/util/testsuite_common_types.h
|
|
+++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h
|
|
@@ -303,7 +303,7 @@ namespace __gnu_test
|
|
#if __cplusplus >= 201103L
|
|
typedef char16_t a14;
|
|
typedef char32_t a15;
|
|
-# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
|
|
+# if !defined(__STRICT_ANSI__) && defined (__SIZEOF_INT128__)
|
|
__extension__ typedef __int128 a16;
|
|
__extension__ typedef unsigned __int128 a17;
|
|
|
|
@@ -315,7 +315,7 @@ namespace __gnu_test
|
|
a10, a11, a12, a13, a14, a15)> type;
|
|
# endif
|
|
#else
|
|
-# if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
|
|
+# if !defined(__STRICT_ANSI__) && defined (__SIZEOF_INT128__)
|
|
__extension__ typedef __int128 a14;
|
|
__extension__ typedef unsigned __int128 a15;
|
|
|
|
--
|
|
2.27.0
|
|
|