public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@adacore.com>
To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: [PATCH] libstdc++: testsuite: work around bitset namespace pollution
Date: Tue, 21 Jun 2022 02:31:05 -0300	[thread overview]
Message-ID: <orzgi6eg6e.fsf@lxoliva.fsfla.org> (raw)


rtems6 declares a global struct bitset in a header file included
indirectly by sys/types.h, that ambiguates the unqualified references
to bitset after "using namespace std" in the testsuite.

Work around the namespace pollution with using declarations of
std::bitset.

Regstrapped on x86_64-linux-gnu, also tested with a cross to
aarch64-rtems6.0.  Ok to install?


for  libstdc++-v3/ChangeLog

	* testsuite/23_containers/bitset/cons/dr1325-2.cc: Work around
	global struct bitset.
	* testsuite/23_containers/bitset/ext/15361.cc: Likewise.
	* testsuite/23_containers/bitset/input/1.cc: Likewise.
	* testsuite/23_containers/bitset/to_string/1.cc: Likewise.
	* testsuite/23_containers/bitset/to_string/dr396.cc: Likewise.
---
 .../23_containers/bitset/cons/dr1325-2.cc          |    1 +
 .../testsuite/23_containers/bitset/ext/15361.cc    |    1 +
 .../testsuite/23_containers/bitset/input/1.cc      |    1 +
 .../testsuite/23_containers/bitset/to_string/1.cc  |    1 +
 .../23_containers/bitset/to_string/dr396.cc        |    1 +
 5 files changed, 5 insertions(+)

diff --git a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
index 4b79c9f046dbc..2371bef09cca7 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/cons/dr1325-2.cc
@@ -39,6 +39,7 @@ template<std::size_t Nb, typename CharT>
 void test01()
 {
   using namespace std;
+  using std::bitset; // Work around struct ::bitset on rtems.
 
   const char s1[4] = { '0', '1', '0', '1' };
   VERIFY( bitset<4>(s1, 4) == test01_ref<4>(s1, 4) );
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc b/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
index 40cb94966ab8f..392470084aee5 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/ext/15361.cc
@@ -22,6 +22,7 @@
 void test01()
 {
   using namespace std;
+  using std::bitset; // Work around struct ::bitset on rtems.
 
   bitset<256> b;
   b.set(225);
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc
index 8738c77238377..939861b171eaa 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/input/1.cc
@@ -26,6 +26,7 @@
 void test01()
 {
   using namespace std;
+  using std::bitset; // Work around struct ::bitset on rtems.
 
   bitset<5>      b5;
   bitset<0>      b0;
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc
index f4af91373cc37..8384eb96d2547 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/to_string/1.cc
@@ -25,6 +25,7 @@
 void test01()
 {
   using namespace std;
+  using std::bitset; // Work around struct ::bitset on rtems.
 
   bitset<5> b5;
   string s0 = b5.to_string<char, char_traits<char>, allocator<char> >();
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc b/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc
index 8faded348479a..dfba27ed3afa1 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/to_string/dr396.cc
@@ -26,6 +26,7 @@
 void test01()
 {
   using namespace std;
+  using std::bitset; // Work around struct ::bitset on rtems.
 
   bitset<5> b5;
   string s0 = b5.to_string<char, char_traits<char>, allocator<char> >('a', 'b');


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

             reply	other threads:[~2022-06-21  5:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21  5:31 Alexandre Oliva [this message]
2022-06-21  7:37 ` Jonathan Wakely
2022-06-24  9:56 ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=orzgi6eg6e.fsf@lxoliva.fsfla.org \
    --to=oliva@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).