From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id DC02A384144C; Tue, 21 Jun 2022 05:31:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC02A384144C Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 00A4A1160DD; Tue, 21 Jun 2022 01:31:17 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ltwl7aDhVnuU; Tue, 21 Jun 2022 01:31:16 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id BD4E81160DC; Tue, 21 Jun 2022 01:31:16 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 25L5V5IN692608 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 02:31:05 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: [PATCH] libstdc++: testsuite: work around bitset namespace pollution Organization: Free thinker, does not speak for AdaCore Errors-To: aoliva@lxoliva.fsfla.org Date: Tue, 21 Jun 2022 02:31:05 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2022 05:31:20 -0000 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 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, allocator >(); 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, allocator >('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