aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsen Arsenović <arsen@aarsen.me>2022-09-28 21:30:11 +0200
committerJonathan Wakely <jwakely@redhat.com>2022-10-03 15:43:49 +0100
commit54fd7d81709c5f50537128d3978b4c642b68a711 (patch)
tree69f9f30d6cf6710979c5259dcadc1550e276a109
parent25ebfdb774c0e8cc6c55e02644ee2cb157ce29d7 (diff)
downloadgcc-54fd7d81709c5f50537128d3978b4c642b68a711.zip
gcc-54fd7d81709c5f50537128d3978b4c642b68a711.tar.gz
gcc-54fd7d81709c5f50537128d3978b4c642b68a711.tar.bz2
libstdc++: Re-enable std::hash<std::bitset> in freestanding [PR103626]
PR libstdc++/103626 - _GLIBCXX_HOSTED should respect -ffreestanding libstdc++-v3/ChangeLog: PR libstdc++/103626 * include/std/bitset [!_GLIBCXX_HOSTED]: Re-enable std::hash. * testsuite/20_util/bitset/cons/constexpr_c++23.cc: Require ET hosted. * testsuite/20_util/bitset/ext/constexpr.cc: Likewise.
-rw-r--r--libstdc++-v3/include/std/bitset9
-rw-r--r--libstdc++-v3/testsuite/20_util/bitset/cons/constexpr_c++23.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/bitset/ext/constexpr.cc2
3 files changed, 9 insertions, 4 deletions
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 1038cc6..10fb05a 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -52,9 +52,10 @@
# include <string>
# include <iosfwd>
# include <bits/cxxabi_forced.h>
-# if __cplusplus >= 201103L
-# include <bits/functional_hash.h>
-# endif
+#endif
+
+#if __cplusplus >= 201103L
+# include <bits/functional_hash.h>
#endif
#define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_LONG__)
@@ -1664,7 +1665,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
#undef _GLIBCXX_BITSET_BITS_PER_WORD
#undef _GLIBCXX_BITSET_BITS_PER_ULL
-#if __cplusplus >= 201103L && _GLIBCXX_HOSTED
+#if __cplusplus >= 201103L
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/testsuite/20_util/bitset/cons/constexpr_c++23.cc b/libstdc++-v3/testsuite/20_util/bitset/cons/constexpr_c++23.cc
index 532fc9d..d308c2b 100644
--- a/libstdc++-v3/testsuite/20_util/bitset/cons/constexpr_c++23.cc
+++ b/libstdc++-v3/testsuite/20_util/bitset/cons/constexpr_c++23.cc
@@ -1,5 +1,7 @@
// { dg-options "-std=gnu++23" }
// { dg-do compile { target c++23 } }
+// This test relies on std::string.
+// { dg-require-effective-target hosted }
#include <bitset>
diff --git a/libstdc++-v3/testsuite/20_util/bitset/ext/constexpr.cc b/libstdc++-v3/testsuite/20_util/bitset/ext/constexpr.cc
index f82e7aa..4bacefa 100644
--- a/libstdc++-v3/testsuite/20_util/bitset/ext/constexpr.cc
+++ b/libstdc++-v3/testsuite/20_util/bitset/ext/constexpr.cc
@@ -1,5 +1,7 @@
// { dg-options "-std=gnu++23" }
// { dg-do compile { target c++23 } }
+// This test relies on std::string.
+// { dg-require-effective-target hosted }
#include <bitset>
#include <testsuite_hooks.h>