https://gcc.gnu.org/g:d39ca567e695ceef1ca83637af99f32af2c228b8

commit r17-667-gd39ca567e695ceef1ca83637af99f32af2c228b8
Author: Jonathan Wakely <[email protected]>
Date:   Thu May 21 23:13:53 2026 +0100

    libstdc++: Combine duplicated tests for <atomic>
    
    The types_std_c++0x.cc and types_std_c++20.cc tests are almost
    identical, and the latter is redundant now that we can (and do) run all
    tests for any -std option, and run with -std=gnu++20 by default.
    Likewise for the _neg.cc tests.
    
    Merge the C++20-specific parts into the c++0x tests and remove the c++20
    ones.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Check
            for C++20 std::memory_order enum. Use feature test macro for
            char8_t.
            * testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc:
            Add check for atomic_char8_t.
            * testsuite/29_atomics/headers/atomic/types_std_c++20.cc:
            Removed.
            * testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc:
            Removed.
            * testsuite/29_atomics/headers/atomic/types_std_c++2a.cc:
            Removed.

Diff:
---
 .../29_atomics/headers/atomic/types_std_c++0x.cc   | 15 +++-
 .../headers/atomic/types_std_c++0x_neg.cc          |  1 +
 .../29_atomics/headers/atomic/types_std_c++20.cc   | 95 ----------------------
 .../headers/atomic/types_std_c++20_neg.cc          | 80 ------------------
 .../29_atomics/headers/atomic/types_std_c++2a.cc   | 31 -------
 5 files changed, 15 insertions(+), 207 deletions(-)

diff --git 
a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc 
b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
index 809b07e29ad5..2b0685345c33 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x.cc
@@ -30,6 +30,19 @@ void test01()
   using std::memory_order_acq_rel;
   using std::memory_order_seq_cst;
 
+#if __cplusplus >= 202002L
+  using std::memory_order;
+  constexpr auto relaxed = memory_order::relaxed;
+  constexpr auto consume = memory_order::consume;
+  constexpr auto acquire = memory_order::acquire;
+  constexpr auto release = memory_order::release;
+  constexpr auto acq_rel = memory_order::acq_rel;
+  constexpr auto seq_cst = memory_order::seq_cst;
+#ifdef __cpp_lib_is_scoped_enum
+  static_assert(std::is_scoped_enum_v<std::memory_order>);
+#endif
+#endif
+
   using std::atomic_flag;
 
   // atomics for builtins types
@@ -46,7 +59,7 @@ void test01()
   using std::atomic_llong;
   using std::atomic_ullong;
   using std::atomic_wchar_t;
-#ifdef _GLIBCXX_USE_CHAR8_T
+#ifdef __cpp_lib_char8_t
   using std::atomic_char8_t;
 #endif
   using std::atomic_char16_t;
diff --git 
a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc 
b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
index 6a83a7b981ee..554364c0fcc3 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc
@@ -45,6 +45,7 @@ void test01()
   using atomic_llong;          // { dg-error "expected nested-name-specifier" }
   using atomic_ullong;         // { dg-error "expected nested-name-specifier" }
   using atomic_wchar_t;                // { dg-error "expected 
nested-name-specifier" }
+  using atomic_char8_t;                // { dg-error "expected 
nested-name-specifier" }
   using atomic_char16_t;       // { dg-error "expected nested-name-specifier" }
   using atomic_char32_t;       // { dg-error "expected nested-name-specifier" }
 
diff --git 
a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc 
b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc
deleted file mode 100644
index 4c22b8ca7077..000000000000
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// { dg-do compile { target c++20 } }
-// { dg-require-cstdint "" }
-
-// Copyright (C) 2008-2026 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3.  If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <atomic>
-
-void test01()
-{
-  using std::memory_order;
-  // TODO add checks for new enumerators memory_order::relaxed etc.
-  // using std::memory_order::relaxed;
-  // using std::memory_order::consume;
-  // using std::memory_order::acquire;
-  // using std::memory_order::release;
-  // using std::memory_order::acq_rel;
-  // using std::memory_order::seq_cst;
-  using std::memory_order_relaxed;
-  using std::memory_order_consume;
-  using std::memory_order_acquire;
-  using std::memory_order_release;
-  using std::memory_order_acq_rel;
-  using std::memory_order_seq_cst;
-
-  using std::atomic_flag;
-
-  // atomics for builtins types
-  using std::atomic_bool;
-  using std::atomic_char;
-  using std::atomic_schar;
-  using std::atomic_uchar;
-  using std::atomic_short;
-  using std::atomic_ushort;
-  using std::atomic_int;
-  using std::atomic_uint;
-  using std::atomic_long;
-  using std::atomic_ulong;
-  using std::atomic_llong;
-  using std::atomic_ullong;
-  using std::atomic_wchar_t;
-#ifdef _GLIBCXX_USE_CHAR8_T
-  using std::atomic_char8_t;
-#endif
-  using std::atomic_char16_t;
-  using std::atomic_char32_t;
-
-  // atomics for standard typedefs
-  using std::atomic_int_least8_t;
-  using std::atomic_uint_least8_t;
-  using std::atomic_int_least16_t;
-  using std::atomic_uint_least16_t;
-  using std::atomic_int_least32_t;
-  using std::atomic_uint_least32_t;
-  using std::atomic_int_least64_t;
-  using std::atomic_uint_least64_t;
-  using std::atomic_int_fast8_t;
-  using std::atomic_uint_fast8_t;
-  using std::atomic_int_fast16_t;
-  using std::atomic_uint_fast16_t;
-  using std::atomic_int_fast32_t;
-  using std::atomic_uint_fast32_t;
-  using std::atomic_int_fast64_t;
-  using std::atomic_uint_fast64_t;
-  using std::atomic_intptr_t;
-  using std::atomic_uintptr_t;
-  using std::atomic_size_t;
-  using std::atomic_ptrdiff_t;
-  using std::atomic_intmax_t;
-  using std::atomic_uintmax_t;
-
-  // DR 2441
-  using std::atomic_int8_t;
-  using std::atomic_uint8_t;
-  using std::atomic_int16_t;
-  using std::atomic_uint16_t;
-  using std::atomic_int32_t;
-  using std::atomic_uint32_t;
-  using std::atomic_int64_t;
-  using std::atomic_uint64_t;
-}
diff --git 
a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc 
b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc
deleted file mode 100644
index 518d26d1818a..000000000000
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// { dg-do compile { target c++20 } }
-// { dg-require-cstdint "" }
-
-// Copyright (C) 2009-2026 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3.  If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <atomic>
-
-void test01()
-{
-  // Not global scoped, only namespace std.
-  using memory_order;          // { dg-error "expected nested-name-specifier" }
-  // TODO add checks for new enumerators memory_order::relaxed etc.
-  using memory_order_relaxed;  // { dg-error "expected nested-name-specifier" }
-  using memory_order_consume;  // { dg-error "expected nested-name-specifier" }
-  using memory_order_acquire;  // { dg-error "expected nested-name-specifier" }
-  using memory_order_release;  // { dg-error "expected nested-name-specifier" }
-  using memory_order_acq_rel;  // { dg-error "expected nested-name-specifier" }
-  using memory_order_seq_cst;  // { dg-error "expected nested-name-specifier" }
-
-  using atomic_flag;           // { dg-error "expected nested-name-specifier" }
-
-  using atomic_bool;           // { dg-error "expected nested-name-specifier" }
-  using atomic_char;           // { dg-error "expected nested-name-specifier" }
-  using atomic_schar;          // { dg-error "expected nested-name-specifier" }
-  using atomic_uchar;          // { dg-error "expected nested-name-specifier" }
-  using atomic_short;          // { dg-error "expected nested-name-specifier" }
-  using atomic_ushort;         // { dg-error "expected nested-name-specifier" }
-  using atomic_int;            // { dg-error "expected nested-name-specifier" }
-  using atomic_uint;           // { dg-error "expected nested-name-specifier" }
-  using atomic_long;           // { dg-error "expected nested-name-specifier" }
-  using atomic_ulong;          // { dg-error "expected nested-name-specifier" }
-  using atomic_llong;          // { dg-error "expected nested-name-specifier" }
-  using atomic_ullong;         // { dg-error "expected nested-name-specifier" }
-  using atomic_wchar_t;                // { dg-error "expected 
nested-name-specifier" }
-  using atomic_char8_t;                // { dg-error "expected 
nested-name-specifier" }
-  using atomic_char16_t;       // { dg-error "expected nested-name-specifier" }
-  using atomic_char32_t;       // { dg-error "expected nested-name-specifier" }
-
-  using atomic_int_least8_t;   // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_least8_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_int_least16_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_least16_t; // { dg-error "expected nested-name-specifier" }
-  using atomic_int_least32_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_least32_t; // { dg-error "expected nested-name-specifier" }
-  using atomic_int_least64_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_least64_t; // { dg-error "expected nested-name-specifier" }
-  using atomic_int_fast8_t;    // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_fast8_t;   // { dg-error "expected nested-name-specifier" }
-  using atomic_int_fast16_t;   // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_fast16_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_int_fast32_t;   // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_fast32_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_int_fast64_t;   // { dg-error "expected nested-name-specifier" }
-  using atomic_uint_fast64_t;  // { dg-error "expected nested-name-specifier" }
-  using atomic_intptr_t;       // { dg-error "expected nested-name-specifier" }
-  using atomic_uintptr_t;      // { dg-error "expected nested-name-specifier" }
-  using atomic_size_t;         // { dg-error "expected nested-name-specifier" }
-  using atomic_ptrdiff_t;      // { dg-error "expected nested-name-specifier" }
-  using atomic_intmax_t;       // { dg-error "expected nested-name-specifier" }
-  using atomic_uintmax_t;      // { dg-error "expected nested-name-specifier" }
-
-  using atomic_address;                // { dg-error "expected 
nested-name-specifier" }
-  // Present in C++0x drafts but not final C++11 standard:
-  using std::atomic_address;   // { dg-error "has not been declared" }
-}
diff --git 
a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a.cc 
b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a.cc
deleted file mode 100644
index 3751bb65f99f..000000000000
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// { dg-do compile { target c++20 } }
-
-// Copyright (C) 2019-2026 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3.  If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <atomic>
-
-void test01()
-{
-  using std::memory_order;
-  constexpr auto relaxed = memory_order::relaxed;
-  constexpr auto consume = memory_order::consume;
-  constexpr auto acquire = memory_order::acquire;
-  constexpr auto release = memory_order::release;
-  constexpr auto acq_rel = memory_order::acq_rel;
-  constexpr auto seq_cst = memory_order::seq_cst;
-}

Reply via email to