[committed] libstdc++: Minor tweak to C++20 status docs

2023-09-18 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk.

-- >8 --

The row for P1466R3 was missing the info on when it was implemented.

libstdc++-v3/ChangeLog:

* doc/xml/manual/status_cxx2020.xml: Tweak P1466R3 status.
* doc/html/manual/status.html: Regenerate.
---
 libstdc++-v3/doc/html/manual/status.html   | 2 +-
 libstdc++-v3/doc/xml/manual/status_cxx2020.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml 
b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
index 6e560069cbc..d6359d50f42 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
@@ -572,7 +572,7 @@ or any notes about the implementation.
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1466r3.html;>
 P1466R3 
   
-  
+   11.1 (see Note 2) 
__cpp_lib_chrono = 201907L 
 
 
-- 
2.41.0



[committed] libstdc++: Update C++20 and C++23 status docs

2023-09-18 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk. Most of this should be backported to gcc-13 too.

We also need a C++26 status page, which doesn't exist yet.

-- 8 --

libstdc++-v3/ChangeLog:

* doc/xml/manual/configure.xml: Use conventional option name.
* doc/xml/manual/status_cxx2020.xml: Update.
* doc/xml/manual/status_cxx2023.xml: Update.
* doc/html/*: Regenerate.
---
 libstdc++-v3/doc/html/manual/configure.html   |   4 +-
 libstdc++-v3/doc/html/manual/status.html  | 255 --
 libstdc++-v3/doc/xml/manual/configure.xml |   4 +-
 .../doc/xml/manual/status_cxx2020.xml |  44 +-
 .../doc/xml/manual/status_cxx2023.xml | 474 +-
 5 files changed, 717 insertions(+), 64 deletions(-)

diff --git a/libstdc++-v3/doc/xml/manual/configure.xml 
b/libstdc++-v3/doc/xml/manual/configure.xml
index 1b8c37ce2a9..0a477ab85e5 100644
--- a/libstdc++-v3/doc/xml/manual/configure.xml
+++ b/libstdc++-v3/doc/xml/manual/configure.xml
@@ -341,8 +341,8 @@
C++ includes. If enabled (as by default), and the compiler
seems capable of passing the simple sanity checks thrown at
it, try to build stdc++.h.gch as part of the make process.
-   In addition, this generated file is used later on (by appending 
-   --include bits/stdc++.h  to CXXFLAGS) when running the
+   In addition, this generated file is used later on (by appending
+   -include bits/stdc++.h to CXXFLAGS) when running the
testsuite.
  
  
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml 
b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
index da911169cc8..6e560069cbc 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml
@@ -251,14 +251,13 @@ or any notes about the implementation.
 
 
 
-  
 Improving Completeness Requirements for Type Traits 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1285r0.pdf;>
 P1285R0 
   
-   Partial 
-  
+
+   Most misuses are diagnosed, but not all. 
 
 
 
@@ -541,13 +540,12 @@ or any notes about the implementation.
 
 
 
-  
Avoid template bloat for safe_ranges in combination 
with ‘subrange-y’ view adaptors.
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1739r4.html;>
 P1739R4 
   
-   
+   12.1 
   
 
 
@@ -559,18 +557,16 @@ or any notes about the implementation.
 
 
 
-  
 Extending chrono to Calendars and Time Zones 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0355r7.html;>
 P0355R7 
   
-  
+   14.1 (see Note 2) 
__cpp_lib_chrono = 201803L 
 
 
 
-  
Miscellaneous minor fixes for chrono 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1466r3.html;>
@@ -667,39 +663,36 @@ or any notes about the implementation.
 
 
 
-  
Text formatting 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0645r10.html;>
 P0645R10 
   
-   
+   13.1 
   
 __cpp_lib_format = 201907L
   
 
 
 
-  
Integration of chrono with text formatting 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1361r2.pdf;>
 P1361R2 
   
-   
+   13.1 
   
 __cpp_lib_format = 201907L
   
 
 
 
-  
Printf corner cases in std::format 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1652r1.html;>
 P1652R1 
   
-   
+   13.1 
   
 __cpp_lib_format = 201907L
   
@@ -716,13 +709,12 @@ or any notes about the implementation.
 
 
 
-  
 Update The Reference To The Unicode Standard 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1025r1.html;>
 P1025R1 
   
-   
+   
   
 
 
@@ -796,13 +788,12 @@ or any notes about the implementation.
 
 
 
-  
 Comparing Unordered Containers 
   
 http://www.w3.org/1999/xlink; 
xlink:href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0809r0.pdf;>
 P0809R0 
   
-   
+
   
 
 
@@ -1039,7 +1030,7 @@ or any notes about the implementation.
 P0551R3 
   

-  
+  These changes will not be implemented.
 
 
 
@@ -1113,13 +1104,12 @@ or any notes about the implementation.
 
 
 
-  
 Standard Library Specification in a Concepts and Contracts 

[wwwdocs] Document libstdc++ changes in GCC 14

2023-09-18 Thread Jonathan Wakely via Gcc-patches
Pushed to wwwdocs.


---
 htdocs/gcc-14/changes.html | 48 +-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index eae25f1a..65382746 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -97,7 +97,53 @@ a work-in-progress.
   
 
 
-
+Runtime Library (libstdc++)
+
+
+  
+The libstdc++exp.a library now includes all the Filesystem TS
+symbols from the libstdc++fs.a library.
+The experimental symbols for the C++23 std::stacktrace class
+are also in libstdc++exp.a, replacing the
+libstdc++_libbacktrace.a library that GCC 13 provides.
+This means that -lstdc++exp is the only library needed for
+all experimental libstdc++ features.
+  
+  Improved experimental support for C++20, including:
+
+std::chrono::parse.
+
+  
+  Improved experimental support for C++23, including:
+
+The stacktrace header is supported by default.
+
+Formatters for std::thread::id and
+  std::stacktrace.
+
+Some range adaptors now support move-only types.
+
+  
+  Experimental support for C++26, including:
+
+Native handles for filebuf, fstream, 
etc.
+std::to_string now uses std::format.
+Enhanced formatting of pointers with std::format.
+Testable result types for charconv functions.
+
+  
+  Faster numeric conversions using std::to_string and
+std::to_wstring.
+  
+  Updated parallel algorithms that are compatible with oneTBB.
+  std::numeric_limits_Float32 and
+std::numeric_limits_Float64 are now defined
+for all standard modes, not only for C++23.
+  
+  Using the std::setfill manipulator with
+std::istream is deprecated.
+  
+
 
 
 
-- 
2.41.0



[committed] libstdc++: Minor update to installation docs

2023-09-18 Thread Jonathan Wakely via Gcc-patches
Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

* doc/xml/manual/intro.xml: Clarify that building libstdc++
separately from GCC is not supported.
* doc/xml/manual/prerequisites.xml: Note msgfmt prerequisite for
testing.
* doc/html/manual/setup.html: Regenerate.
---
 libstdc++-v3/doc/html/manual/setup.html   | 28 +--
 libstdc++-v3/doc/xml/manual/intro.xml |  8 +++---
 libstdc++-v3/doc/xml/manual/prerequisites.xml | 21 --
 3 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/libstdc++-v3/doc/xml/manual/intro.xml 
b/libstdc++-v3/doc/xml/manual/intro.xml
index 03d538546b7..f5037acdb5c 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -1327,13 +1327,13 @@ requirements of the license of GCC.
   
 
 
-   To transform libstdc++ sources into installed include files
+   Transforming libstdc++ sources into installed include files
and properly built binaries useful for linking to other software is
-   a multi-step process. Steps include getting the sources,
-   configuring and building the sources, testing, and installation.
+   done as part of building GCC. Building libstdc++ separately from the
+   rest of GCC is not supported.

 
-   The general outline of commands is something like:
+   The general outline of commands to build GCC is something like:

 

diff --git a/libstdc++-v3/doc/xml/manual/prerequisites.xml 
b/libstdc++-v3/doc/xml/manual/prerequisites.xml
index f00979a1afa..a02d3795830 100644
--- a/libstdc++-v3/doc/xml/manual/prerequisites.xml
+++ b/libstdc++-v3/doc/xml/manual/prerequisites.xml
@@ -103,8 +103,10 @@ ln -s libiconv-1.16 libiconv

  If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt
  will be made to use "C" library functionality necessary for
- C++ named locale support.  For GCC 4.6.0 and later, this
- means that glibc 2.3 or later is required.
+ C++ named locale support, e.g. the newlocale
+ and uselocale functions.
+ For GCC 4.6.0 and later,
+ this means that glibc 2.3 or later is required.

 

@@ -153,7 +155,10 @@ zh_TW   BIG5
 
   

- install all locales
+ install all locales, e.g., run
+dnf install glibc-all-langpacks 
+   for Fedora and related distributions.
+ 


  install just the necessary locales
@@ -178,6 +183,16 @@ zh_TW   BIG5

   
   
+
+  
+   Some tests for the std::messages facet require a
+   message catalog created by the msgfmt utility.
+   That is usually installed as part of the GNU gettext library.
+   If msgfmt is not available, some tests under
+   the 22_locale/messages
+   directory will fail.
+  
+
   

 
-- 
2.41.0



[committed 08/11] libstdc++: Remove dg-options "-std=gnu++20" from 27_io tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_istream/extractors_character/char/lwg2499.cc:
Remove dg-options -std=gnu++2a.
* 
testsuite/27_io/basic_istream/extractors_character/char/lwg2499_neg.cc:
Likewise.
* testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499.cc:
Likewise.
* 
testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499_neg.cc:
Likewise.
* testsuite/27_io/basic_istringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_istringstream/str/char/2.cc: Likewise.
* testsuite/27_io/basic_istringstream/str/wchar_t/2.cc:
Likewise.
* testsuite/27_io/basic_istringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_ostream/emit/1.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_character/char/deleted.cc:
Likewise.
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/deleted.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/str/char/3.cc: Likewise.
* testsuite/27_io/basic_ostringstream/str/wchar_t/3.cc:
Likewise.
* testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_stringbuf/cons/char/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_stringbuf/str/char/4.cc: Likewise.
* testsuite/27_io/basic_stringbuf/str/wchar_t/4.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/char/1.cc: Likewise.
* testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/cons/char/97719.cc:
Likewise.
* testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_stringstream/str/char/5.cc: Likewise.
* testsuite/27_io/basic_stringstream/str/wchar_t/5.cc.cc:
Likewise.
* testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise.
* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc:
Likewise.
* testsuite/27_io/basic_syncbuf/1.cc: Likewise.
* testsuite/27_io/basic_syncbuf/2.cc: Likewise.
* testsuite/27_io/basic_syncbuf/basic_ops/1.cc: Likewise.
* testsuite/27_io/basic_syncbuf/requirements/types.cc: Likewise.
* testsuite/27_io/basic_syncbuf/sync_ops/1.cc: Likewise.
* testsuite/27_io/basic_syncstream/1.cc: Likewise.
* testsuite/27_io/basic_syncstream/2.cc: Likewise.
* testsuite/27_io/basic_syncstream/basic_ops/1.cc: Likewise.
* testsuite/27_io/basic_syncstream/requirements/types.cc:
Likewise.
* testsuite/27_io/filesystem/iterators/106201.cc: Likewise.
* testsuite/27_io/filesystem/iterators/lwg3719.cc: Likewise.
* testsuite/27_io/filesystem/path/factory/u8path-depr.cc:
Likewise.
* testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc:
Likewise.
---
 .../27_io/basic_istream/extractors_character/char/lwg2499.cc   | 3 +--
 .../basic_istream/extractors_character/char/lwg2499_neg.cc | 3 +--
 .../basic_istream/extractors_character/wchar_t/lwg2499.cc  | 3 +--
 .../basic_istream/extractors_character/wchar_t/lwg2499_neg.cc  | 3 +--
 .../testsuite/27_io/basic_istringstream/cons/char/1.cc | 3 +--
 .../testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc  | 3 +--
 libstdc++-v3/testsuite/27_io/basic_istringstream/str/char/2.cc | 3 +--
 .../testsuite/27_io/basic_istringstream/str/wchar_t/2.cc   | 3 +--
 .../testsuite/27_io/basic_istringstream/view/char/1.cc | 3 +--
 .../testsuite/27_io/basic_istringstream/view/wchar_t/1.cc  | 3 +--
 libstdc++-v3/testsuite/27_io/basic_ostream/emit/1.cc   | 3 +--
 .../27_io/basic_ostream/inserters_character/char/deleted.cc| 3 +--
 .../27_io/basic_ostream/inserters_character/wchar_t/deleted.cc | 3 +--
 .../testsuite/27_io/basic_ostringstream/cons/char/1.cc | 3 +--
 .../testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc  | 3 +--
 libstdc++-v3/testsuite/27_io/basic_ostringstream/str/char/3.cc | 3 +--
 .../testsuite/27_io/basic_ostringstream/str/wchar_t/3.cc   | 3 +--
 .../testsuite/27_io/basic_ostringstream/view/char/1.cc | 3 +--
 

[committed 11/11] libstdc++: Do not require effective target pthread for some tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

We can remove { dg-require-effective-target pthread } and allow these
tests non-pthread targets and conditionally adding -pthread only for
pthread targets.

Also remove the { dg-options "-std=gnu++20" } that is no longer needed.

libstdc++-v3/ChangeLog:

* testsuite/29_atomics/atomic_ref/wait_notify.cc: Do not
restrict to pthreads targets.
* testsuite/30_threads/jthread/3.cc: Likewise.
* testsuite/30_threads/semaphore/100806.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire_for.cc: Likewise.
* testsuite/30_threads/semaphore/try_acquire_posix.cc: Likewise.
---
 libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc  | 5 ++---
 libstdc++-v3/testsuite/30_threads/jthread/3.cc   | 5 ++---
 libstdc++-v3/testsuite/30_threads/semaphore/100806.cc| 5 ++---
 libstdc++-v3/testsuite/30_threads/semaphore/try_acquire.cc   | 5 ++---
 .../testsuite/30_threads/semaphore/try_acquire_for.cc| 5 ++---
 .../testsuite/30_threads/semaphore/try_acquire_posix.cc  | 5 ++---
 6 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc 
b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
index ede46467dac..05316f7a15e 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/wait_notify.cc
@@ -1,6 +1,5 @@
-// { dg-options "-std=gnu++2a -pthread" }
-// { dg-do run { target c++2a } }
-// { dg-require-effective-target pthread }
+// { dg-do run { target c++20 } }
+// { dg-additional-options "-pthread" { target pthread } }
 // { dg-require-gthreads "" }
 // { dg-add-options libatomic }
 
diff --git a/libstdc++-v3/testsuite/30_threads/jthread/3.cc 
b/libstdc++-v3/testsuite/30_threads/jthread/3.cc
index ef0252a678f..796481c5ef6 100644
--- a/libstdc++-v3/testsuite/30_threads/jthread/3.cc
+++ b/libstdc++-v3/testsuite/30_threads/jthread/3.cc
@@ -15,9 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a -pthread" }
-// { dg-do compile { target c++2a } }
-// { dg-require-effective-target pthread }
+// { dg-do compile { target c++20 } }
+// { dg-additional-options "-pthread" { target pthread } }
 // { dg-require-gthreads "" }
 
 #include 
diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/100806.cc 
b/libstdc++-v3/testsuite/30_threads/semaphore/100806.cc
index 2fa2628a278..c770f05be00 100644
--- a/libstdc++-v3/testsuite/30_threads/semaphore/100806.cc
+++ b/libstdc++-v3/testsuite/30_threads/semaphore/100806.cc
@@ -1,6 +1,5 @@
-// { dg-options "-std=gnu++2a -pthread" }
-// { dg-do run { target c++2a } }
-// { dg-require-effective-target pthread }
+// { dg-do run { target c++20 } }
+// { dg-additional-options "-pthread" { target pthread } }
 // { dg-require-gthreads "" }
 // { dg-add-options libatomic }
 
diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire.cc 
b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire.cc
index b9661aa8fa2..082ab17dd16 100644
--- a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire.cc
+++ b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire.cc
@@ -15,9 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a -pthread" }
-// { dg-do run { target c++2a } }
-// { dg-require-effective-target pthread }
+// { dg-do run { target c++20 } }
+// { dg-additional-options "-pthread" { target pthread } }
 // { dg-require-gthreads "" }
 // { dg-add-options libatomic }
 
diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_for.cc 
b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_for.cc
index 250bfe37f7e..901e15c08ed 100644
--- a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_for.cc
+++ b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_for.cc
@@ -15,9 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a -pthread" }
-// { dg-do run { target c++2a } }
-// { dg-require-effective-target pthread }
+// { dg-do run { target c++20 } }
+// { dg-additional-options "-pthread" { target pthread } }
 // { dg-require-gthreads "" }
 // { dg-add-options libatomic }
 
diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_posix.cc 
b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_posix.cc
index a8f0fe3ad2c..8828212ed61 100644
--- a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_posix.cc
+++ b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_posix.cc
@@ -15,9 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a -pthread" }
-// { dg-do run { target c++2a } }
-// { 

[committed 10/11] libstdc++: Remove dg-options "-std=gnu++20" from remaining tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/18_support/coroutines/95917.cc: Remove dg-options
-std=gnu++2a.
* testsuite/18_support/coroutines/hash.cc: Likewise.
* testsuite/18_support/coroutines/lwg3460.cc: Likewise.
* testsuite/18_support/destroying_delete.cc: Likewise.
* testsuite/18_support/source_location/1.cc: Likewise.
* testsuite/18_support/source_location/consteval.cc: Likewise.
* testsuite/18_support/source_location/version.cc: Likewise.
* testsuite/19_diagnostics/error_category/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/error_code/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/operators/three_way.cc:
Likewise.
* testsuite/19_diagnostics/stacktrace/output.cc: Likewise.
* testsuite/26_numerics/adjacent_difference/lwg2055.cc:
Likewise.
* testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc:
Likewise.
* testsuite/28_regex/iterators/regex_iterator/lwg3719.cc:
Likewise.
* testsuite/28_regex/iterators/regex_token_iterator/lwg3719.cc:
Likewise.
* testsuite/28_regex/sub_match/compare_c++20.cc: Likewise.
* testsuite/experimental/filesystem/iterators/106201.cc:
Likewise.
* testsuite/experimental/scopeguard/exit.cc: Likewise.
* testsuite/experimental/scopeguard/uniqueres.cc: Likewise.
---
 libstdc++-v3/testsuite/18_support/coroutines/95917.cc| 4 ++--
 libstdc++-v3/testsuite/18_support/coroutines/hash.cc | 3 +--
 libstdc++-v3/testsuite/18_support/coroutines/lwg3460.cc  | 3 +--
 libstdc++-v3/testsuite/18_support/destroying_delete.cc   | 3 +--
 libstdc++-v3/testsuite/18_support/source_location/1.cc   | 4 ++--
 .../testsuite/18_support/source_location/consteval.cc| 5 ++---
 libstdc++-v3/testsuite/18_support/source_location/version.cc | 3 +--
 .../19_diagnostics/error_category/operators/three_way.cc | 3 +--
 .../19_diagnostics/error_code/operators/three_way.cc | 3 +--
 .../19_diagnostics/error_condition/operators/three_way.cc| 3 +--
 libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc   | 1 -
 .../testsuite/26_numerics/adjacent_difference/lwg2055.cc | 3 +--
 .../testsuite/26_numerics/bit/bit.count/countl_zero.cc   | 3 +--
 .../testsuite/26_numerics/bit/bit.count/countr_one.cc| 3 +--
 .../testsuite/26_numerics/bit/bit.count/countr_zero.cc   | 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/bit.count/popcount.cc | 3 +--
 .../testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc| 3 +--
 .../testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc  | 3 +--
 .../testsuite/28_regex/iterators/regex_iterator/lwg3719.cc   | 1 -
 .../28_regex/iterators/regex_token_iterator/lwg3719.cc   | 1 -
 libstdc++-v3/testsuite/28_regex/sub_match/compare_c++20.cc   | 3 +--
 .../testsuite/experimental/filesystem/iterators/106201.cc| 1 -
 libstdc++-v3/testsuite/experimental/scopeguard/exit.cc   | 1 -
 libstdc++-v3/testsuite/experimental/scopeguard/uniqueres.cc  | 1 -
 24 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/libstdc++-v3/testsuite/18_support/coroutines/95917.cc 
b/libstdc++-v3/testsuite/18_support/coroutines/95917.cc
index f6f85f4df3f..8ee56ef3842 100644
--- a/libstdc++-v3/testsuite/18_support/coroutines/95917.cc
+++ b/libstdc++-v3/testsuite/18_support/coroutines/95917.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a -g0" }
-// { dg-do compile { target c++2a } }
+// { dg-options "-g0" }
+// { dg-do compile { target c++20 } }
 // { dg-final { scan-assembler-not "dummy_resume_destroy" } }
 // { dg-final { scan-assembler-not "noop_coro" } }
 
diff --git a/libstdc++-v3/testsuite/18_support/coroutines/hash.cc 
b/libstdc++-v3/testsuite/18_support/coroutines/hash.cc
index 81b68f8246a..bddea03681e 100644
--- a/libstdc++-v3/testsuite/18_support/coroutines/hash.cc
+++ b/libstdc++-v3/testsuite/18_support/coroutines/hash.cc
@@ -1,5 +1,4 @@
-// { dg-options "-std=gnu++2a" }
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/18_support/coroutines/lwg3460.cc 
b/libstdc++-v3/testsuite/18_support/coroutines/lwg3460.cc
index 

[committed 05/11] libstdc++: Remove dg-options "-std=gnu++20" from 23_containers tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/array/comparison_operators/96851.cc:
Remove dg-options -std=gnu++2a.
* testsuite/23_containers/array/comparison_operators/constexpr.cc:
Likewise.
* testsuite/23_containers/array/creation/1.cc: Likewise.
* testsuite/23_containers/array/creation/110167.cc: Likewise.
* testsuite/23_containers/array/creation/2.cc: Likewise.
* testsuite/23_containers/array/creation/3_neg.cc: Likewise.
* testsuite/23_containers/array/requirements/constexpr_fill.cc:
Likewise.
* testsuite/23_containers/array/requirements/constexpr_swap.cc:
Likewise.
* testsuite/23_containers/deque/48101-3_neg.cc: Likewise.
* testsuite/23_containers/deque/erasure.cc: Likewise.
* testsuite/23_containers/deque/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/deque/operators/cmp_c++20.cc:
Likewise.
* testsuite/23_containers/forward_list/48101-3_neg.cc: Likewise.
* testsuite/23_containers/forward_list/cmp_c++20.cc: Likewise.
* testsuite/23_containers/forward_list/erasure.cc: Likewise.
* testsuite/23_containers/forward_list/modifiers/92878_92947.cc:
Likewise.
* 
testsuite/23_containers/forward_list/operations/remove_cxx20_return.cc:
Likewise.
* 
testsuite/23_containers/forward_list/operations/unique_cxx20_return.cc:
Likewise.
* testsuite/23_containers/list/48101-3_neg.cc: Likewise.
* testsuite/23_containers/list/cmp_c++20.cc: Likewise.
* testsuite/23_containers/list/erasure.cc: Likewise.
* testsuite/23_containers/list/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/list/operations/remove_cxx20_return.cc:
Likewise.
* testsuite/23_containers/list/operations/unique_cxx20_return.cc:
Likewise.
* testsuite/23_containers/map/48101-3_neg.cc: Likewise.
* testsuite/23_containers/map/erasure.cc: Likewise.
* testsuite/23_containers/map/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/map/operations/contains.cc: Likewise.
* testsuite/23_containers/map/operators/cmp_c++20.cc: Likewise.
* testsuite/23_containers/multimap/48101-3_neg.cc: Likewise.
* testsuite/23_containers/multimap/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multimap/operations/contains.cc:
Likewise.
* testsuite/23_containers/multimap/operators/cmp_c++20.cc:
Likewise.
* testsuite/23_containers/multiset/48101-3_neg.cc: Likewise.
* testsuite/23_containers/multiset/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multiset/operations/contains.cc:
Likewise.
* testsuite/23_containers/multiset/operators/cmp_c++20.cc:
Likewise.
* testsuite/23_containers/priority_queue/92878_92947.cc:
Likewise.
* testsuite/23_containers/queue/92878_92947.cc: Likewise.
* testsuite/23_containers/queue/cmp_c++20.cc: Likewise.
* testsuite/23_containers/set/48101-3_neg.cc: Likewise.
* testsuite/23_containers/set/erasure.cc: Likewise.
* testsuite/23_containers/set/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/set/operations/contains.cc: Likewise.
* testsuite/23_containers/set/operators/cmp_c++20.cc: Likewise.
* testsuite/23_containers/span/1.cc: Likewise.
* testsuite/23_containers/span/101411.cc: Likewise.
* testsuite/23_containers/span/2.cc: Likewise.
* testsuite/23_containers/span/deduction.cc: Likewise.
* testsuite/23_containers/span/explicit.cc: Likewise.
* testsuite/23_containers/span/layout_compat.cc: Likewise.
* testsuite/23_containers/span/lwg3255.cc: Likewise.
* testsuite/23_containers/span/nothrow_cons.cc: Likewise.
* testsuite/23_containers/span/trivially_copyable.cc: Likewise.
* testsuite/23_containers/stack/92878_92947.cc: Likewise.
* testsuite/23_containers/stack/cmp_c++20.cc: Likewise.
* testsuite/23_containers/unordered_map/48101-3_neg.cc:
Likewise.
* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
* testsuite/23_containers/unordered_map/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_map/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_map/operations/contains.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/48101-3_neg.cc:
Likewise.
* 

[committed 07/11] libstdc++: Remove dg-options "-std=gnu++20" from 26_numerics tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/accumulate/constexpr.cc: Remove
dg-options -std=gnu++2a.
* testsuite/26_numerics/accumulate/lwg2055.cc: Likewise.
* testsuite/26_numerics/adjacent_difference/constexpr.cc:
Likewise.
* testsuite/26_numerics/bit/bit.cast/105027.cc: Likewise.
* testsuite/26_numerics/bit/bit.cast/bit_cast.cc: Likewise.
* testsuite/26_numerics/bit/bit.cast/version.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countl_one.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc:
Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/lwg3656.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotr.cc: Likewise.
* testsuite/26_numerics/bit/header-2.cc: Likewise.
* testsuite/26_numerics/bit/header.cc: Likewise.
* testsuite/26_numerics/complex/1.cc: Likewise.
* testsuite/26_numerics/complex/2.cc: Likewise.
* testsuite/26_numerics/complex/comparison_operators/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/complex/operators/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/complex/requirements/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/complex/value_operations/more_constexpr.cc:
Likewise.
* testsuite/26_numerics/endian/1.cc: Likewise.
* testsuite/26_numerics/endian/2.cc: Likewise.
* testsuite/26_numerics/endian/3.cc: Likewise.
* testsuite/26_numerics/exclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/inclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/inner_product/constexpr.cc: Likewise.
* testsuite/26_numerics/inner_product/lwg2055.cc: Likewise.
* testsuite/26_numerics/iota/constexpr.cc: Likewise.
* testsuite/26_numerics/lerp/1.cc: Likewise.
* testsuite/26_numerics/lerp/constexpr.cc: Likewise.
* testsuite/26_numerics/lerp/version.cc: Likewise.
* testsuite/26_numerics/midpoint/floating.cc: Likewise.
* testsuite/26_numerics/midpoint/integral.cc: Likewise.
* testsuite/26_numerics/midpoint/pointer.cc: Likewise.
* testsuite/26_numerics/midpoint/pointer_neg.cc: Likewise.
* testsuite/26_numerics/midpoint/version.cc: Likewise.
* testsuite/26_numerics/numbers/1.cc: Likewise.
* testsuite/26_numerics/numbers/2.cc: Likewise.
* testsuite/26_numerics/numbers/3.cc: Likewise.
* testsuite/26_numerics/numbers/float128.cc: Likewise.
* testsuite/26_numerics/numbers/nonfloat_neg.cc: Likewise.
* testsuite/26_numerics/partial_sum/constexpr.cc: Likewise.
* testsuite/26_numerics/partial_sum/lwg2055.cc: Likewise.
* testsuite/26_numerics/random/concept.cc: Likewise.
* testsuite/26_numerics/reduce/constexpr.cc: Likewise.
* testsuite/26_numerics/slice/compare.cc: Likewise.
* testsuite/26_numerics/transform_exclusive_scan/constexpr.cc:
Likewise.
* testsuite/26_numerics/transform_inclusive_scan/constexpr.cc:
Likewise.
* testsuite/26_numerics/transform_reduce/constexpr.cc: Likewise.
---
 libstdc++-v3/testsuite/26_numerics/accumulate/constexpr.cc| 3 +--
 libstdc++-v3/testsuite/26_numerics/accumulate/lwg2055.cc  | 3 +--
 .../testsuite/26_numerics/adjacent_difference/constexpr.cc| 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/bit.cast/105027.cc | 1 -
 libstdc++-v3/testsuite/26_numerics/bit/bit.cast/bit_cast.cc   | 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/bit.cast/version.cc| 3 +--
 .../testsuite/26_numerics/bit/bit.count/countl_one.cc | 3 +--
 .../testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc | 4 ++--
 .../testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc| 3 +--
 .../testsuite/26_numerics/bit/bit.pow.two/bit_width.cc| 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/lwg3656.cc | 1 -
 libstdc++-v3/testsuite/26_numerics/bit/bit.rotate/rotl.cc | 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/bit.rotate/rotr.cc | 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/header-2.cc| 3 +--
 libstdc++-v3/testsuite/26_numerics/bit/header.cc  | 3 +--
 libstdc++-v3/testsuite/26_numerics/complex/1.cc   | 3 +--
 libstdc++-v3/testsuite/26_numerics/complex/2.cc   | 3 +--
 .../complex/comparison_operators/more_constexpr.cc| 3 +--
 .../testsuite/26_numerics/complex/operators/more_constexpr.cc | 3 +--
 

[committed 09/11] libstdc++: Remove dg-options "-std=gnu++20" from 30_threads tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/30_threads/barrier/1.cc: Remove dg-options
-std=gnu++20.
* testsuite/30_threads/barrier/2.cc: Likewise.
* testsuite/30_threads/barrier/arrive.cc: Likewise.
* testsuite/30_threads/barrier/arrive_and_drop.cc: Likewise.
* testsuite/30_threads/barrier/arrive_and_wait.cc: Likewise.
* testsuite/30_threads/barrier/completion.cc: Likewise.
* testsuite/30_threads/condition_variable/members/clock_neg.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/members/clock_neg.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/1.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
Likewise.
* testsuite/30_threads/future/members/clock_neg.cc: Likewise.
* testsuite/30_threads/headers/stop_token/synopsis.cc: Likewise.
* testsuite/30_threads/headers/thread/types_std_c++20.cc:
Likewise.
* testsuite/30_threads/jthread/1.cc: Likewise.
* testsuite/30_threads/jthread/100612.cc: Likewise.
* testsuite/30_threads/jthread/95989.cc: Likewise.
* testsuite/30_threads/jthread/jthread.cc: Likewise.
* testsuite/30_threads/jthread/version.cc: Likewise.
* testsuite/30_threads/latch/1.cc: Likewise.
* testsuite/30_threads/latch/2.cc: Likewise.
* testsuite/30_threads/latch/3.cc: Likewise.
* 
testsuite/30_threads/recursive_timed_mutex/try_lock_until/clock_neg.cc:
Likewise.
* testsuite/30_threads/semaphore/1.cc: Likewise.
* testsuite/30_threads/semaphore/2.cc: Likewise.
* testsuite/30_threads/semaphore/least_max_value_neg.cc:
Likewise.
* testsuite/30_threads/semaphore/try_acquire_until.cc: Likewise.
* testsuite/30_threads/shared_future/members/clock_neg.cc:
Likewise.
* testsuite/30_threads/shared_lock/locking/clock_neg.cc:
Likewise.
* testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc:
Likewise.
* testsuite/30_threads/stop_token/1.cc: Likewise.
* testsuite/30_threads/stop_token/2.cc: Likewise.
* testsuite/30_threads/stop_token/stop_callback.cc: Likewise.
* testsuite/30_threads/stop_token/stop_callback/deadlock.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/invoke.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_source.cc: Likewise.
* testsuite/30_threads/stop_token/stop_source/assign.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_token.cc: Likewise.
* testsuite/30_threads/stop_token/stop_token/stop_possible.cc:
Likewise.
* testsuite/30_threads/thread/id/operators_c++20.cc: Likewise.
* testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc:
Likewise.
* testsuite/30_threads/unique_lock/locking/clock_neg.cc:
Likewise.
---
 libstdc++-v3/testsuite/30_threads/barrier/1.cc | 3 +--
 libstdc++-v3/testsuite/30_threads/barrier/2.cc | 3 +--
 libstdc++-v3/testsuite/30_threads/barrier/arrive.cc| 3 +--
 libstdc++-v3/testsuite/30_threads/barrier/arrive_and_drop.cc   | 3 +--
 libstdc++-v3/testsuite/30_threads/barrier/arrive_and_wait.cc   | 3 +--
 libstdc++-v3/testsuite/30_threads/barrier/completion.cc| 3 +--
 .../30_threads/condition_variable/members/clock_neg.cc | 3 +--
 .../30_threads/condition_variable_any/members/clock_neg.cc | 3 +--
 .../30_threads/condition_variable_any/stop_token/1.cc  | 3 +--
 .../30_threads/condition_variable_any/stop_token/2.cc  | 3 +--
 libstdc++-v3/testsuite/30_threads/future/members/clock_neg.cc  | 3 +--
 .../testsuite/30_threads/headers/stop_token/synopsis.cc| 3 +--
 .../testsuite/30_threads/headers/thread/types_std_c++20.cc | 3 +--
 libstdc++-v3/testsuite/30_threads/jthread/1.cc | 3 +--
 libstdc++-v3/testsuite/30_threads/jthread/100612.cc| 1 -
 libstdc++-v3/testsuite/30_threads/jthread/95989.cc | 3 +--
 libstdc++-v3/testsuite/30_threads/jthread/jthread.cc   | 3 +--
 libstdc++-v3/testsuite/30_threads/jthread/version.cc   | 3 +--
 libstdc++-v3/testsuite/30_threads/latch/1.cc   | 3 +--
 libstdc++-v3/testsuite/30_threads/latch/2.cc   | 3 +--
 libstdc++-v3/testsuite/30_threads/latch/3.cc   | 3 +--
 .../recursive_timed_mutex/try_lock_until/clock_neg.cc  | 3 

[committed 04/11] libstdc++: Remove dg-options "-std=gnu++20" from 21_strings tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/basic_string/cons/char/105995.cc: Remove
dg-options -std=gnu++20.
* testsuite/21_strings/basic_string/cons/char/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/cons/wchar_t/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/erasure.cc: Likewise.
* testsuite/21_strings/basic_string/hash/hash_char8_t.cc:
Likewise.
* testsuite/21_strings/basic_string/literals/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/swap/constexpr-wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string/modifiers/swap/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/ends_with/char.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/ends_with/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/ends_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/starts_with/char.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/starts_with/nonnull.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/starts_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string/operators/char/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string/operators/wchar_t/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string_view/cons/char/range.cc:
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc:
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/copy/wchar_t/constexpr.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/ends_with/char.cc:
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/ends_with/nonnull.cc:
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/ends_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operations/starts_with/char.cc:
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/starts_with/nonnull.cc:
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/starts_with/wchar_t.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operators/char/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string_view/operators/wchar_t/cmp_c++20.cc:
Likewise.
* testsuite/21_strings/basic_string_view/requirements/constexpr_iter.cc:
Likewise.
* 
testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
Likewise.
---
 .../testsuite/21_strings/basic_string/cons/char/105995.cc  | 1 -
 .../testsuite/21_strings/basic_string/cons/char/constexpr.cc   | 1 -
 .../21_strings/basic_string/cons/wchar_t/constexpr.cc  | 1 -
 libstdc++-v3/testsuite/21_strings/basic_string/erasure.cc  | 3 +--
 .../testsuite/21_strings/basic_string/hash/hash_char8_t.cc | 3 +--
 .../testsuite/21_strings/basic_string/literals/constexpr.cc| 1 -
 .../testsuite/21_strings/basic_string/modifiers/constexpr.cc   | 1 -
 .../basic_string/modifiers/swap/constexpr-wchar_t.cc   | 1 -
 .../21_strings/basic_string/modifiers/swap/constexpr.cc| 1 -
 .../21_strings/basic_string/operations/ends_with/char.cc   | 3 +--
 .../21_strings/basic_string/operations/ends_with/nonnull.cc| 2 +-
 .../21_strings/basic_string/operations/ends_with/wchar_t.cc| 3 +--
 .../21_strings/basic_string/operations/starts_with/char.cc | 3 +--
 .../21_strings/basic_string/operations/starts_with/nonnull.cc  | 2 +-
 .../21_strings/basic_string/operations/starts_with/wchar_t.cc  | 3 +--
 .../21_strings/basic_string/operators/char/cmp_c++20.cc| 3 +--
 .../21_strings/basic_string/operators/wchar_t/cmp_c++20.cc | 3 +--
 .../testsuite/21_strings/basic_string_view/cons/char/range.cc  | 1 -
 .../basic_string_view/operations/copy/char/constexpr.cc| 3 +--
 .../basic_string_view/operations/copy/wchar_t/constexpr.cc | 3 +--
 .../21_strings/basic_string_view/operations/ends_with/char.cc  | 3 +--
 .../basic_string_view/operations/ends_with/nonnull.cc  | 2 +-
 .../basic_string_view/operations/ends_with/wchar_t.cc  | 3 +--
 .../basic_string_view/operations/starts_with/char.cc   | 3 +--
 .../basic_string_view/operations/starts_with/nonnull.cc| 2 +-
 .../basic_string_view/operations/starts_with/wchar_t.cc| 3 +--
 .../21_strings/basic_string_view/operators/char/cmp_c++20.cc 

[committed 06/11] libstdc++: Remove dg-options "-std=gnu++20" from 24_iterators tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/24_iterators/aliases.cc: Remove dg-options
-std=gnu++2a.
* testsuite/24_iterators/associated_types/incrementable.traits.cc:
Likewise.
* testsuite/24_iterators/associated_types/iterator.traits.cc:
Likewise.
* testsuite/24_iterators/associated_types/readable.traits.cc:
Likewise.
* testsuite/24_iterators/back_insert_iterator/constexpr.cc:
Likewise.
* testsuite/24_iterators/back_insert_iterator/pr93884.cc:
Likewise.
* testsuite/24_iterators/bidirectional/concept.cc: Likewise.
* testsuite/24_iterators/common_iterator/1.cc: Likewise.
* testsuite/24_iterators/common_iterator/100823.cc: Likewise.
* testsuite/24_iterators/common_iterator/2.cc: Likewise.
* testsuite/24_iterators/contiguous/concept.cc: Likewise.
* testsuite/24_iterators/contiguous/tag.cc: Likewise.
* testsuite/24_iterators/counted_iterator/1.cc: Likewise.
* testsuite/24_iterators/counted_iterator/lwg3389.cc: Likewise.
* testsuite/24_iterators/counted_iterator/lwg3643.cc: Likewise.
* testsuite/24_iterators/customization_points/92894.cc:
Likewise.
* testsuite/24_iterators/customization_points/iter_move.cc:
Likewise.
* testsuite/24_iterators/customization_points/iter_swap.cc:
Likewise.
* testsuite/24_iterators/customization_points/lwg3420.cc:
Likewise.
* testsuite/24_iterators/forward/concept.cc: Likewise.
* testsuite/24_iterators/front_insert_iterator/constexpr.cc:
Likewise.
* testsuite/24_iterators/front_insert_iterator/pr93884.cc:
Likewise.
* testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
Likewise.
* testsuite/24_iterators/indirect_callable/92894.cc: Likewise.
* testsuite/24_iterators/indirect_callable/projected-adl.cc:
Likewise.
* testsuite/24_iterators/indirect_callable/projected.cc:
Likewise.
* testsuite/24_iterators/input/concept.cc: Likewise.
* testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.
* testsuite/24_iterators/istream_iterator/cons/sentinel.cc:
Likewise.
* testsuite/24_iterators/istream_iterator/sentinel.cc: Likewise.
* testsuite/24_iterators/istreambuf_iterator/cons/sentinel.cc:
Likewise.
* testsuite/24_iterators/istreambuf_iterator/sentinel.cc:
Likewise.
* testsuite/24_iterators/move_iterator/cust.cc: Likewise.
* testsuite/24_iterators/move_iterator/dr3435.cc: Likewise.
* testsuite/24_iterators/move_iterator/input_iterator.cc:
Likewise.
* testsuite/24_iterators/move_iterator/lwg3390.cc: Likewise.
* testsuite/24_iterators/move_iterator/lwg3391.cc: Likewise.
* testsuite/24_iterators/move_iterator/move_only.cc: Likewise.
* testsuite/24_iterators/move_iterator/p2520r0.cc: Likewise.
* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc:
Likewise.
* testsuite/24_iterators/move_iterator/sentinel.cc: Likewise.
* testsuite/24_iterators/normal_iterator/cmp_c++20.cc: Likewise.
* testsuite/24_iterators/output/concept.cc: Likewise.
* testsuite/24_iterators/random_access/concept.cc: Likewise.
* testsuite/24_iterators/range_access/range_access_cpp20.cc:
Likewise.
* testsuite/24_iterators/range_access/range_access_cpp20_neg.cc:
Likewise.
* testsuite/24_iterators/range_operations/100768.cc: Likewise.
* testsuite/24_iterators/range_operations/advance.cc: Likewise.
* testsuite/24_iterators/range_operations/advance_overflow.cc:
Likewise.
* testsuite/24_iterators/range_operations/distance.cc: Likewise.
* testsuite/24_iterators/range_operations/lwg3392.cc: Likewise.
* testsuite/24_iterators/range_operations/next.cc: Likewise.
* testsuite/24_iterators/range_operations/prev.cc: Likewise.
* testsuite/24_iterators/reverse_iterator/cust.cc: Likewise.
* testsuite/24_iterators/reverse_iterator/dr3435.cc: Likewise.
* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc:
Likewise.
---
 libstdc++-v3/testsuite/24_iterators/aliases.cc | 3 +--
 .../24_iterators/associated_types/incrementable.traits.cc  | 3 +--
 .../testsuite/24_iterators/associated_types/iterator.traits.cc | 3 +--
 .../testsuite/24_iterators/associated_types/readable.traits.cc | 3 +--
 .../testsuite/24_iterators/back_insert_iterator/constexpr.cc   | 3 +--
 .../testsuite/24_iterators/back_insert_iterator/pr93884.cc | 3 +--
 

[committed 01/11] libstdc++: Remove dg-options "-std=gnu++20" from tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/29_atomics/atomic/compare_exchange_padding.cc:
Remove dg-options -std=gnu++2a.
* testsuite/29_atomics/atomic/cons/value_init.cc: Likewise.
* testsuite/29_atomics/atomic/lock_free_aliases.cc: Likewise.
* testsuite/29_atomics/atomic/requirements/types_neg.cc:
Likewise.
* testsuite/29_atomics/atomic/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/100334.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/102994.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/2.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/bool.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/generic.cc: Likewise.
* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
* testsuite/29_atomics/atomic_flag/cons/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_flag/test/explicit.cc: Likewise.
* testsuite/29_atomics/atomic_flag/test/implicit.cc: Likewise.
* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
* testsuite/29_atomics/atomic_float/1.cc: Likewise.
* testsuite/29_atomics/atomic_float/95282.cc: Likewise.
* testsuite/29_atomics/atomic_float/requirements.cc: Likewise.
* testsuite/29_atomics/atomic_float/value_init.cc: Likewise.
* testsuite/29_atomics/atomic_float/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_integral/cons/value_init.cc:
Likewise.
* testsuite/29_atomics/atomic_integral/wait_notify.cc: Likewise.
* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc:
Likewise.
* testsuite/29_atomics/atomic_ref/deduction.cc: Likewise.
* testsuite/29_atomics/atomic_ref/float.cc: Likewise.
* testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
* testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
* testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
* testsuite/29_atomics/atomic_ref/requirements.cc: Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++20.cc:
Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc:
Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++2a.cc:
Likewise.
* testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc:
Likewise.
---
 .../testsuite/29_atomics/atomic/compare_exchange_padding.cc| 1 -
 libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc| 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic/lock_free_aliases.cc  | 1 -
 .../testsuite/29_atomics/atomic/requirements/types_neg.cc  | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/1.cc  | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/100334.cc | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/102994.cc | 1 -
 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/2.cc  | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic/wait_notify/bool.cc   | 3 +--
 .../testsuite/29_atomics/atomic/wait_notify/generic.cc | 3 +--
 .../testsuite/29_atomics/atomic/wait_notify/pointers.cc| 3 +--
 .../testsuite/29_atomics/atomic_flag/cons/value_init.cc| 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_flag/test/explicit.cc | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_flag/test/implicit.cc | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_flag/wait_notify/1.cc | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_float/1.cc| 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_float/95282.cc| 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_float/requirements.cc | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc   | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_float/wait_notify.cc  | 3 +--
 .../testsuite/29_atomics/atomic_integral/cons/value_init.cc| 3 +--
 .../testsuite/29_atomics/atomic_integral/wait_notify.cc| 3 +--
 .../29_atomics/atomic_ref/compare_exchange_padding.cc  | 1 -
 libstdc++-v3/testsuite/29_atomics/atomic_ref/deduction.cc  | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_ref/float.cc  | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc| 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc   | 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc| 3 +--
 libstdc++-v3/testsuite/29_atomics/atomic_ref/requirements.cc   | 3 +--
 .../testsuite/29_atomics/headers/atomic/types_std_c++20.cc | 3 +--
 .../testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc | 3 +--
 .../testsuite/29_atomics/headers/atomic/types_std_c++2a.cc | 3 +--
 

[committed 03/11] libstdc++: Remove dg-options "-std=gnu++20" from 20_utils tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/20_util/allocator/105975.cc: Remove dg-options
-std=gnu++2a.
* testsuite/20_util/allocator/rebind_c++20.cc: Likewise.
* testsuite/20_util/allocator/requirements/constexpr.cc:
Likewise.
* testsuite/20_util/allocator/requirements/typedefs_c++20.cc:
Likewise.
* testsuite/20_util/allocator_traits/header-2.cc: Likewise.
* testsuite/20_util/allocator_traits/header.cc: Likewise.
* testsuite/20_util/allocator_traits/members/92878_92947.cc:
Likewise.
* testsuite/20_util/any/assign/92878_92947.cc: Likewise.
* testsuite/20_util/any/cons/92878_92947.cc: Likewise.
* testsuite/20_util/assume_aligned/1.cc: Likewise.
* testsuite/20_util/assume_aligned/2_neg.cc: Likewise.
* testsuite/20_util/assume_aligned/3.cc: Likewise.
* testsuite/20_util/assume_aligned/97132.cc: Likewise.
* testsuite/20_util/bind/constexpr.cc: Likewise.
* testsuite/20_util/bitset/operations/96303.cc: Likewise.
* testsuite/20_util/common_reference/100894.cc: Likewise.
* testsuite/20_util/common_reference/requirements/alias_decl.cc:
Likewise.
* 
testsuite/20_util/common_reference/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/common_reference/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/duration/comparison_operators/three_way.cc:
Likewise.
* testsuite/20_util/exchange/constexpr.cc: Likewise.
* testsuite/20_util/exchange/noexcept.cc: Likewise.
* testsuite/20_util/from_chars/1_c++20_neg.cc: Likewise.
* testsuite/20_util/from_chars/compare.cc: Likewise.
* testsuite/20_util/function_objects/bind_front/1.cc: Likewise.
* testsuite/20_util/function_objects/bind_front/107784.cc:
Likewise.
* testsuite/20_util/function_objects/bind_front/111327.cc:
Likewise.
* testsuite/20_util/function_objects/bind_front/2.cc: Likewise.
* testsuite/20_util/function_objects/bind_front/97101.cc:
Likewise.
* testsuite/20_util/function_objects/bind_front/constexpr.cc:
Likewise.
* testsuite/20_util/function_objects/constexpr_searcher.cc:
Likewise.
* testsuite/20_util/function_objects/identity/1.cc: Likewise.
* testsuite/20_util/function_objects/invoke/constexpr.cc:
Likewise.
* testsuite/20_util/function_objects/mem_fn/constexpr.cc:
Likewise.
* testsuite/20_util/function_objects/not_fn/constexpr.cc:
Likewise.
* testsuite/20_util/integer_comparisons/1.cc: Likewise.
* testsuite/20_util/integer_comparisons/2.cc: Likewise.
* testsuite/20_util/integer_comparisons/equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/equal_neg.cc: Likewise.
* testsuite/20_util/integer_comparisons/greater.cc: Likewise.
* testsuite/20_util/integer_comparisons/greater_equal.cc:
Likewise.
* testsuite/20_util/integer_comparisons/greater_equal_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/greater_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/in_range.cc: Likewise.
* testsuite/20_util/integer_comparisons/in_range_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/less.cc: Likewise.
* testsuite/20_util/integer_comparisons/less_equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/less_equal_neg.cc:
Likewise.
* testsuite/20_util/integer_comparisons/less_neg.cc: Likewise.
* testsuite/20_util/integer_comparisons/not_equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/not_equal_neg.cc:
Likewise.
* 
testsuite/20_util/is_bounded_array/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/is_bounded_array/requirements/typedefs.cc:
Likewise.
* testsuite/20_util/is_bounded_array/value.cc: Likewise.
* testsuite/20_util/is_constant_evaluated/1.cc: Likewise.
* testsuite/20_util/is_constant_evaluated/noexcept.cc: Likewise.
* testsuite/20_util/is_constructible/92878_92947.cc: Likewise.
* testsuite/20_util/is_layout_compatible/is_corresponding_member.cc:
Likewise.
* testsuite/20_util/is_layout_compatible/value.cc: Likewise.
* testsuite/20_util/is_layout_compatible/version.cc: Likewise.
* testsuite/20_util/is_nothrow_constructible/value_c++20.cc:
Likewise.
* 
testsuite/20_util/is_nothrow_convertible/requirements/explicit_instantiation.cc:
Likewise.
* 

[committed 02/11] libstdc++: Remove dg-options "-std=gnu++20" from tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/18_support/comparisons/algorithms/fallback.cc:
Remove dg-options -std=gnu++2a.
* testsuite/18_support/comparisons/algorithms/partial_order.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/strong_order.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/strong_order_floats.cc:
Likewise.
* testsuite/18_support/comparisons/algorithms/weak_order.cc:
Likewise.
* testsuite/18_support/comparisons/categories/94565.cc:
Likewise.
* testsuite/18_support/comparisons/categories/partialord.cc:
Likewise.
* testsuite/18_support/comparisons/categories/strongord.cc:
Likewise.
* testsuite/18_support/comparisons/categories/weakord.cc:
Likewise.
* testsuite/18_support/comparisons/categories/zero_neg.cc:
Likewise.
* testsuite/18_support/comparisons/common/1.cc: Likewise.
* testsuite/18_support/comparisons/object/93479.cc: Likewise.
* testsuite/18_support/comparisons/object/lwg3530.cc: Likewise.
---
 .../testsuite/18_support/comparisons/algorithms/fallback.cc   | 1 -
 .../18_support/comparisons/algorithms/partial_order.cc| 3 +--
 .../18_support/comparisons/algorithms/strong_order.cc | 3 +--
 .../18_support/comparisons/algorithms/strong_order_floats.cc  | 1 -
 .../testsuite/18_support/comparisons/algorithms/weak_order.cc | 3 +--
 .../testsuite/18_support/comparisons/categories/94565.cc  | 3 +--
 .../testsuite/18_support/comparisons/categories/partialord.cc | 3 +--
 .../testsuite/18_support/comparisons/categories/strongord.cc  | 3 +--
 .../testsuite/18_support/comparisons/categories/weakord.cc| 3 +--
 .../testsuite/18_support/comparisons/categories/zero_neg.cc   | 4 ++--
 libstdc++-v3/testsuite/18_support/comparisons/common/1.cc | 3 +--
 libstdc++-v3/testsuite/18_support/comparisons/object/93479.cc | 3 +--
 .../testsuite/18_support/comparisons/object/lwg3530.cc| 3 +--
 13 files changed, 12 insertions(+), 24 deletions(-)

diff --git 
a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc 
b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc
index 8bf78faf232..da8aaeedcb4 100644
--- a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc
+++ b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/fallback.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do compile { target c++20 } }
 
 #include 
diff --git 
a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/partial_order.cc 
b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/partial_order.cc
index 7c186e607b4..d83bb000160 100644
--- a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/partial_order.cc
+++ b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/partial_order.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a" }
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
 
 #include 
 #include 
diff --git 
a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order.cc 
b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order.cc
index be640714245..c97f31442db 100644
--- a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order.cc
+++ b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
 
 #include 
 #include 
diff --git 
a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order_floats.cc
 
b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order_floats.cc
index e28fcac6e11..135cba2e658 100644
--- 
a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order_floats.cc
+++ 
b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/strong_order_floats.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do compile { target c++20 } }
 
 #include 
diff --git 
a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/weak_order.cc 
b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/weak_order.cc
index a66ca6a51e0..1ff471f7203 100644
--- a/libstdc++-v3/testsuite/18_support/comparisons/algorithms/weak_order.cc
+++ b/libstdc++-v3/testsuite/18_support/comparisons/algorithms/weak_order.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a" }
-// { dg-do run { target c++2a } 

[committed] libstdc++: Add missing tests for std::basic_filebuf::native_handle()

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

I forgot to 'git add' these files in the commit that added the new
member function to basic_filebuf.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_filebuf/native_handle/wchar_t/1.cc: New test.
---
 .../basic_filebuf/native_handle/char/1.cc | 61 +++
 .../basic_filebuf/native_handle/wchar_t/1.cc  | 55 +
 2 files changed, 116 insertions(+)
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/char/1.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/wchar_t/1.cc

diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/char/1.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/char/1.cc
new file mode 100644
index 000..749451a4c81
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/char/1.cc
@@ -0,0 +1,61 @@
+// { dg-options "-fno-inline" }
+// { dg-do run { target c++26 } }
+// { dg-additional-files "filebuf_members-1.txt" }
+
+#include 
+
+#ifndef __cpp_lib_fstream_native_handle
+# error "Feature-test macro for fstream_native_handle missing in "
+#elif __cpp_lib_fstream_native_handle != 202306L
+# error "Feature-test macro for fstream_native_handle has wrong value in 
"
+#endif
+
+using type = std::basic_filebuf::native_handle_type;
+
+#include  // std::fclose(FILE*)
+#if __has_include()
+# include  // close(int)
+#endif
+#if __has_include()
+# include  // CloseHandle(HANDLE)
+#endif
+
+#include 
+
+void
+test01()
+{
+  std::filebuf f;
+  f.open("filebuf_members-1.txt", std::ios::in);
+  type handle = f.native_handle();
+
+  auto native_close = [](HandleT handle) {
+if constexpr (std::is_same_v)
+  std::fclose(handle); // --enable-cstdio=stdio_pure
+#if __has_include()
+else if constexpr (std::is_same_v)
+  ::close(handle); // POSIX
+#endif
+#if __has_include()
+else if constexpr (std::is_same_v)
+  ::CloseHandle(handle); // Windows
+#endif
+else
+  VERIFY( false );
+  };
+  native_close(handle);
+
+  try
+  {
+f.sgetc();
+VERIFY( false );
+  }
+  catch (const std::ios::failure&)
+  {
+  }
+}
+
+int main()
+{
+  test01();
+}
diff --git 
a/libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/wchar_t/1.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/wchar_t/1.cc
new file mode 100644
index 000..7ee5e4e8f53
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/wchar_t/1.cc
@@ -0,0 +1,55 @@
+// { dg-options "-fno-inline" }
+// { dg-do run { target c++26 } }
+// { dg-additional-files "filebuf_members-1.txt" }
+
+#include 
+
+using type = std::basic_filebuf::native_handle_type;
+
+#include  // std::fclose(FILE*)
+#if __has_include()
+# include  // close(int)
+#endif
+#if __has_include()
+# include  // CloseHandle(HANDLE)
+#endif
+
+#include 
+
+void
+test01()
+{
+  std::wfilebuf f;
+  f.open("filebuf_members-1.txt", std::wios::in);
+  type handle = f.native_handle();
+
+  auto native_close = [](HandleT handle) {
+if constexpr (std::is_same_v)
+  std::fclose(handle); // --enable-cstdio=stdio_pure
+#if __has_include()
+else if constexpr (std::is_same_v)
+  ::close(handle); // POSIX
+#endif
+#if __has_include()
+else if constexpr (std::is_same_v)
+  ::CloseHandle(handle); // Windows
+#endif
+else
+  VERIFY( false );
+  };
+  native_close(handle);
+
+  try
+  {
+f.sgetc();
+VERIFY( false );
+  }
+  catch (const std::ios::failure&)
+  {
+  }
+}
+
+int main()
+{
+  test01();
+}
-- 
2.41.0



[committed] libstdc++: Implement C++26 native handles for file streams (P1759R6)

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

The new __basic_file::native_handle() function can be added for C++11
and above, because the names "native_handle" and "native_handle_type"
are already reserved since C++11. Exporting those symbols from the
shared library does no harm, even if the feature gets dropped before the
C++23 standard is final.

The new member functions of std::fstream etc. are only declared for
C++26 and so are not instantiated in src/c++11/fstream-inst.cc. Declare
them with the always_inline attribute so that no symbol definitions are
needed in the library (we can change this later when C++26 support is
less experimental).

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CHECK_FILEBUF_NATIVE_HANDLES): New
macro.
* config.h.in: Regenerate.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.32): Export new
basic_filebuf members.
* config/io/basic_file_stdio.cc (__basic_file::native_handle):
Define new function.
* config/io/basic_file_stdio.h (__basic_file::native_handle):
Declare new function.
* configure: Regenerate.
* configure.ac: Use GLIBCXX_CHECK_FILEBUF_NATIVE_HANDLES.
* include/bits/version.def (fstream_native_handles): New macro.
* include/bits/version.h: Regenerate.
* include/std/fstream (basic_filebuf::native_handle)
(basic_fstream::native_handle, basic_ifstream::native_handle)
(basic_ofstream::native_handle): New functions.
* src/c++11/Makefile.am: Move compilation of basic_file.cc,
locale_init.cc and localename.cc to here.
* src/c++11/Makefile.in: Regenerate.
* src/c++98/locale_init.cc: Moved to...
* src/c++11/locale_init.cc: ...here.
* src/c++98/localename.cc: Moved to...
* src/c++11/localename.cc: ...here.
* src/c++98/Makefile.am: Remove basic_file.cc, locale_init.cc
and localename.cc from here.
* src/c++98/Makefile.in: Regenerate.
* testsuite/27_io/basic_filebuf/native_handle/version.cc: New test.
* testsuite/27_io/basic_fstream/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_fstream/native_handle/wchar_t/1.cc: New test.
* testsuite/27_io/basic_ifstream/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_ifstream/native_handle/wchar_t/1.cc: New test.
* testsuite/27_io/basic_ofstream/native_handle/char/1.cc: New test.
* testsuite/27_io/basic_ofstream/native_handle/wchar_t/1.cc: New test.
---
 libstdc++-v3/acinclude.m4 | 31 ++
 libstdc++-v3/config.h.in  |  3 +
 libstdc++-v3/config/abi/pre/gnu.ver   |  2 +
 libstdc++-v3/config/io/basic_file_stdio.cc| 18 ++
 libstdc++-v3/config/io/basic_file_stdio.h | 13 
 libstdc++-v3/configure| 57 ++
 libstdc++-v3/configure.ac |  3 +
 libstdc++-v3/include/bits/version.def |  9 +++
 libstdc++-v3/include/bits/version.h   | 13 +++-
 libstdc++-v3/include/std/fstream  | 60 +++
 libstdc++-v3/src/c++11/Makefile.am| 21 ++-
 libstdc++-v3/src/c++11/Makefile.in| 40 ++---
 .../src/{c++98 => c++11}/locale_init.cc   |  0
 .../src/{c++98 => c++11}/localename.cc|  0
 libstdc++-v3/src/c++98/Makefile.am| 22 ++-
 libstdc++-v3/src/c++98/Makefile.in| 39 
 .../basic_filebuf/native_handle/version.cc| 10 
 .../basic_fstream/native_handle/char/1.cc | 21 +++
 .../basic_fstream/native_handle/wchar_t/1.cc  | 21 +++
 .../basic_ifstream/native_handle/char/1.cc| 21 +++
 .../basic_ifstream/native_handle/wchar_t/1.cc | 21 +++
 .../basic_ofstream/native_handle/char/1.cc| 21 +++
 .../basic_ofstream/native_handle/wchar_t/1.cc | 21 +++
 23 files changed, 411 insertions(+), 56 deletions(-)
 rename libstdc++-v3/src/{c++98 => c++11}/locale_init.cc (100%)
 rename libstdc++-v3/src/{c++98 => c++11}/localename.cc (100%)
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_filebuf/native_handle/version.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_fstream/native_handle/char/1.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_fstream/native_handle/wchar_t/1.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_ifstream/native_handle/char/1.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_ifstream/native_handle/wchar_t/1.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_ofstream/native_handle/char/1.cc
 create mode 100644 
libstdc++-v3/testsuite/27_io/basic_ofstream/native_handle/wchar_t/1.cc

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 34faa3c049f..d8f0ba1c3e2 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5786,6 +5786,37 @@ AC_LANG_SAVE
   AC_LANG_RESTORE
 ])
 
+dnl
+dnl Check whether the Windows CRT 

[committed] libstdc++: Add log line to testsuite output

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

This makes it easier to debug the problem when a test isn't running
because there's a testsuite_files that doesn't include it.

-- >8 --

Write a line to the log when using a testsuite_files file.

libstdc++-v3/ChangeLog:

* testsuite/libstdc++-dg/conformance.exp: Add log line when
using testsuite_files.
---
 libstdc++-v3/testsuite/libstdc++-dg/conformance.exp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp 
b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
index 76679739823..96dcc1f8cff 100644
--- a/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
+++ b/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
@@ -44,6 +44,7 @@ if {[info exists blddir]} {
 }
 if {[info exists tests_file] && [file exists $tests_file]} {
 set f [open $tests_file]
+verbose -log "reading test files from $tests_file" 1
 while { ! [eof $f] } {
set t [gets $f]
if { [string length "$t"] != 0 } {
-- 
2.41.0



Re: [PATCH 00/13] libstdc++: Add support for running tests with multiple -std options

2023-09-15 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Sept 2023 at 17:37, Jonathan Wakely via Libstdc++
 wrote:
>
> This patch series replicates the behaviour of the g++ testsuite, so that
> libstdc++ tests can easily be run for multiple different -std options in
> a single testsuite run.  As described in the updated docs, the -std
> options to use for every test can be overridden by setting v3_std_list
> in ~/.dejagnurc or $DEJAGNU, or setting $GLIBCXX_TESTSUITE_STDS in the
> environment.  If not overridden, the default is just to run with
> -std=gnu++17 (so that we don't increase the time taken for a full
> testsuite run).
>
> Tests that require a newer standard than C++17 will default to that
> newer standard and C++26, so e.g. std::format tests will be run with
> both -std=gnu++20 and -std=gnu++26.  This does increase the number of
> tests, but only for the subset of tests for C++20/23/26 features.  If
> this is too costly for testers, we can change that (this might be
> needed, because the C++20 tests for std::ranges and std::format are
> particularly slow to compile).
>
> Because a correct default will be chosen for tests that require
> something newer than C++17, we no longer need dg-options "-std=gnu++20"
> or similar in any tests.  Removing the explicit -std option allows the
> test to be run for later standards via the v3_std_list settings, so that
> we can verify that C++20 features still work in C++23 and C++26, for
> example.  This change already found some tests which failed when run
> with a later standard (see r14-3771-gf12e26f3496275).
>
> Patches 2-13 in the series remove those unnecessary dg-options from
> about half the relevant tests, but there are more than 500 others that
> still need adjusting.
>
> We can remove files like testsuite/std/format/functions/format_c++23.cc
> which only exist to duplicate existing tests with a different -std
> option.  We can remove that file now, and rely on format.cc being run
> with multiple -std options by libstdc++ maintainers.
>
> It might also be useful to add a 'make check-quick' target which runs a
> small subset of smoke tests with every standard version in v3_std_list.
> This would be a suitable target for CI bots and for packagers who want
> to verify that a build of GCC is functional, without running the entire
> libstdc++ testsuite.

This has been pushed to trunk now.



[committed] libstdc++: Fix 29_atomics/headers/atomic/types_std_c++2a_neg.cc for C++23

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

This test fails when run as C++23 because the  PCH
includes  which declares ::memory_order, invalidating the
test's assumptions. Disable PCH so that the test verifies that 
doesn't declare ::memory_order, as originally intended.

Also fix the using-declaration which would be invalid even if the type
was declared in the global namespace, and adjust the expected error.

libstdc++-v3/ChangeLog:

* testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc:
Fix test to work for C++23 and C++26 too.
---
 .../29_atomics/headers/atomic/types_std_c++2a_neg.cc   | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc 
b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc
index 8eba8bfd779..65199ce15e5 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/atomic/types_std_c++2a_neg.cc
@@ -1,5 +1,8 @@
 // { dg-options "-std=gnu++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
+// Disable PCH because  includes  which declares
+// memory_order in the global namespace.
+// { dg-add-options no_pch }
 
 // Copyright (C) 2019-2023 Free Software Foundation, Inc.
 //
@@ -23,7 +26,7 @@
 void test01()
 {
   // Not global scoped, only namespace std.
-  using memory_order; // { dg-error "expected nested-name-specifier" }
+  using ::memory_order; // { dg-error "has not been declared" }
   constexpr auto relaxed = memory_order::relaxed; // { dg-error "has not been 
declared" }
   constexpr auto consume = memory_order::consume; // { dg-error "has not been 
declared" }
   constexpr auto acquire = memory_order::acquire; // { dg-error "has not been 
declared" }
-- 
2.41.0



[PATCH v2 6/13] libstdc++: Remove dg-options "-std=gnu++20" from and tests

2023-09-15 Thread Jonathan Wakely via Gcc-patches
This is v2 of patch 6/13, because I missed three files in the first
patch.

Tested aarch64-linux. I intend to push this (and the rest of the series)
soon.

-- >8 --

The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/std/concepts/1.cc: Remove dg-options.
* testsuite/std/concepts/2.cc: Likewise.
* testsuite/std/concepts/concepts.callable/invocable.cc:
Likewise.
* testsuite/std/concepts/concepts.callable/regular_invocable.cc:
Likewise.
* testsuite/std/concepts/concepts.callable/relation.cc:
Likewise.
* testsuite/std/concepts/concepts.callable/strictweakorder.cc:
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.arithmetic/floating_point.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.arithmetic/integral.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.arithmetic/signed_integral.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.arithmetic/unsigned_integral.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.assignable/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.common/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.commonref/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.constructible/1.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.convertible/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.copyconstructible/1.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.defaultinitializable/1.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.defaultinitializable/lwg3149.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.derived/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.destructible/1.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.moveconstructible/1.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.same/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.swappable/swappable_with.cc: 
Likewise.
* testsuite/std/concepts/concepts.object/copyable.cc: Likewise.
* testsuite/std/concepts/concepts.object/movable.cc: Likewise.
* testsuite/std/concepts/concepts.object/regular.cc: Likewise.
* testsuite/std/concepts/concepts.object/semiregular.cc:
Likewise.
* testsuite/std/ranges/97600.cc: Likewise.
* testsuite/std/ranges/access/101782.cc: Likewise.
* testsuite/std/ranges/access/begin.cc: Likewise.
* testsuite/std/ranges/access/begin_neg.cc: Likewise.
* testsuite/std/ranges/access/cbegin.cc: Likewise.
* testsuite/std/ranges/access/cdata.cc: Likewise.
* testsuite/std/ranges/access/cend.cc: Likewise.
* testsuite/std/ranges/access/crbegin.cc: Likewise.
* testsuite/std/ranges/access/crend.cc: Likewise.
* testsuite/std/ranges/access/data.cc: Likewise.
* testsuite/std/ranges/access/empty.cc: Likewise.
* testsuite/std/ranges/access/end.cc: Likewise.
* testsuite/std/ranges/access/end_neg.cc: Likewise.
* testsuite/std/ranges/access/lwg3467.cc: Likewise.
* testsuite/std/ranges/access/p2602.cc: Likewise.
* testsuite/std/ranges/access/rbegin.cc: Likewise.
* testsuite/std/ranges/access/rend.cc: Likewise.
* testsuite/std/ranges/access/size.cc: Likewise.
* testsuite/std/ranges/access/size_neg.cc: Likewise.
* testsuite/std/ranges/access/ssize.cc: Likewise.
* testsuite/std/ranges/adaptors/100479.cc: Likewise.
* testsuite/std/ranges/adaptors/100577.cc: Likewise.
* testsuite/std/ranges/adaptors/93978.cc: Likewise.
* testsuite/std/ranges/adaptors/95322.cc: Likewise.
* testsuite/std/ranges/adaptors/99433.cc: Likewise.
* testsuite/std/ranges/adaptors/all.cc: Likewise.
* testsuite/std/ranges/adaptors/common.cc: Likewise.
* testsuite/std/ranges/adaptors/conditionally_borrowed.cc:
Likewise.
* testsuite/std/ranges/adaptors/counted.cc: Likewise.
* testsuite/std/ranges/adaptors/detail/copyable_box.cc:
Likewise.
* testsuite/std/ranges/adaptors/drop.cc: Likewise.
* testsuite/std/ranges/adaptors/drop_while.cc: Likewise.
* testsuite/std/ranges/adaptors/elements.cc: Likewise.
* testsuite/std/ranges/adaptors/filter.cc: Likewise.
* testsuite/std/ranges/adaptors/join.cc: Likewise.
* 

Re: [PATCH] libstdc++: Reduce integer std::to/from_chars symbol sizes

2023-09-15 Thread Jonathan Wakely via Gcc-patches
On Wed, 13 Sept 2023 at 23:52, Patrick Palka via Libstdc++
 wrote:
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?

OK, thanks.

>
> -- >8 --
>
> For std::to_chars:
>
> The constrained alias __integer_to_chars_result_type seems unnecessary
> ever since r10-3080-g28f0075742ed58 got rid of the only public overload
> which used it.  Now only non-public overloads are constrained by it
> (through their return type) and these non-public overloads aren't used
> in a SFINAE context, so the constraints have no observable effect.  So
> this patch gets rid of this alias, which greatly reduces the symbol
> sizes of the affected functions (since the expanded alias is quite
> large).
>
> For std::from_chars:
>
> We can't get rid of the corresponding alias because it's constrains
> the public integer std::from_chars overload.  But we can avoid having
> the constraint bloat the mangled name by instead encoding it as a
> defaulted template parameter.  We use the non-type parameter form
>
>   enable_if_t<..., int> = 0
>
> instead of the type parameter form
>
>   typename = enable_if_t<...>
>
> because the type form can be circumvented by providing an explicit template
> argument to type parameter, e.g. 'std::from_chars(...)', so the
> non-type form seems like the more robust choice.
>
> In passing, use __is_standard_integer in the constraint.
>
> libstdc++-v3/ChangeLog:
>
> * include/std/charconv (__detail::__integer_to_chars_result_type):
> Remove.
> (__detail::__to_chars_16): Use to_chars_result as return type.
> (__detail::__to_chars_10): Likewise.
> (__detail::__to_chars_8): Likewise.
> (__detail::__to_chars_2): Likewise.
> (__detail::__to_chars_i): Likewise.
> (__detail::__integer_from_chars_result_type): Pull out enable_if_t
> condition into and replace with ...
> (__detail::__integer_from_chars_enabled): ... this.  Use
> __is_standard_integer instead of __is_signed_integer and
> __is_unsigned_integer.
> (from_chars): Encode constraint as a defaulted non-type template
> parameter instead of within the return type.
> ---
>  libstdc++-v3/include/std/charconv | 33 ++-
>  1 file changed, 10 insertions(+), 23 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/charconv 
> b/libstdc++-v3/include/std/charconv
> index 01711d38576..ec25ae139ba 100644
> --- a/libstdc++-v3/include/std/charconv
> +++ b/libstdc++-v3/include/std/charconv
> @@ -79,17 +79,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
>  namespace __detail
>  {
> -  template
> -using __integer_to_chars_result_type
> -  = enable_if_t<__or_<__is_signed_integer<_Tp>,
> - __is_unsigned_integer<_Tp>,
> -#if defined __SIZEOF_INT128__ && defined __STRICT_ANSI__
> - is_same<_Tp, signed __int128>,
> - is_same<_Tp, unsigned __int128>,
> -#endif
> - is_same>>::value,
> -   to_chars_result>;
> -
>// Pick an unsigned type of suitable size. This is used to reduce the
>// number of specializations of __to_chars_len, __to_chars etc. that
>// get instantiated. For example, to_chars and to_chars
> @@ -162,7 +151,7 @@ namespace __detail
>  }
>
>template
> -constexpr __integer_to_chars_result_type<_Tp>
> +constexpr to_chars_result
>  __to_chars_16(char* __first, char* __last, _Tp __val) noexcept
>  {
>static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation 
> bug");
> @@ -208,7 +197,7 @@ namespace __detail
>  }
>
>template
> -constexpr __integer_to_chars_result_type<_Tp>
> +constexpr to_chars_result
>  __to_chars_10(char* __first, char* __last, _Tp __val) noexcept
>  {
>static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation 
> bug");
> @@ -231,7 +220,7 @@ namespace __detail
>  }
>
>template
> -constexpr __integer_to_chars_result_type<_Tp>
> +constexpr to_chars_result
>  __to_chars_8(char* __first, char* __last, _Tp __val) noexcept
>  {
>static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation 
> bug");
> @@ -284,7 +273,7 @@ namespace __detail
>  }
>
>template
> -constexpr __integer_to_chars_result_type<_Tp>
> +constexpr to_chars_result
>  __to_chars_2(char* __first, char* __last, _Tp __val) noexcept
>  {
>static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation 
> bug");
> @@ -320,7 +309,7 @@ namespace __detail
>  } // namespace __detail
>
>template
> -constexpr __detail::__integer_to_chars_result_type<_Tp>
> +constexpr to_chars_result
>  __to_chars_i(char* __first, char* __last, _Tp __value, int __base = 10)
>  {
>__glibcxx_assert(2 <= __base && __base <= 36);
> @@ -548,17 +537,15 @@ namespace __detail
>  }
>
>template
> -using __integer_from_chars_result_type
> -  = 

[committed] libstdc++: Fix constraints for std::variant default constructor

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

Thanks to Nina Ranns for noticing this bug.

Removing the base class isn't an ABI change. It's an empty base class
with a type that's unique to the std::variant that derives from it, so
doesn't change whether two std::variant subobjects can be overlapping.

-- >8 --

The standard says the default ctor should be constrained, not deleted.
Our use of a defaulted default ctor and _Enable_default_constructor base
class results in it being deleted.

libstdc++-v3/ChangeLog:

* include/std/variant (variant): Remove derivation from
_Enable_default_constructor base class.
(variant::variant()): Constrain.
* testsuite/20_util/variant/default_ctor.cc: New test.
---
 libstdc++-v3/include/std/variant  | 24 +--
 .../testsuite/20_util/variant/default_ctor.cc | 11 +
 2 files changed, 23 insertions(+), 12 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/20_util/variant/default_ctor.cc

diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 36eec8d829b..c0e41740dcf 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -1332,9 +1332,6 @@ namespace __variant
   template
 class variant
 : private __detail::__variant::_Variant_base<_Types...>,
-  private _Enable_default_constructor<
-   __detail::__variant::_Traits<_Types...>::_S_default_ctor,
- variant<_Types...>>,
   private _Enable_copy_move<
__detail::__variant::_Traits<_Types...>::_S_copy_ctor,
__detail::__variant::_Traits<_Types...>::_S_copy_assign,
@@ -1355,10 +1352,6 @@ namespace __variant
"variant must have no void alternative");
 
   using _Base = __detail::__variant::_Variant_base<_Types...>;
-  using _Default_ctor_enabler =
-   _Enable_default_constructor<
- __detail::__variant::_Traits<_Types...>::_S_default_ctor,
-   variant<_Types...>>;
 
   template
static constexpr bool __not_self
@@ -1396,7 +1389,16 @@ namespace __variant
  = !__is_in_place_tag<__remove_cvref_t<_Tp>>::value;
 
 public:
-  variant() = default;
+#if __cpp_concepts
+  variant() requires is_default_constructible_v<__to_type<0>> = default;
+#else
+  template,
+  typename = enable_if_t>>
+   constexpr
+   variant() noexcept(is_nothrow_default_constructible_v<__to_type<0>>)
+   { }
+#endif
+
   variant(const variant& __rhs) = default;
   variant(variant&&) = default;
   variant& operator=(const variant&) = default;
@@ -1441,8 +1443,7 @@ namespace __variant
   typename = enable_if_t>>
constexpr explicit
variant(in_place_index_t<_Np>, _Args&&... __args)
-   : _Base(in_place_index<_Np>, std::forward<_Args>(__args)...),
-   _Default_ctor_enabler(_Enable_default_constructor_tag{})
+   : _Base(in_place_index<_Np>, std::forward<_Args>(__args)...)
{ }
 
   template, initializer_list<_Up> __il,
_Args&&... __args)
-   : _Base(in_place_index<_Np>, __il, std::forward<_Args>(__args)...),
-   _Default_ctor_enabler(_Enable_default_constructor_tag{})
+   : _Base(in_place_index<_Np>, __il, std::forward<_Args>(__args)...)
{ }
 
   template
diff --git a/libstdc++-v3/testsuite/20_util/variant/default_ctor.cc 
b/libstdc++-v3/testsuite/20_util/variant/default_ctor.cc
new file mode 100644
index 000..d0d9235a59c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/variant/default_ctor.cc
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++17 } }
+
+#include 
+
+struct A{ A(int); };
+struct B{ B(){}; };
+
+void f(std::variant);
+int f(B);
+
+int unambiguous = f({}); // { dg-bogus "ambiguous" }
-- 
2.41.0



[committed] libstdc++: Remove non-void static assertions in variant's std::get [PR111172]

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

This would be safe to backport and slightly improve compile times.

-- >8 --

A void template argument would cause a substitution failure when trying
to form a reference for the return type, so the function body would
never be instantiated.

libstdc++-v3/ChangeLog:

PR libstdc++/72
* include/std/variant (get): Remove !is_void static
assertions.
---
 libstdc++-v3/include/std/variant | 4 
 1 file changed, 4 deletions(-)

diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 7cb7c3b1d4d..36eec8d829b 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -1123,7 +1123,6 @@ namespace __variant
 {
   static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T must occur exactly once in alternatives");
-  static_assert(!is_void_v<_Tp>, "_Tp must not be void");
   constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
   return std::get<__n>(__v);
 }
@@ -1134,7 +1133,6 @@ namespace __variant
 {
   static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T must occur exactly once in alternatives");
-  static_assert(!is_void_v<_Tp>, "_Tp must not be void");
   constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
   return std::get<__n>(std::move(__v));
 }
@@ -1145,7 +1143,6 @@ namespace __variant
 {
   static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T must occur exactly once in alternatives");
-  static_assert(!is_void_v<_Tp>, "_Tp must not be void");
   constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
   return std::get<__n>(__v);
 }
@@ -1156,7 +1153,6 @@ namespace __variant
 {
   static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T must occur exactly once in alternatives");
-  static_assert(!is_void_v<_Tp>, "_Tp must not be void");
   constexpr size_t __n = std::__find_uniq_type_in_pack<_Tp, _Types...>();
   return std::get<__n>(std::move(__v));
 }
-- 
2.41.0



[committed] libstdc++: Add operator bool to result types (P2497R0)

2023-09-15 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

This was supposed to be in C++23, but I messed up the polls at the last
meeting for C++23 ballot resolution. I've heard suggestions that we
should just backport it to C++23 as a nice quality of life improvement,
but I've also heard objections to any such feature backports (they hurt
portability between compilers). This just adds it for C++26.

-- >8 --

C++26 adds these convenience conversions.

libstdc++-v3/ChangeLog:

* include/bits/version.def (to_chars): Define new value for
C++26.
* include/bits/version.h: Regenerate.
* include/std/charconv (to_chars_result::operator bool): New
function.
(from_chars_result::operator bool): New function.
* testsuite/20_util/to_chars/version.cc: Update expected value.
* testsuite/20_util/from_chars/result.cc: New test.
* testsuite/20_util/to_chars/result.cc: New test.
---
 libstdc++-v3/include/bits/version.def |   7 +
 libstdc++-v3/include/bits/version.h   | 299 +-
 libstdc++-v3/include/std/charconv |   6 +
 .../testsuite/20_util/from_chars/result.cc|  21 ++
 .../testsuite/20_util/to_chars/result.cc  |  25 ++
 .../testsuite/20_util/to_chars/version.cc |   2 +-
 6 files changed, 212 insertions(+), 148 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/20_util/from_chars/result.cc
 create mode 100644 libstdc++-v3/testsuite/20_util/to_chars/result.cc

diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index 8d9b2f71a2e..b7d17c91c34 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -255,6 +255,13 @@ ftms = {
 
 ftms = {
   name = to_chars;
+  values = {
+v = 202306;
+cxxmin = 26;
+extra_cond = "_GLIBCXX_FLOAT_IS_IEEE_BINARY32 "
+"&& _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 "
+"&& __SIZE_WIDTH__ >= 32";
+  };
   values = {
 v = 201611;
 cxxmin = 14;
diff --git a/libstdc++-v3/include/std/charconv 
b/libstdc++-v3/include/std/charconv
index 01711d38576..7edb6ade3d4 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -62,6 +62,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L
 friend bool
 operator==(const to_chars_result&, const to_chars_result&) = default;
+#endif
+#if __cplusplus > 202302L
+constexpr explicit operator bool() const noexcept { return ec == errc{}; }
 #endif
   };
 
@@ -74,6 +77,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #if __cplusplus > 201703L && __cpp_impl_three_way_comparison >= 201907L
 friend bool
 operator==(const from_chars_result&, const from_chars_result&) = default;
+#endif
+#if __cplusplus > 202302L
+constexpr explicit operator bool() const noexcept { return ec == errc{}; }
 #endif
   };
 
diff --git a/libstdc++-v3/testsuite/20_util/from_chars/result.cc 
b/libstdc++-v3/testsuite/20_util/from_chars/result.cc
new file mode 100644
index 000..637678ac532
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/from_chars/result.cc
@@ -0,0 +1,21 @@
+// { dg-do run { target c++26 } }
+
+#include 
+#include 
+
+void
+test_result()
+{
+  static_assert( ! std::is_convertible_v );
+  static_assert( std::is_constructible_v );
+
+  std::from_chars_result res{};
+  VERIFY( res );
+  res.ec = std::errc::invalid_argument;
+  VERIFY( !res );
+}
+
+int main()
+{
+  test_result();
+}
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/result.cc 
b/libstdc++-v3/testsuite/20_util/to_chars/result.cc
new file mode 100644
index 000..5284680460a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/to_chars/result.cc
@@ -0,0 +1,25 @@
+// { dg-do run { target c++26 } }
+
+#include 
+#include 
+
+#if defined(__cpp_lib_to_chars) && __cpp_lib_to_chars < 202306L
+# error "Feature-test macro for std::to_chars has wrong value in "
+#endif
+
+void
+test_result()
+{
+  static_assert( ! std::is_convertible_v );
+  static_assert( std::is_constructible_v );
+
+  std::to_chars_result res{};
+  VERIFY( res );
+  res.ec = std::errc::invalid_argument;
+  VERIFY( !res );
+}
+
+int main()
+{
+  test_result();
+}
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/version.cc 
b/libstdc++-v3/testsuite/20_util/to_chars/version.cc
index 2789afa28ef..f7866ec5377 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/version.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/version.cc
@@ -6,7 +6,7 @@
 
 #ifndef __cpp_lib_to_chars
 # error "Feature-test macro for to_chars missing in "
-#elif __cpp_lib_to_chars != 201611L
+#elif __cpp_lib_to_chars != (__cplusplus == 202302L ? 201611L : 202306L)
 # error "Feature-test macro for to_chars has wrong value in "
 #endif
 
-- 
2.41.0



Re: [PATCH] libstdc++: Use C++20 constraints in

2023-09-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Sept 2023 at 15:13, Patrick Palka via Libstdc++
 wrote:
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
>
> -- >8 --
>
> By now it's probably safe to assume supported compilers have full
> concepts support in C++20 mode.

Clang 14.0.0 is good enough for these uses. It doesn't handle our
 properly, or conditionally trivial special member functions,
but that's not a problem here.

>  And using a requires-clase instead
> enable_if_t inside the return type greatly reduces the sizes of the
> corresponding symbol names.

Will that change when we start to mangle constraints? :-)

OK for trunk.


>
> libstdc++-v3/ChangeLog:
>
> * include/std/bit: Include .
> (byteswap): Use a requires-clause instead of enable_if_t
> inside the return type.
> (_If_is_unsigned_integer): Replace with ...
> (__unsigned_integer): ... this.
> (rotl): Use a requires-clause instead of enable_if_t
> inside the return type.
> (countl_zero): Likewise.
> (countl_one): Likewise.
> (countr_zero): Likewise.
> (countr_one): Likewise.
> (popcount): Likewise.
> (has_single_bit): Likewise.
> (bit_ceil): Likewise.
> (bit_floor): Likewise.
> (bit_width): Likewise.
> ---
>  libstdc++-v3/include/std/bit | 54 ++--
>  1 file changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
> index 987b6cdbb35..dce61b440c5 100644
> --- a/libstdc++-v3/include/std/bit
> +++ b/libstdc++-v3/include/std/bit
> @@ -33,6 +33,7 @@
>
>  #if __cplusplus >= 201402L
>
> +#include  // for std::integral
>  #include 
>
>  #if _GLIBCXX_HOSTED || __has_include()
> @@ -103,9 +104,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> * @return An object of the same type, with the bytes reversed.
> * @since C++23
> */
> -  template
> +  template
>  [[nodiscard]]
> -constexpr enable_if_t::value, _Tp>
> +constexpr _Tp
>  byteswap(_Tp __value) noexcept
>  {
>if constexpr (sizeof(_Tp) == 1)
> @@ -378,54 +379,53 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>  #ifdef __cpp_lib_bitops // C++ >= 20
>
>/// @cond undocumented
> -  template
> -using _If_is_unsigned_integer
> -  = enable_if_t<__is_unsigned_integer<_Tp>::value, _Up>;
> +  template
> +concept __unsigned_integer = __is_unsigned_integer<_Tp>::value;
>/// @endcond
>
>// [bit.rot], rotating
>
>/// Rotate `x` to the left by `s` bits.
> -  template
> -[[nodiscard]] constexpr _If_is_unsigned_integer<_Tp>
> +  template<__unsigned_integer _Tp>
> +[[nodiscard]] constexpr _Tp
>  rotl(_Tp __x, int __s) noexcept
>  { return std::__rotl(__x, __s); }
>
>/// Rotate `x` to the right by `s` bits.
> -  template
> -[[nodiscard]] constexpr _If_is_unsigned_integer<_Tp>
> +  template<__unsigned_integer _Tp>
> +[[nodiscard]] constexpr _Tp
>  rotr(_Tp __x, int __s) noexcept
>  { return std::__rotr(__x, __s); }
>
>// [bit.count], counting
>
>/// The number of contiguous zero bits, starting from the highest bit.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp, int>
> +  template<__unsigned_integer _Tp>
> +constexpr int
>  countl_zero(_Tp __x) noexcept
>  { return std::__countl_zero(__x); }
>
>/// The number of contiguous one bits, starting from the highest bit.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp, int>
> +  template<__unsigned_integer _Tp>
> +constexpr int
>  countl_one(_Tp __x) noexcept
>  { return std::__countl_one(__x); }
>
>/// The number of contiguous zero bits, starting from the lowest bit.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp, int>
> +  template<__unsigned_integer _Tp>
> +constexpr int
>  countr_zero(_Tp __x) noexcept
>  { return std::__countr_zero(__x); }
>
>/// The number of contiguous one bits, starting from the lowest bit.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp, int>
> +  template<__unsigned_integer _Tp>
> +constexpr int
>  countr_one(_Tp __x) noexcept
>  { return std::__countr_one(__x); }
>
>/// The number of bits set in `x`.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp, int>
> +  template<__unsigned_integer _Tp>
> +constexpr int
>  popcount(_Tp __x) noexcept
>  { return std::__popcount(__x); }
>  #endif // __cpp_lib_bitops
> @@ -434,28 +434,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>// [bit.pow.two], integral powers of 2
>
>/// True if `x` is a power of two, false otherwise.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp, bool>
> +  template<__unsigned_integer _Tp>
> +constexpr bool
>  has_single_bit(_Tp __x) noexcept
>  { return std::__has_single_bit(__x); }
>
>/// The smallest power-of-two not less than `x`.
> -  template
> -constexpr _If_is_unsigned_integer<_Tp>
> +  template<__unsigned_integer _Tp>
> + 

[committed] libstdc++: Add testcase for std::make_integer_sequence bug [PR111357]

2023-09-14 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

I'll backport the test and a library workaround to the release branches.

-- >8 --

The compiler bug has been fixed on trunk, but this adds a regression test
for the library component.

libstdc++-v3/ChangeLog:

PR c++/111357
* testsuite/20_util/integer_sequence/pr111357.cc: New test.
---
 .../20_util/integer_sequence/pr111357.cc  | 34 +++
 1 file changed, 34 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc

diff --git a/libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc 
b/libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc
new file mode 100644
index 000..1ad06b732af
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/integer_sequence/pr111357.cc
@@ -0,0 +1,34 @@
+// { dg-do compile { target c++14 } }
+
+// PR c++/111357 - __integer_pack fails to work with values of dependent type
+// convertible to integers in noexcept context
+
+#include 
+
+using std::integer_sequence;
+using std::make_integer_sequence;
+
+template
+void g(integer_sequence)
+{}
+
+template
+struct c1
+{
+  static constexpr int value = 1;
+  constexpr operator int() { return value; }
+};
+
+template
+struct R
+{
+  using S = make_integer_sequence{}>;
+
+  R() noexcept(noexcept(g(S( // { dg-bogus "argument to .__integer_pack." }
+  {}
+};
+
+int main()
+{
+  R();
+}
-- 
2.41.0



[committed] libstdc++: Support dg-additional-files in tests

2023-09-14 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

The text files that these tests use are all identical. Now that each
test starts with a fresh copy of the file it needs, there's no reason to
have different files for each test, so we could remove the duplicates
and change the tests to use the same file name. There are several other
duplicate files in the testsuite/data directory, so they could all be
de-duped later after migrating all tests to dg-additional-files.

-- >8 --

Some tests rely on text files with specific content being present in the
test directory.  This has historically been done by copying
testsuite/data/*.tst and testsuite/data/*.txt to the test dir at the
start, in the libstdc++_init procedure.  Some tests modify their data
files, so if the same test runs more than once in the same directory the
second and subsequent tests will see the modified files, and FAIL
because the content of the file is not in the expected state.

This change adds support for the dg-additional-files directive from the
main compiler testsuite and changes v3_target_compile to copy the
specified files to the directory where the test will run.  This ensures
that a fresh copy of the files is present each time the test runs.

Eventually all tests could be transitioned to use dg-additional-files
and then libstdc++_init could be changed to remove the initial copy of
all files.  This change only adds dg-additional-files to the tests that
modify their files and FAIL when re-run in the same directory.

The tests that rely on additional data files have comments containing
the strings "@require@" and "@diff@" which seem to be related to the
libstdc++-v3/mkcheck.in testing script that was removed in 2003.  Those
comments can be used to find tests that should be migrated to use the
new dg-additional-files support, and then the comments can be removed.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc: Use
dg-additional-files. Remove @require@ and @diff@ comments.
* testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc: Likewise.
* testsuite/lib/dg-options.exp (v3_additional_files): New
global variable.
(dg-additional-files): New proc.
* testsuite/lib/libstdc++.exp (v3_target_compile): Copy
additional files to test directory.
---
 .../testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc   | 4 +---
 .../testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc   | 4 +---
 .../testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc   | 4 +---
 .../testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc   | 4 +---
 libstdc++-v3/testsuite/lib/dg-options.exp| 8 
 libstdc++-v3/testsuite/lib/libstdc++.exp | 9 -
 6 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
index c812c528f26..5afa33e596e 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
@@ -21,14 +21,12 @@
 
 // { dg-require-fileio "" }
 // { dg-require-binary-io "" }
+// { dg-additional-files "seekoff-1io.tst" }
 
 #include 
 #include 
 #include 
 
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %*.txt
-
 const char name_01[] = "seekoff-1io.tst";
 
 void test05() 
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
index 4cfaf68c74e..cd3f765d236 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
@@ -21,14 +21,12 @@
 
 // { dg-require-fileio "" }
 // { dg-require-binary-io "" }
+// { dg-additional-files "seekoff-2io.tst" }
 
 #include 
 #include 
 #include 
 
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %*.txt
-
 const char name_01[] = "seekoff-2io.tst";
 
 void test05() 
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
index 57eabe38214..4566ebd27d9 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
@@ -20,14 +20,12 @@
 // 27.8.1.4 Overridden virtual functions
 
 // { dg-require-fileio "" }
+// { dg-additional-files "seekpos-1io.tst" }
 
 #include 
 #include 
 #include 
 
-// @require@ %-*.tst %-*.txt
-// @diff@ %-*.tst %*.txt
-
 const char name_01[] = "seekpos-1io.tst"; // file with data in it
 
 void test05() 
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc 
b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc
index 714c3d60d2c..8500dd59df8 100644
--- 

[committed] libstdc++: Remove some more unconditional uses of atomics

2023-09-14 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

These atomics cause linker errors on arm4t where __sync_synchronize is
not defined. For single-threaded targets we don't need the atomics.

libstdc++-v3/ChangeLog:

* include/experimental/io_context (io_context) [!_GLIBCXX_HAS_GTHREADS]:
Use a plain integer for _M_work_count for single-threaded
targets.
* include/experimental/memory_resource (__get_default_resource)
[!_GLIBCXX_HAS_GTHREADS]: Use unsynchronized type for
single-threaded targets.
* src/c++17/default_resource.h: Adjust preprocessor conditions
to match memory_resource.cc.
* src/c++17/memory_resource.cc [!_GLIBCXX_HAS_GTHREADS]
(atomic_mem_res): Use unsynchronized type for single-threaded
targets.
---
 libstdc++-v3/include/experimental/io_context  |  4 ++
 .../include/experimental/memory_resource  | 12 -
 libstdc++-v3/src/c++17/default_resource.h |  6 ++-
 libstdc++-v3/src/c++17/memory_resource.cc | 49 ++-
 4 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/libstdc++-v3/include/experimental/io_context 
b/libstdc++-v3/include/experimental/io_context
index c59f8c8e73b..c878d5a7025 100644
--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -562,7 +562,11 @@ inline namespace v1
}
   };
 
+#ifdef _GLIBCXX_HAS_GTHREADS
 atomic _M_work_count;
+#else
+count_type _M_work_count;
+#endif
 mutable execution_context::mutex_type  _M_mtx;
 queue>_M_op;
 bool   _M_stopped = false;
diff --git a/libstdc++-v3/include/experimental/memory_resource 
b/libstdc++-v3/include/experimental/memory_resource
index 9f1cb42373e..6f419a0a929 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -549,10 +549,20 @@ namespace pmr {
   // The default memory resource
 
   /// @cond undocumented
-  inline std::atomic&
+  inline auto&
   __get_default_resource()
   {
+#ifndef _GLIBCXX_HAS_GTHREADS
+struct type {
+  using value_type = memory_resource*;
+  explicit type(value_type __r) : _M_r(__r) { }
+  value_type _M_r;
+  value_type load() const { return _M_r; }
+  value_type exchange(value_type __r) { return std::__exchange(_M_r, __r); 
}
+};
+#else
 using type = atomic;
+#endif
 alignas(type) static unsigned char __buf[sizeof(type)];
 static type* __r = new(__buf) type(new_delete_resource());
 return *__r;
diff --git a/libstdc++-v3/src/c++17/default_resource.h 
b/libstdc++-v3/src/c++17/default_resource.h
index 522cee13b90..f8d03d7d3bc 100644
--- a/libstdc++-v3/src/c++17/default_resource.h
+++ b/libstdc++-v3/src/c++17/default_resource.h
@@ -2,7 +2,11 @@
 // to suppress the warning caused by using a reserved init_priority.
 #pragma GCC system_header
 
-#if ATOMIC_POINTER_LOCK_FREE == 2 || defined(__GTHREAD_MUTEX_INIT)
+#ifndef _GLIBCXX_HAS_GTHREADS
+# error "This file should not be included for this build"
+#elif ATOMIC_POINTER_LOCK_FREE == 2
+# error "This file should not be included for this build"
+#elif defined __GTHREAD_MUTEX_INIT
 # error "This file should not be included for this build"
 #endif
 
diff --git a/libstdc++-v3/src/c++17/memory_resource.cc 
b/libstdc++-v3/src/c++17/memory_resource.cc
index c0c7cf0cf83..63856eadaf5 100644
--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -27,9 +27,9 @@
 #include 
 #include  // has_single_bit, bit_ceil, bit_width
 #include 
+#include  // std::__exchange
 #if ATOMIC_POINTER_LOCK_FREE != 2
 # include// std::mutex, std::lock_guard
-# include // std::__exchange
 #endif
 
 #if __has_cpp_attribute(clang::require_constant_initialization)
@@ -94,10 +94,31 @@ namespace pmr
 
 __constinit constant_init newdel_res{};
 __constinit constant_init null_res{};
-#if ATOMIC_POINTER_LOCK_FREE == 2
+
+#ifndef _GLIBCXX_HAS_GTHREADS
+# define _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED
+// Single-threaded, no need for synchronization
+struct atomic_mem_res
+{
+  constexpr
+  atomic_mem_res(memory_resource* r) : val(r) { }
+
+  memory_resource* val;
+
+  memory_resource* load(std::memory_order) const
+  {
+   return val;
+  }
+
+  memory_resource* exchange(memory_resource* r, std::memory_order)
+  {
+   return std::__exchange(val, r);
+  }
+};
+#elif ATOMIC_POINTER_LOCK_FREE == 2
 using atomic_mem_res = atomic;
 # define _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED
-#elif defined(_GLIBCXX_HAS_GTHREADS)
+#else
 // Can't use pointer-width atomics, define a type using a mutex instead:
 struct atomic_mem_res
 {
@@ -123,27 +144,7 @@ namespace pmr
return std::__exchange(val, r);
   }
 };
-#else
-# define 

Re: [PATCH v2 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Sept 2023 at 10:10, Christophe Lyon
 wrote:
>
> Some targets like arm-eabi with newlib and default settings rely on
> __sync_synchronize() to ensure synchronization.  Newlib does not
> implement it by default, to make users aware they have to take special
> care.
>
> This makes a few tests fail to link.
>
> This patch requires the missing thread-fence effective target in the
> tests that need it, making them UNSUPPORTED instead of FAIL and
> UNRESOLVED.

OK for trunk, thanks.


>
> 2023-09-10  Christophe Lyon  
>
> libstdc++-v3/
> * testsuite/29_atomics/atomic/compare_exchange_padding.cc: Likewise.
> * testsuite/29_atomics/atomic/cons/value_init.cc: Likewise.
> * testsuite/29_atomics/atomic_float/value_init.cc: Likewise.
> * testsuite/29_atomics/atomic_integral/cons/value_init.cc: Likewise.
> * testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc: 
> Likewise.
> * testsuite/29_atomics/atomic_ref/generic.cc: Likewise.
> * testsuite/29_atomics/atomic_ref/integral.cc: Likewise.
> * testsuite/29_atomics/atomic_ref/pointer.cc: Likewise.
> ---
>  .../testsuite/29_atomics/atomic/compare_exchange_padding.cc  | 1 +
>  libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc  | 1 +
>  libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc | 1 +
>  .../testsuite/29_atomics/atomic_integral/cons/value_init.cc  | 1 +
>  .../testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc  | 1 +
>  libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc  | 1 +
>  libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc | 1 +
>  libstdc++-v3/testsuite/29_atomics/atomic_ref/pointer.cc  | 1 +
>  8 files changed, 8 insertions(+)
>
> diff --git 
> a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
> index c4ab876db2a..2e7ff0307bc 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
> @@ -1,5 +1,6 @@
>  // { dg-options "-std=gnu++20" }
>  // { dg-do run { target c++20 } }
> +// { dg-require-thread-fence "" }
>  // { dg-add-options libatomic }
>
>  #include 
> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc
> index 47d5a5d5b28..b8019486ccf 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic/cons/value_init.cc
> @@ -17,6 +17,7 @@
>
>  // { dg-options "-std=gnu++2a" }
>  // { dg-do run { target c++2a } }
> +// { dg-require-thread-fence "" }
>
>  #include 
>
> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
> index 1cd1efb5422..6e89f2fc2a8 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
> @@ -17,6 +17,7 @@
>
>  // { dg-options "-std=gnu++2a" }
>  // { dg-do run { target c++2a } }
> +// { dg-require-thread-fence "" }
>  // { dg-add-options libatomic }
>
>  #include 
> diff --git 
> a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc
> index 96615a7d09f..2f6a48d36d8 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic_integral/cons/value_init.cc
> @@ -17,6 +17,7 @@
>
>  // { dg-options "-std=gnu++2a" }
>  // { dg-do run { target c++2a } }
> +// { dg-require-thread-fence "" }
>
>  #include 
>  #include 
> diff --git 
> a/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc
> index 0dab8a23e10..8469ebf8a14 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc
> @@ -1,5 +1,6 @@
>  // { dg-options "-std=gnu++20" }
>  // { dg-do run { target c++20 } }
> +// { dg-require-thread-fence "" }
>  // { dg-add-options libatomic }
>
>  #include 
> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc
> index 14f417d1739..adae07f8754 100644
> --- a/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc
> +++ b/libstdc++-v3/testsuite/29_atomics/atomic_ref/generic.cc
> @@ -17,6 +17,7 @@
>
>  // { dg-options "-std=gnu++2a" }
>  // { dg-do run { target c++2a } }
> +// { dg-require-thread-fence "" }
>  // { dg-add-options libatomic }
>
>  #include 
> diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc 
> b/libstdc++-v3/testsuite/29_atomics/atomic_ref/integral.cc
> index e03ca921eb9..a98adb7fbba 100644
> 

Re: [PATCH] libstdc++: Remove some more unconditional uses of atomics

2023-09-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Sept 2023 at 09:41, Christophe Lyon
 wrote:
>
>
>
> On Thu, 14 Sept 2023 at 10:17, Jonathan Wakely  wrote:
>>
>> On Thu, 14 Sept 2023 at 08:44, Christophe Lyon
>>  wrote:
>> >
>> > Hi,
>> >
>> >
>> > On Wed, 13 Sept 2023 at 14:32, Jonathan Wakely  wrote:
>> >>
>> >> Tested x86_64-linux and aarch64-linux. I intend to push this to trunk.
>> >>
>> >> -- >8 --
>> >>
>> >> These atomics cause linker errors on arm4t where __sync_synchronize is
>> >> not defined. For single-threaded targets we don't need the atomics.
>> >>
>> >
>> > I ran the tests on arm-eabi default config (so, armv4t) with this patch, 
>> > and here is the list of remaining UNRESOLVED tests:
>> >  29_atomics/atomic/compare_exchange_padding.cc
>> > 29_atomics/atomic/cons/value_init.cc
>> > 29_atomics/atomic_float/value_init.cc
>> > 29_atomics/atomic_integral/cons/value_init.cc
>> > 29_atomics/atomic_ref/compare_exchange_padding.cc
>> > 29_atomics/atomic_ref/generic.cc
>> > 29_atomics/atomic_ref/integral.cc
>> > 29_atomics/atomic_ref/pointer.cc
>> > experimental/polymorphic_allocator/construct_pair.cc
>> >
>> > all of them are due to undefined reference to __sync_synchronize
>> > (some also reference __atomic_compare_exchange_4, etc...)
>> >
>> >
>> > IIUC, this should not be the case for 
>> > experimental/polymorphic_allocator/construct_pair.cc ?
>> > The reference for __sync_synchronize is near the beginning of test0[123]
>> > from a call to __atomic_load_n line 835 of atomic_base.h
>> > not sure where it comes from, the .loc directive indicates line 28 of the 
>> > testcase which is the opening brace
>>
>> Doh, I removed the atomics from  but this is
>> , which has a separate implementation.
>>
>> I'll make a change to  as well, thanks
>> for catching my silly mistake.
>>
>
> You're welcome.
> So I'll shrink my patch and add dg-require-thread-fence only to the few 
> 29_atomics tests listed above.

Great, thanks. That's approved for trunk then.

N.B. if you'd prefer to add { dg-require-effective-target thread_fence
} instead of { dg-require-thread-fence "" } then that's fine, just
note that the effective target uses an underscore not a hyphen. The
dg-require-thread-fence proc just uses the proc that checks the
thread_fence effective target, so both forms do the same thing.



Re: [PATCH] libstdc++: Remove some more unconditional uses of atomics

2023-09-14 Thread Jonathan Wakely via Gcc-patches
On Thu, 14 Sept 2023 at 08:44, Christophe Lyon
 wrote:
>
> Hi,
>
>
> On Wed, 13 Sept 2023 at 14:32, Jonathan Wakely  wrote:
>>
>> Tested x86_64-linux and aarch64-linux. I intend to push this to trunk.
>>
>> -- >8 --
>>
>> These atomics cause linker errors on arm4t where __sync_synchronize is
>> not defined. For single-threaded targets we don't need the atomics.
>>
>
> I ran the tests on arm-eabi default config (so, armv4t) with this patch, and 
> here is the list of remaining UNRESOLVED tests:
>  29_atomics/atomic/compare_exchange_padding.cc
> 29_atomics/atomic/cons/value_init.cc
> 29_atomics/atomic_float/value_init.cc
> 29_atomics/atomic_integral/cons/value_init.cc
> 29_atomics/atomic_ref/compare_exchange_padding.cc
> 29_atomics/atomic_ref/generic.cc
> 29_atomics/atomic_ref/integral.cc
> 29_atomics/atomic_ref/pointer.cc
> experimental/polymorphic_allocator/construct_pair.cc
>
> all of them are due to undefined reference to __sync_synchronize
> (some also reference __atomic_compare_exchange_4, etc...)
>
>
> IIUC, this should not be the case for 
> experimental/polymorphic_allocator/construct_pair.cc ?
> The reference for __sync_synchronize is near the beginning of test0[123]
> from a call to __atomic_load_n line 835 of atomic_base.h
> not sure where it comes from, the .loc directive indicates line 28 of the 
> testcase which is the opening brace

Doh, I removed the atomics from  but this is
, which has a separate implementation.

I'll make a change to  as well, thanks
for catching my silly mistake.



Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix friend declarations

2023-09-13 Thread Jonathan Wakely via Gcc-patches
On Wed, 13 Sept 2023 at 21:47, François Dumont  wrote:
>
> It's working and what's I've committed.

Nice, thanks!


>
> Thanks
>
> On 12/09/2023 19:04, Jonathan Wakely wrote:
> > On Tue, 12 Sept 2023 at 17:47, Jonathan Wakely  wrote:
> >> On Wed, 23 Aug 2023 at 18:35, François Dumont via Libstdc++
> >>  wrote:
> >>> Hi
> >>>
> >>> The few tests that are failing in versioned namespace mode are due to
> >>> those friend declarations.
> >>>
> >>> This is a fix proposal even if I considered 2 other options:
> >>>
> >>> 1. Make __format::_Arg_store a struct and so do not bother with friend
> >>> declarations.
> >>>
> >>> 2. Consider it as a compiler bug and do nothing. In this case I think we
> >>> might still need this patch to avoid a non-working format library in
> >>> versioned namespace mode in gcc 14 if compiler bug is not fixed.
> >> It definitely is a compiler bug, this is PR c++/59256.
> >>
> >> Please add a comment to the new macro definition, so we remember to
> >> remove it when it's not needed:
> >>
> >>
> >> #if _GLIBCXX_INLINE_VERSION
> >> // Needed because of PR c++/59526
> >> # define _GLIBCXX_STD_V std::__8
> >> #else
> >> # define _GLIBCXX_STD_V std
> >> #endif
> >>
> >>
> >> OK with that change, thanks.
> > Actually, are you sure the friend std::basic_format_args declaration
> > needs to change?
> >
> > I only see errors for the friend function, not the friend class. So
> > this seems to fix it:
> >
> > --- a/libstdc++-v3/include/std/format
> > +++ b/libstdc++-v3/include/std/format
> > @@ -3437,7 +3437,13 @@ namespace __format
> >
> >template
> > friend auto
> > -   std::make_format_args(_Argz&&...) noexcept;
> > +#if _GLIBCXX_INLINE_VERSION
> > +   // Needed for PR c++/59526
> > +   std::__8::
> > +#else
> > +   std::
> > +#endif
> > +   make_format_args(_Argz&&...) noexcept;
> >
> >// For a sufficiently small number of arguments we only store values.
> >// basic_format_args can get the types from the _Args pack.
> >
> >
> >
> >
> >>
> >>> I can also define _GLIBCXX_STD_V at  level to limit impact.
> >>>
> >>>   libstdc++: [_GLIBCXX_INLINE_VERSION] Fix  friend 
> >>> declarations
> >>>
> >>>   GCC do not consider the inline namespace in friend declarations. We
> >>> need
> >>>   to explicit this namespace.
> >>>
> >>>   libstdc++-v3/ChangeLog:
> >>>
> >>>   * include/bits/c++config (_GLIBCXX_STD_V): New macro giving
> >>> current
> >>>   std namespace with optionally the version namespace.
> >>>   * include/std/format (std::__format::_Arg_store): Use
> >>> latter on friend
> >>>   declarations.
> >>>
> >>> Tested under versioned mode.
> >>>
> >>> Ok to commit ?
> >>>
> >>> François
>



Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-13 Thread Jonathan Wakely via Gcc-patches
On Wed, 13 Sept 2023 at 16:38, Christophe Lyon via Libstdc++
 wrote:
>
> On Tue, 12 Sept 2023 at 11:07, Jonathan Wakely  wrote:
>
> > On Tue, 12 Sept 2023 at 08:59, Christophe Lyon
> >  wrote:
> > > I've noticed several undefined references to
> > __glibcxx_backtrace_create_state too
> > > 19_diagnostics/stacktrace/current.cc
> > > 19_diagnostics/stacktrace/entry.cc
> > > 19_diagnostics/stacktrace/stacktrace.cc
> >
> > Odd. These were changed in r14-3812-gb96b554592c5cb to link to
> > libstdc++exp.a instead of libstdc++_libbacktrace.a, and
> > __glibcxx_backtrace_create_state should be part of libstdc++exp.a now.
> > If the target doesn't support libbacktrace then the symbols will be
> > missing from libstdc++exp.a, but then the test should fail to match
> > the effective target "stacktrace".
> >
> > Strange, it looks like these libs were not correctly rebuilt after I
> rebased to have your patches.
> I've rebuilt from scratch and these undefined references are not present
> indeed.

Great! Thanks for checking.

I sent a proposed patch that should remove most of the other
unnecessary uses of atomics, as suggested yesterday:
https://patchwork.sourceware.org/project/gcc/patch/20230913123226.2083892-1-jwak...@redhat.com/
Would you be able to check whether that improves the results further for arm4t?
I think with that, you should only need the dg-require-thread-fence
for the 9 or so tests under 29_atomics/ which really do require atomic
synchronization.


[PATCH] libstdc++: Remove some more unconditional uses of atomics

2023-09-13 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux and aarch64-linux. I intend to push this to trunk.

-- >8 --

These atomics cause linker errors on arm4t where __sync_synchronize is
not defined. For single-threaded targets we don't need the atomics.

libstdc++-v3/ChangeLog:

* include/experimental/io_context (io_context) [!_GLIBCXX_HAS_GTHREADS]:
Use a plain integer for _M_work_count for single-threaded
targets.
* src/c++17/memory_resource.cc [!_GLIBCXX_HAS_GTHREADS]
(atomic_mem_res): Use unsynchronized type for single-threaded
targets.
---
 libstdc++-v3/include/experimental/io_context |  4 ++
 libstdc++-v3/src/c++17/memory_resource.cc| 49 ++--
 2 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/libstdc++-v3/include/experimental/io_context 
b/libstdc++-v3/include/experimental/io_context
index c59f8c8e73b..c878d5a7025 100644
--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -562,7 +562,11 @@ inline namespace v1
}
   };
 
+#ifdef _GLIBCXX_HAS_GTHREADS
 atomic _M_work_count;
+#else
+count_type _M_work_count;
+#endif
 mutable execution_context::mutex_type  _M_mtx;
 queue>_M_op;
 bool   _M_stopped = false;
diff --git a/libstdc++-v3/src/c++17/memory_resource.cc 
b/libstdc++-v3/src/c++17/memory_resource.cc
index c0c7cf0cf83..63856eadaf5 100644
--- a/libstdc++-v3/src/c++17/memory_resource.cc
+++ b/libstdc++-v3/src/c++17/memory_resource.cc
@@ -27,9 +27,9 @@
 #include 
 #include  // has_single_bit, bit_ceil, bit_width
 #include 
+#include  // std::__exchange
 #if ATOMIC_POINTER_LOCK_FREE != 2
 # include// std::mutex, std::lock_guard
-# include // std::__exchange
 #endif
 
 #if __has_cpp_attribute(clang::require_constant_initialization)
@@ -94,10 +94,31 @@ namespace pmr
 
 __constinit constant_init newdel_res{};
 __constinit constant_init null_res{};
-#if ATOMIC_POINTER_LOCK_FREE == 2
+
+#ifndef _GLIBCXX_HAS_GTHREADS
+# define _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED
+// Single-threaded, no need for synchronization
+struct atomic_mem_res
+{
+  constexpr
+  atomic_mem_res(memory_resource* r) : val(r) { }
+
+  memory_resource* val;
+
+  memory_resource* load(std::memory_order) const
+  {
+   return val;
+  }
+
+  memory_resource* exchange(memory_resource* r, std::memory_order)
+  {
+   return std::__exchange(val, r);
+  }
+};
+#elif ATOMIC_POINTER_LOCK_FREE == 2
 using atomic_mem_res = atomic;
 # define _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED
-#elif defined(_GLIBCXX_HAS_GTHREADS)
+#else
 // Can't use pointer-width atomics, define a type using a mutex instead:
 struct atomic_mem_res
 {
@@ -123,27 +144,7 @@ namespace pmr
return std::__exchange(val, r);
   }
 };
-#else
-# define _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED
-// Single-threaded, no need for synchronization
-struct atomic_mem_res
-{
-  constexpr
-  atomic_mem_res(memory_resource* r) : val(r) { }
-
-  memory_resource* val;
-
-  memory_resource* load(std::memory_order) const
-  {
-   return val;
-  }
-
-  memory_resource* exchange(memory_resource* r, std::memory_order)
-  {
-   return std::__exchange(val, r);
-  }
-};
-#endif // ATOMIC_POINTER_LOCK_FREE == 2
+#endif
 
 #ifdef _GLIBCXX_ATOMIC_MEM_RES_CAN_BE_CONSTANT_INITIALIZED
 __constinit constant_init default_res{_res.obj};
-- 
2.41.0



Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix friend declarations

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Tue, 12 Sept 2023 at 17:47, Jonathan Wakely  wrote:
>
> On Wed, 23 Aug 2023 at 18:35, François Dumont via Libstdc++
>  wrote:
> >
> > Hi
> >
> > The few tests that are failing in versioned namespace mode are due to
> > those friend declarations.
> >
> > This is a fix proposal even if I considered 2 other options:
> >
> > 1. Make __format::_Arg_store a struct and so do not bother with friend
> > declarations.
> >
> > 2. Consider it as a compiler bug and do nothing. In this case I think we
> > might still need this patch to avoid a non-working format library in
> > versioned namespace mode in gcc 14 if compiler bug is not fixed.
>
> It definitely is a compiler bug, this is PR c++/59256.
>
> Please add a comment to the new macro definition, so we remember to
> remove it when it's not needed:
>
>
> #if _GLIBCXX_INLINE_VERSION
> // Needed because of PR c++/59526
> # define _GLIBCXX_STD_V std::__8
> #else
> # define _GLIBCXX_STD_V std
> #endif
>
>
> OK with that change, thanks.

Actually, are you sure the friend std::basic_format_args declaration
needs to change?

I only see errors for the friend function, not the friend class. So
this seems to fix it:

--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -3437,7 +3437,13 @@ namespace __format

  template
   friend auto
-   std::make_format_args(_Argz&&...) noexcept;
+#if _GLIBCXX_INLINE_VERSION
+   // Needed for PR c++/59526
+   std::__8::
+#else
+   std::
+#endif
+   make_format_args(_Argz&&...) noexcept;

  // For a sufficiently small number of arguments we only store values.
  // basic_format_args can get the types from the _Args pack.




>
>
> >
> > I can also define _GLIBCXX_STD_V at  level to limit impact.
> >
> >  libstdc++: [_GLIBCXX_INLINE_VERSION] Fix  friend declarations
> >
> >  GCC do not consider the inline namespace in friend declarations. We
> > need
> >  to explicit this namespace.
> >
> >  libstdc++-v3/ChangeLog:
> >
> >  * include/bits/c++config (_GLIBCXX_STD_V): New macro giving
> > current
> >  std namespace with optionally the version namespace.
> >  * include/std/format (std::__format::_Arg_store): Use
> > latter on friend
> >  declarations.
> >
> > Tested under versioned mode.
> >
> > Ok to commit ?
> >
> > François



Re: [PATCH][_GLIBCXX_INLINE_VERSION] Fix friend declarations

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Wed, 23 Aug 2023 at 18:35, François Dumont via Libstdc++
 wrote:
>
> Hi
>
> The few tests that are failing in versioned namespace mode are due to
> those friend declarations.
>
> This is a fix proposal even if I considered 2 other options:
>
> 1. Make __format::_Arg_store a struct and so do not bother with friend
> declarations.
>
> 2. Consider it as a compiler bug and do nothing. In this case I think we
> might still need this patch to avoid a non-working format library in
> versioned namespace mode in gcc 14 if compiler bug is not fixed.

It definitely is a compiler bug, this is PR c++/59256.

Please add a comment to the new macro definition, so we remember to
remove it when it's not needed:


#if _GLIBCXX_INLINE_VERSION
// Needed because of PR c++/59526
# define _GLIBCXX_STD_V std::__8
#else
# define _GLIBCXX_STD_V std
#endif


OK with that change, thanks.




>
> I can also define _GLIBCXX_STD_V at  level to limit impact.
>
>  libstdc++: [_GLIBCXX_INLINE_VERSION] Fix  friend declarations
>
>  GCC do not consider the inline namespace in friend declarations. We
> need
>  to explicit this namespace.
>
>  libstdc++-v3/ChangeLog:
>
>  * include/bits/c++config (_GLIBCXX_STD_V): New macro giving
> current
>  std namespace with optionally the version namespace.
>  * include/std/format (std::__format::_Arg_store): Use
> latter on friend
>  declarations.
>
> Tested under versioned mode.
>
> Ok to commit ?
>
> François



Re: [PATCH] [11/12/13/14 Regression] ABI break in _Hash_node_value_base since GCC 11 [PR 111050]

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Sept 2023 at 18:19, François Dumont  wrote:
>
>
> On 11/09/2023 13:51, Jonathan Wakely wrote:
> > On Sun, 10 Sept 2023 at 14:57, François Dumont via Libstdc++
> >  wrote:
> >> Following confirmation of the fix by TC here is the patch where I'm
> >> simply adding a 'constexpr' on _M_next().
> >>
> >> Please let me know this ChangeLog entry is correct. I would prefer this
> >> patch to be assigned to 'TC' with me as co-author but I don't know how
> >> to do such a thing. Unless I need to change my user git identity to do so ?
> > Sam already explained that, but please check with Tim how he wants to
> > be credited, if at all. He doesn't have a copyright assignment, and
> > hasn't added a DCO sign-off to the patch, but it's small enough to not
> > need it as this is the first contribution credited to him.
> >
> >
> >>   libstdc++: Add constexpr qualification to _Hash_node::_M_next()
> > What has this constexpr addition got to do with the ABI change and the
> > always_inline attributes?
> >
> > It certainly doesn't seem like it should be the summary line of the
> > git commit message.
>
> Oops, sorry, that's what I had started to do before Tim submitted anything.
>
> Here is latest version:

No patch attached, and the ChangeLog below still mentions the constexpr.

I've pinged Tim via another channel to ask him about the author attribution.


>
> Author: TC 
> Date:   Wed Sep 6 19:31:55 2023 +0200
>
>  libstdc++: Force inline on _Hash_node_value_base methods to fix abi
> (PR111050)
>
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1b6f0476837205932613ddb2b3429a55c26c409d
>  changed _Hash_node_value_base to no longer derive from
> _Hash_node_base, which means
>  that its member functions expect _M_storage to be at a different
> offset. So explosions
>  result if an out-of-line definition is emitted for any of the
> member functions (say,
>  in a non-optimized build) and the resulting object file is then
> linked with code built
>  using older version of GCC/libstdc++.
>
>  libstdc++-v3/ChangeLog:
>
>  PR libstdc++/111050
>  * include/bits/hashtable_policy.h
>  (_Hash_node_value_base<>::_M_valptr(),
> _Hash_node_value_base<>::_M_v())
>  Add [[__gnu__::__always_inline__]].
>  (_Hash_node<>::_M_next()): Add constexpr.
>
>  Co-authored-by: François Dumont 
>
> Ok for you TC (Tim ?) ?
>
>



[PATCH 14/13] libstdc++: Re-initialize static data files used by tests

2023-09-12 Thread Jonathan Wakely via Gcc-patches
This fixes the problem observed with some filebuf tests.

The "@require@" string seems a bit hacky, as I don't know why that
string is in the tests in the first palce ... but it is there, so this
works.

-- > 8--

Some tests rely on text files with specific content being present in the
test directory. Because the tests modify those files, running the same
test more than once in the same directory will FAIL because the content
of the file is not in the expected state.

This uses a "@require@" marker that happens to be present in those tests
to decide when we need to copy the original files into the test dir
again, so that repeated tests always see the initial file content.

libstdc++-v3/ChangeLog:

* testsuite/lib/libstdc++.exp (v3-init-data-files): New proc.
(libstdc++_init): Use v3-init-data-files.
(v3-dg-runtest): Use v3-init-data-files to update test data
files for repeated tests.
---
 libstdc++-v3/testsuite/lib/libstdc++.exp | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 2c497707184..daace4c1d59 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -102,6 +102,12 @@ proc v3-copy-files {srcfiles} {
 }
 }
 
+proc v3-init-data-files { } {
+global srcdir
+v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
+v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
+}
+
 # Called once, during runtest.exp setup.
 proc libstdc++_init { testfile } {
 global env
@@ -159,8 +165,7 @@ proc libstdc++_init { testfile } {
 set dg-do-what-default run
 
 # Copy any required data files.
-v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
-v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
+v3-init-data-files
 
 set ld_library_path_tmp ""
 
@@ -556,11 +561,26 @@ proc v3-dg-runtest { testcases flags default-extra-flags 
} {
set option_list { "" }
}
 
+   # Some tests (e.g. 27_io/basic_filebuf/seek{off,pos}/char/[12]-io.cc)
+   # rely on text files with specific data being present in the test dir.
+   # Because the tests modify those files, running the same test a second
+   # time will FAIL due to the files not being in their initial state.
+   # We rely on the fact that those files contain a "@require@" comment
+   # to trigger creating fresh copies of the files for repeated tests.
+   if [search_for $test "@require@"] {
+   set need_fresh_data_files [llength $option_list]
+   } else {
+   set need_fresh_data_files 0
+   }
+
set nshort [file tail [file dirname $test]]/[file tail $test]
 
foreach flags_t $option_list {
verbose "Testing $nshort, $flags $flags_t" 1
dg-test $test "$flags $flags_t" ${default-extra-flags}
+   if { $need_fresh_data_files > 1 } {
+   v3-init-data-files
+   }
}
 }
 }
-- 
2.41.0



Re: [PATCH 3/3] libstdc++: Fix std::not_fn perfect forwarding [PR111327]

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Tue, 12 Sept 2023 at 02:11, Patrick Palka via Libstdc++
 wrote:
>
> The previous patch fixed perfect forwarding for std::bind_front.
> This patch fixes the same issue for std::not_fn.
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk and
> perhaps 13?

Yes for both, thanks.

>
> PR libstdc++/111327
>
> libstdc++-v3/ChangeLog:
>
> * include/std/functional (_GLIBCXX_NOT_FN_CALL_OP): Also define
> a deleted fallback operator() overload.  Constrain both the
> main and deleted overloads accordingly.
> * testsuite/20_util/function_objects/not_fn/111327.cc: New test.
> ---
>  libstdc++-v3/include/std/functional   | 10 +--
>  .../20_util/function_objects/not_fn/111327.cc | 29 +++
>  2 files changed, 37 insertions(+), 2 deletions(-)
>  create mode 100644 
> libstdc++-v3/testsuite/20_util/function_objects/not_fn/111327.cc
>
> diff --git a/libstdc++-v3/include/std/functional 
> b/libstdc++-v3/include/std/functional
> index c50b9e4d365..9551e38dfdb 100644
> --- a/libstdc++-v3/include/std/functional
> +++ b/libstdc++-v3/include/std/functional
> @@ -1061,7 +1061,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>// forwarding _M_fn and the function arguments with the same 
> qualifiers,
>// and deducing the return type and exception-specification.
>  #define _GLIBCXX_NOT_FN_CALL_OP( _QUALS )  \
> -  template  \
> +  template +  typename = enable_if_t<__is_invocable<_Fn _QUALS, 
> _Args...>::value>> \
> _GLIBCXX20_CONSTEXPR\
> decltype(_S_not<__inv_res_t<_Fn _QUALS, _Args...>>())   \
> operator()(_Args&&... __args) _QUALS\
> @@ -1070,7 +1071,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> {   \
>   return !std::__invoke(std::forward< _Fn _QUALS >(_M_fn),  \
> std::forward<_Args>(__args)...);\
> -   }
> +   }   \
> +   \
> +  template +  typename = enable_if_t _Args...>::value>> \
> +   void operator()(_Args&&... __args) _QUALS = delete;
> +
>_GLIBCXX_NOT_FN_CALL_OP( & )
>_GLIBCXX_NOT_FN_CALL_OP( const & )
>_GLIBCXX_NOT_FN_CALL_OP( && )
> diff --git a/libstdc++-v3/testsuite/20_util/function_objects/not_fn/111327.cc 
> b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/111327.cc
> new file mode 100644
> index 000..93e00ee8057
> --- /dev/null
> +++ b/libstdc++-v3/testsuite/20_util/function_objects/not_fn/111327.cc
> @@ -0,0 +1,29 @@
> +// PR libstdc++/111327 - std::bind_front (and std::not_fn) doesn't perfectly
> +// forward according to value category of the call wrapper object
> +// { dg-do compile { target c++17 } }
> +
> +#include 
> +#include 
> +
> +struct F {
> +  void operator()(...) & = delete;
> +  bool operator()(...) const &;
> +};
> +
> +struct G {
> +  void operator()(...) && = delete;
> +  bool operator()(...) const &&;
> +};
> +
> +int main() {
> +  auto f = std::not_fn(F{});
> +  f(); // { dg-error "deleted" }
> +  std::move(f)();
> +  std::as_const(f)();
> +  std::move(std::as_const(f))();
> +
> +  auto g = std::not_fn(G{});
> +  g(); // { dg-error "deleted" }
> +  std::move(g)(); // { dg-error "deleted" }
> +  std::move(std::as_const(g))();
> +}
> --
> 2.42.0.158.g94e83dcf5b
>



Re: [PATCH 2/3] libstdc++: Fix std::bind_front perfect forwarding [PR111327]

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Tue, 12 Sept 2023 at 02:09, Patrick Palka via Libstdc++
 wrote:
>
> In order to properly implement a perfect forwarding call wrapper
> (before 'deducing this' at least) we need a total of 8 operator()
> overloads, 4 main ones and 4 deleted ones for each const/ref qual pair,
> as described in section 5.5 of P0847R6.  Otherwise the wrapper may
> not perfectly forward according to the value category and constness
> of the wrapped object.  This patch fixes this bug in std::bind_front.

OK for trunk, thanks.

>
> PR libstdc++/111327
>
> libstdc++-v3/ChangeLog:
>
> * include/std/functional (_Bind_front::operator()): Add deleted
> fallback overloads for each const/ref qualifier pair.  Give the
> main overloads dummy constraints to make them more specialized
> than the deleted overloads.
> * testsuite/20_util/function_objects/bind_front/111327.cc: New test.
> ---
>  libstdc++-v3/include/std/functional   | 16 
>  .../function_objects/bind_front/111327.cc | 41 +++
>  2 files changed, 57 insertions(+)
>  create mode 100644 
> libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc
>
> diff --git a/libstdc++-v3/include/std/functional 
> b/libstdc++-v3/include/std/functional
> index 7d1b890bb4e..c50b9e4d365 100644
> --- a/libstdc++-v3/include/std/functional
> +++ b/libstdc++-v3/include/std/functional
> @@ -938,6 +938,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>~_Bind_front() = default;
>
>template
> +   requires true
> constexpr
> invoke_result_t<_Fd&, _BoundArgs&..., _CallArgs...>
> operator()(_CallArgs&&... __call_args) &
> @@ -948,6 +949,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> }
>
>template
> +   requires true
> constexpr
> invoke_result_t
> operator()(_CallArgs&&... __call_args) const &
> @@ -959,6 +961,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> }
>
>template
> +   requires true
> constexpr
> invoke_result_t<_Fd, _BoundArgs..., _CallArgs...>
> operator()(_CallArgs&&... __call_args) &&
> @@ -969,6 +972,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> }
>
>template
> +   requires true
> constexpr
> invoke_result_t
> operator()(_CallArgs&&... __call_args) const &&
> @@ -979,6 +983,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>   std::forward<_CallArgs>(__call_args)...);
> }
>
> +  template
> +   void operator()(_CallArgs&&...) & = delete;
> +
> +  template
> +   void operator()(_CallArgs&&...) const & = delete;
> +
> +  template
> +   void operator()(_CallArgs&&...) && = delete;
> +
> +  template
> +   void operator()(_CallArgs&&...) const && = delete;
> +
>  private:
>using _BoundIndices = index_sequence_for<_BoundArgs...>;
>
> diff --git 
> a/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc 
> b/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc
> new file mode 100644
> index 000..6eb51994476
> --- /dev/null
> +++ b/libstdc++-v3/testsuite/20_util/function_objects/bind_front/111327.cc
> @@ -0,0 +1,41 @@
> +// PR libstdc++/111327 - std::bind_front doesn't perfectly forward according
> +// to value category of the call wrapper object
> +// { dg-options "-std=gnu++20" }
> +// { dg-do compile { target c++20 } }
> +
> +#include 
> +#include 
> +
> +struct F {
> +  void operator()(...) & = delete;
> +  void operator()(...) const &;
> +};
> +
> +struct G {
> +  void operator()(...) && = delete;
> +  void operator()(...) const &&;
> +};
> +
> +int main() {
> +  auto f0 = std::bind_front(F{});
> +  f0(); // { dg-error "deleted" }
> +  std::move(f0)();
> +  std::as_const(f0)();
> +  std::move(std::as_const(f0))();
> +
> +  auto g0 = std::bind_front(G{});
> +  g0(); // { dg-error "deleted" }
> +  std::move(g0)(); // { dg-error "deleted" }
> +  std::move(std::as_const(g0))();
> +
> +  auto f1 = std::bind_front(F{}, 42);
> +  f1(); // { dg-error "deleted" }
> +  std::move(f1)();
> +  std::as_const(f1)();
> +  std::move(std::as_const(f1))();
> +
> +  auto g1 = std::bind_front(G{}, 42);
> +  g1(); // { dg-error "deleted" }
> +  std::move(g1)(); // { dg-error "deleted" }
> +  std::move(std::as_const(g1))();
> +}
> --
> 2.42.0.158.g94e83dcf5b
>



Re: [PATCH 1/3] libstdc++: Remove std::bind_front specialization for no bound args

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Tue, 12 Sept 2023 at 13:46, Patrick Palka via Libstdc++
 wrote:
>
> On Mon, 11 Sep 2023, Patrick Palka wrote:
>
> > This specialization for the case of no bound args, added by
> > r13-4214-gcbd05ca5ab1231, seems to be mostly obsoleted by
> > r13-5033-ge2eab3c4edb6aa which added [[no_unique_address]] to the
> > main template's data members.  And the compile time advantage of
> > avoiding an empty tuple and index_sequence seems minimal.  Removing this
> > specialization also means we don't have to fix the PR111327 bug in
> > another place.
>
> FWIW I don't feel strongly about removing this specialization.  If we
> keep it We'd at least be able to reuse it for std::bind_back, and it
> wouldn't be hard to fix the PR111327 bug in its implementation.

Yeah, I'm ambivalent. But since you've got a patch to fix 111327 ready
which doesn't include this specialization, let's remove it.

The empty std::tuple is at least already explicitly specialized, so I
agree its overhead probably isn't very significant.

OK for trunk. I'm not sure if we should change it in gcc-13 now though.

>
> >
> >   PR libstdc++/111327
> >
> > libstdc++-v3/ChangeLog:
> >
> >   * include/std/functional (_Bind_front0): Remove.
> >   (_Bind_front_t): Adjust.
> > ---
> >  libstdc++-v3/include/std/functional | 63 +
> >  1 file changed, 1 insertion(+), 62 deletions(-)
> >
> > diff --git a/libstdc++-v3/include/std/functional 
> > b/libstdc++-v3/include/std/functional
> > index 60d4d1f3dd2..7d1b890bb4e 100644
> > --- a/libstdc++-v3/include/std/functional
> > +++ b/libstdc++-v3/include/std/functional
> > @@ -996,69 +996,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >[[no_unique_address]] std::tuple<_BoundArgs...> _M_bound_args;
> >  };
> >
> > -  // Avoid the overhead of an empty tuple<> if there are no bound args.
> > -  template
> > -struct _Bind_front0
> > -{
> > -  static_assert(is_move_constructible_v<_Fd>);
> > -
> > -  // First parameter is to ensure this constructor is never used
> > -  // instead of the copy/move constructor.
> > -  template
> > - explicit constexpr
> > - _Bind_front0(int, _Fn&& __fn)
> > - noexcept(is_nothrow_constructible_v<_Fd, _Fn>)
> > - : _M_fd(std::forward<_Fn>(__fn))
> > - { }
> > -
> > -  _Bind_front0(const _Bind_front0&) = default;
> > -  _Bind_front0(_Bind_front0&&) = default;
> > -  _Bind_front0& operator=(const _Bind_front0&) = default;
> > -  _Bind_front0& operator=(_Bind_front0&&) = default;
> > -  ~_Bind_front0() = default;
> > -
> > -  template
> > - constexpr
> > - invoke_result_t<_Fd&, _CallArgs...>
> > - operator()(_CallArgs&&... __call_args) &
> > - noexcept(is_nothrow_invocable_v<_Fd&, _CallArgs...>)
> > - { return std::invoke(_M_fd, std::forward<_CallArgs>(__call_args)...); 
> > }
> > -
> > -  template
> > - constexpr
> > - invoke_result_t
> > - operator()(_CallArgs&&... __call_args) const &
> > - noexcept(is_nothrow_invocable_v)
> > - { return std::invoke(_M_fd, std::forward<_CallArgs>(__call_args)...); 
> > }
> > -
> > -  template
> > - constexpr
> > - invoke_result_t<_Fd, _CallArgs...>
> > - operator()(_CallArgs&&... __call_args) &&
> > - noexcept(is_nothrow_invocable_v<_Fd, _CallArgs...>)
> > - {
> > -   return std::invoke(std::move(_M_fd),
> > -  std::forward<_CallArgs>(__call_args)...);
> > - }
> > -
> > -  template
> > - constexpr
> > - invoke_result_t
> > - operator()(_CallArgs&&... __call_args) const &&
> > - noexcept(is_nothrow_invocable_v)
> > - {
> > -   return std::invoke(std::move(_M_fd),
> > -  std::forward<_CallArgs>(__call_args)...);
> > - }
> > -
> > -private:
> > -  [[no_unique_address]] _Fd _M_fd;
> > -};
> > -
> >template
> > -using _Bind_front_t
> > -  = __conditional_t>,
> > - _Bind_front, decay_t<_Args>...>>;
> > +using _Bind_front_t = _Bind_front, decay_t<_Args>...>;
> >
> >/** Create call wrapper by partial application of arguments to function.
> > *
> > --
> > 2.42.0.158.g94e83dcf5b
> >
> >
>



Re: [PATCH 00/13] libstdc++: Add support for running tests with multiple -std options

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Sept 2023 at 17:37, Jonathan Wakely via Libstdc++
 wrote:
>
> This patch series replicates the behaviour of the g++ testsuite, so that
> libstdc++ tests can easily be run for multiple different -std options in
> a single testsuite run.  As described in the updated docs, the -std
> options to use for every test can be overridden by setting v3_std_list
> in ~/.dejagnurc or $DEJAGNU, or setting $GLIBCXX_TESTSUITE_STDS in the
> environment.  If not overridden, the default is just to run with
> -std=gnu++17 (so that we don't increase the time taken for a full
> testsuite run).
>
> Tests that require a newer standard than C++17 will default to that
> newer standard and C++26, so e.g. std::format tests will be run with
> both -std=gnu++20 and -std=gnu++26.  This does increase the number of
> tests, but only for the subset of tests for C++20/23/26 features.  If
> this is too costly for testers, we can change that (this might be
> needed, because the C++20 tests for std::ranges and std::format are
> particularly slow to compile).
>
> Because a correct default will be chosen for tests that require
> something newer than C++17, we no longer need dg-options "-std=gnu++20"
> or similar in any tests.  Removing the explicit -std option allows the
> test to be run for later standards via the v3_std_list settings, so that
> we can verify that C++20 features still work in C++23 and C++26, for
> example.  This change already found some tests which failed when run
> with a later standard (see r14-3771-gf12e26f3496275).
>
> Patches 2-13 in the series remove those unnecessary dg-options from
> about half the relevant tests, but there are more than 500 others that
> still need adjusting.
>
> We can remove files like testsuite/std/format/functions/format_c++23.cc
> which only exist to duplicate existing tests with a different -std
> option.  We can remove that file now, and rely on format.cc being run
> with multiple -std options by libstdc++ maintainers.
>
> It might also be useful to add a 'make check-quick' target which runs a
> small subset of smoke tests with every standard version in v3_std_list.
> This would be a suitable target for CI bots and for packagers who want
> to verify that a build of GCC is functional, without running the entire
> libstdc++ testsuite.

There's a problem with this change. Some of our tests fail if they're
run more than once.

We have some static data files which are copied into the test
directory by libstdc++_init at the start of the run. But some tests
modify those files, so if the same test gets run multiple times, the
file is no longer in the expected state after the first test.

This only shows up when overriding the list of -std modes to include
more than one option. The tests pass on the first run, and fail for
subsequent ones:

Running /home/test/src/gcc/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
...
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++98 (test for
excess errors)
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++98 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++11 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++11 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++14 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++14 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++17 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++17 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++20 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++20 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++23 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++23 execution test

We either need to copy the data files again after each test, or
rewrite the tests to be idempotent.



[committed] contrib: Quote variable in test expression [PR111360]

2023-09-12 Thread Jonathan Wakely via Gcc-patches
Committed as obvious.

-- >8 --

Without the quotes some shells will always return true and some will
print an error. It should be quoted so that a null variable works as
intended.

contrib/ChangeLog:

PR other/111360
* gcc_update: Quote variable.
---
 contrib/gcc_update | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/gcc_update b/contrib/gcc_update
index 1d7bfab4935..cda2bdb0df9 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -343,7 +343,7 @@ case $vcs_type in
revision=`$GCC_GIT log -n1 --pretty=tformat:%h`
r=`$GCC_GIT describe --all --match 'basepoints/gcc-[0-9]*' HEAD \
   | sed -n 
's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'`;
-   if test -n $r; then
+   if test -n "$r"; then
o=`$GCC_GIT config --get gcc-config.upstream`;
rr=`echo $r | sed -n 
's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'`;
if $GCC_GIT rev-parse --verify --quiet 
${o:-origin}/releases/gcc-$rr >/dev/null; then
-- 
2.41.0



[committed] libstdc++: Format Python code according to PEP8

2023-09-12 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

These files were filtered through autopep8 to reformat them more
conventionally.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py: Reformat.
* python/libstdcxx/v6/xmethods.py: Likewise.
---
 libstdc++-v3/python/libstdcxx/v6/printers.py | 651 +++
 libstdc++-v3/python/libstdcxx/v6/xmethods.py |  58 +-
 2 files changed, 446 insertions(+), 263 deletions(-)

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py 
b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 37a447b514b..c0056de2565 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -18,10 +18,12 @@
 import gdb
 import itertools
 import re
-import sys, os, errno
+import sys
+import os
+import errno
 import datetime
 
-### Python 2 + Python 3 compatibility code
+# Python 2 + Python 3 compatibility code
 
 # Resources about compatibility:
 #
@@ -38,7 +40,7 @@ import datetime
 # 
 
 if sys.version_info[0] > 2:
-### Python 3 stuff
+# Python 3 stuff
 Iterator = object
 # Python 3 folds these into the normal functions.
 imap = map
@@ -47,7 +49,7 @@ if sys.version_info[0] > 2:
 long = int
 _utc_timezone = datetime.timezone.utc
 else:
-### Python 2 stuff
+# Python 2 stuff
 class Iterator:
 """Compatibility mixin for iterators
 
@@ -98,6 +100,8 @@ except ImportError:
 # Starting with the type ORIG, search for the member type NAME.  This
 # handles searching upward through superclasses.  This is needed to
 # work around http://sourceware.org/bugzilla/show_bug.cgi?id=13615.
+
+
 def find_type(orig, name):
 typ = orig.strip_typedefs()
 while True:
@@ -116,8 +120,10 @@ def find_type(orig, name):
 else:
 raise ValueError("Cannot find type %s::%s" % (str(orig), name))
 
+
 _versioned_namespace = '__8::'
 
+
 def lookup_templ_spec(templ, *args):
 """
 Lookup template specialization templ
@@ -139,6 +145,8 @@ def lookup_templ_spec(templ, *args):
 
 # Use this to find container node types instead of find_type,
 # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91997 for details.
+
+
 def lookup_node_type(nodename, containertype):
 """
 Lookup specialization of template NODENAME corresponding to CONTAINERTYPE.
@@ -168,6 +176,7 @@ def lookup_node_type(nodename, containertype):
 pass
 return None
 
+
 def is_member_of_namespace(typ, *namespaces):
 """
 Test whether a type is a member of one of the specified namespaces.
@@ -181,6 +190,7 @@ def is_member_of_namespace(typ, *namespaces):
 return True
 return False
 
+
 def is_specialization_of(x, template_name):
 """
 Test whether a type is a specialization of the named class template.
@@ -195,12 +205,14 @@ def is_specialization_of(x, template_name):
 return re.match('^std::(%s)?%s<.*>$' % (_versioned_namespace, 
template_name), x) is not None
 return re.match('^std::%s<.*>$' % template_name, x) is not None
 
+
 def strip_versioned_namespace(typename):
 global _versioned_namespace
 if _versioned_namespace:
 return typename.replace(_versioned_namespace, '')
 return typename
 
+
 def strip_inline_namespaces(type_str):
 "Remove known inline namespaces from the canonical name of a type."
 type_str = strip_versioned_namespace(type_str)
@@ -212,6 +224,7 @@ def strip_inline_namespaces(type_str):
 type_str = type_str.replace(fs_ns+'v1::', fs_ns)
 return type_str
 
+
 def get_template_arg_list(type_obj):
 "Return a type's template arguments as a list"
 n = 0
@@ -223,6 +236,7 @@ def get_template_arg_list(type_obj):
 return template_args
 n += 1
 
+
 class SmartPtrIterator(Iterator):
 "An iterator for smart pointer types with a single 'child' value"
 
@@ -238,28 +252,29 @@ class SmartPtrIterator(Iterator):
 self.val, val = None, self.val
 return ('get()', val)
 
+
 class SharedPointerPrinter:
 "Print a shared_ptr, weak_ptr, atomic, or atomic"
 
-def __init__ (self, typename, val):
+def __init__(self, typename, val):
 self.typename = strip_versioned_namespace(typename)
 self.val = val
 self.pointer = val['_M_ptr']
 
-def children (self):
+def children(self):
 return SmartPtrIterator(self.pointer)
 
 # Return the _Sp_counted_base<>* that holds the refcounts.
-def _get_refcounts (self):
+def _get_refcounts(self):
 if self.typename == 'std::atomic':
 # A tagged pointer is stored as uintptr_t.
 ptr_val = self.val['_M_refcount']['_M_val']['_M_i']
-ptr_val = ptr_val - (ptr_val % 2) # clear lock bit
+ptr_val = ptr_val - (ptr_val % 2)  # clear lock bit
 ptr_type = find_type(self.val['_M_refcount'].type, 'pointer')
 return ptr_val.cast(ptr_type)
 

Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Tue, 12 Sept 2023 at 08:59, Christophe Lyon
 wrote:
>
>
>
> On Mon, 11 Sept 2023 at 18:11, Jonathan Wakely  wrote:
>>
>> On Mon, 11 Sept 2023 at 16:40, Christophe Lyon
>>  wrote:
>> >
>> >
>> >
>> > On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely  wrote:
>> >>
>> >> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
>> >>  wrote:
>> >> >
>> >> >
>> >> >
>> >> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely  
>> >> > wrote:
>> >> >>
>> >> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>> >> >>  wrote:
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely  
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> >> >> >>  wrote:
>> >> >> >> >
>> >> >> >> > Some targets like arm-eabi with newlib and default settings rely 
>> >> >> >> > on
>> >> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> >> >> >> > implement it by default, to make users aware they have to take 
>> >> >> >> > special
>> >> >> >> > care.
>> >> >> >> >
>> >> >> >> > This makes a few tests fail to link.
>> >> >> >>
>> >> >> >> Does this mean those features are unusable on the target, or just 
>> >> >> >> that
>> >> >> >> users need to provide their own __sync_synchronize to use them?
>> >> >> >
>> >> >> >
>> >> >> > IIUC the user is expected to provide them.
>> >> >> > Looks like we discussed this in the past :-)
>> >> >> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>> >> >> > see the pointer to Ramana's comment: 
>> >> >> > https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>> >> >>
>> >> >> Oh yes, thanks for the reminder!
>> >> >>
>> >> >> >
>> >> >> > The default arch for arm-eabi is armv4t which is very old.
>> >> >> > When running the testsuite with something more recent (either as 
>> >> >> > default by configuring GCC --with-arch=XXX or by forcing 
>> >> >> > -march/-mcpu via dejagnu's target-board), the compiler generates 
>> >> >> > barrier instructions and there are no such errors.
>> >> >>
>> >> >> Ah yes, that's fine then.
>> >> >>
>> >> >> > For instance, here is a log with the defaults:
>> >> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>> >> >> > and a log when we target cortex-m0 which is still a very small cpu 
>> >> >> > but has barriers:
>> >> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>> >> >> >
>> >> >> > I somehow wanted to get rid of such errors with the default 
>> >> >> > configuration
>> >> >>
>> >> >> Yep, that makes sense, and we'll still be testing them for newer
>> >> >> arches on the target, so it's not completely disabling those parts of
>> >> >> the testsuite.
>> >> >>
>> >> >> But I'm still curious why some of those tests need this change. I
>> >> >> think the ones I noted below are probably failing for some other
>> >> >> reasons.
>> >> >>
>> >> > Just looked at  23_containers/span/back_assert_neg.cc, the linker says 
>> >> > it needs
>> >> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
>> >> > ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char 
>> >> > const*, int, char const*, char const*))
>> >> > and indeed debug.o has a reference to __sync_synchronize
>> >>
>> >> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
>> >> there are no dependencies on anything else in that file, including the
>> >> _M_detach member function that uses atomics.
>> >
>> > indeed
>> >
>> >
>> >>
>> >> This would also be solved by -Wl,--gc-sections :-)
>> >
>> > :-)
>> >
>> >>
>> >> I think it would be better to move __glibcxx_assert_fail to a new
>> >> file, so that it doesn't make every assertion unnecessarily depend on
>> >> __sync_synchronize. I'll do that now.
>> >
>> > Sounds like a good idea, thanks.
>>
>> Done now at r14-3846-g4a2766ed00a479
>> >
>> >>
>> >> We could also make the atomics in debug.o conditional, so that debug
>> >> mode doesn't depend on __sync_synchronize for single-threaded targets.
>> >> Does the arm4t arch have pthreads support in newlib?  I didn't bother
>> >
>> > No ( grep _GLIBCXX_HAS_GTHREADS 
>> > $objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
>> > /* #undef _GLIBCXX_HAS_GTHREADS */
>> >
>> >> making the use of atomics conditional, because performance is not
>> >> really a priority for debug mode bookkeeping. But the problem here
>> >> isn't just a slight performance overhead of atomics, it's that they
>> >> aren't even supported for arm4t.
>> >
>> > OK thanks.
>> >
>> > So finally, this uncovered at least a "bug" that  __glibcxx_assert_fail 
>> > should be in a dedicated object file :-)
>> >
>> > I'll revisit my patch once you have moved __glibcxx_assert_fail
>>
>> That's done (at r14-3845-gc7db9000fa7cac) 

Re: [PATCH 2/2] libstdc++: Optimize is_scoped_enum trait performance

2023-09-12 Thread Jonathan Wakely via Gcc-patches
On Tue, 12 Sept 2023, 01:21 Ken Matsui via Libstdc++, 
wrote:

> This patch optimizes the performance of the is_scoped_enum trait
> by dispatching to the new __is_scoped_enum built-in trait.
>

OK for trunk (after the built-in is in the front end), thanks.



> libstdc++-v3/ChangeLog:
>
> * include/std/type_traits (is_scoped_enum): Use
> __is_scoped_enum built-in trait.
> (is_scoped_enum_v): Likewise.
>
> Signed-off-by: Ken Matsui 
> ---
>  libstdc++-v3/include/std/type_traits | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/libstdc++-v3/include/std/type_traits
> b/libstdc++-v3/include/std/type_traits
> index 677cd934b94..26ae491fa69 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -3585,6 +3585,12 @@ template _Args>
>/// True if the type is a scoped enumeration type.
>/// @since C++23
>
> +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
> +  template
> +struct is_scoped_enum
> +: bool_constant<__is_scoped_enum(_Tp)>
> +{ };
> +# else
>template
>  struct is_scoped_enum
>  : false_type
> @@ -3596,11 +3602,17 @@ template _Args>
>  struct is_scoped_enum<_Tp>
>  : bool_constant
>  { };
> +# endif
>
>/// @ingroup variable_templates
>/// @since C++23
> +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum)
> +  template
> +inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp);
> +# else
>template
>  inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
> +# endif
>  #endif
>
>  #ifdef __cpp_lib_reference_from_temporary // C++ >= 23 &&
> ref_{converts,constructs}_from_temp
> --
> 2.42.0
>
>


[PATCH 11/13] libstdc++: Remove dg-options "-std=gnu++23" from remaining tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++23 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++26
as well.

libstdc++-v3/ChangeLog:

* testsuite/18_support/headers/limits/synopsis_cxx23.cc: Remove
dg-options.
* testsuite/18_support/headers/stdfloat/types_std.cc: Likewise.
* testsuite/18_support/type_info/constexpr.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/current.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/synopsis.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/version.cc: Likewise.
* testsuite/20_util/aligned_storage/deprecated-2b.cc: Likewise.
* testsuite/20_util/aligned_union/deprecated-2b.cc: Likewise.
* testsuite/20_util/bitset/access/constexpr.cc: Likewise.
* testsuite/20_util/bitset/cons/constexpr_c++23.cc: Likewise.
* testsuite/20_util/bitset/count/constexpr.cc: Likewise.
* testsuite/20_util/bitset/ext/constexpr.cc: Likewise.
* testsuite/20_util/bitset/operations/constexpr_c++23.cc:
Likewise.
* testsuite/20_util/bitset/version.cc: Likewise.
* testsuite/20_util/from_chars/8.cc: Likewise.
* testsuite/20_util/from_chars/constexpr.cc: Likewise.
* testsuite/20_util/function/cons/deduction_c++23.cc: Likewise.
* testsuite/20_util/function_objects/invoke/4.cc: Likewise.
* testsuite/20_util/function_objects/invoke/dangling_ref.cc:
Likewise.
* testsuite/20_util/is_scoped_enum/value.cc: Likewise.
* testsuite/20_util/is_scoped_enum/version.cc: Likewise.
* testsuite/20_util/move_only_function/call.cc: Likewise.
* testsuite/20_util/move_only_function/cons.cc: Likewise.
* testsuite/20_util/move_only_function/move.cc: Likewise.
* testsuite/20_util/move_only_function/version.cc: Likewise.
* testsuite/20_util/optional/monadic/and_then.cc: Likewise.
* testsuite/20_util/optional/monadic/or_else.cc: Likewise.
* testsuite/20_util/optional/monadic/or_else_neg.cc: Likewise.
* testsuite/20_util/optional/monadic/pr109242.cc: Likewise.
* testsuite/20_util/optional/monadic/transform.cc: Likewise.
* testsuite/20_util/pair/p2321r2.cc: Likewise.
* testsuite/20_util/reference_from_temporary/value.cc: Likewise.
* testsuite/20_util/reference_from_temporary/value2.cc:
Likewise.
* testsuite/20_util/reference_from_temporary/version.cc:
Likewise.
* testsuite/20_util/to_chars/constexpr.cc: Likewise.
* testsuite/20_util/to_chars/float128_c++23.cc: Likewise.
* testsuite/20_util/to_chars/float16_c++23.cc: Likewise.
* testsuite/20_util/to_chars/version.cc: Likewise.
* testsuite/20_util/to_underlying/1.cc: Likewise.
* testsuite/20_util/to_underlying/version.cc: Likewise.
* testsuite/20_util/tuple/p2321r2.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/constexpr.cc: Likewise.
* testsuite/20_util/unique_ptr/comparison/constexpr.cc:
Likewise.
* testsuite/20_util/unique_ptr/cons/constexpr_c++20.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/constexpr.cc: Likewise.
* testsuite/20_util/unique_ptr/modifiers/constexpr.cc: Likewise.
* testsuite/20_util/unique_ptr/specialized_algorithms/constexpr.cc: 
Likewise.
* testsuite/20_util/unreachable/1.cc: Likewise.
* testsuite/20_util/unreachable/version.cc: Likewise.
* testsuite/20_util/uses_allocator/lwg3677.cc: Likewise.
* 
testsuite/21_strings/basic_string/capacity/char/resize_and_overwrite.cc: 
Likewise.
* testsuite/21_strings/basic_string/operations/contains/char.cc:
Likewise.
* testsuite/21_strings/basic_string/operations/contains/nonnull.cc: 
Likewise.
* testsuite/21_strings/basic_string/operations/contains/wchar_t.cc: 
Likewise.
* testsuite/21_strings/basic_string_view/cons/char/range_c++20.cc: 
Likewise.
* testsuite/21_strings/basic_string_view/cons/wchar_t/range_c++20.cc: 
Likewise.
* testsuite/21_strings/basic_string_view/operations/contains/char.cc: 
Likewise.
* testsuite/21_strings/basic_string_view/operations/contains/char/2.cc: 
Likewise.
* 
testsuite/21_strings/basic_string_view/operations/contains/nonnull.cc: Likewise.
* 
testsuite/21_strings/basic_string_view/operations/contains/wchar_t.cc: Likewise.
* testsuite/23_containers/queue/cons_from_iters.cc: Likewise.
* testsuite/23_containers/stack/cons_from_iters.cc: Likewise.
* testsuite/23_containers/vector/bool/element_access/1.cc:
Likewise.
* testsuite/24_iterators/const_iterator/1.cc: Likewise.
* testsuite/25_algorithms/contains/1.cc: Likewise.

[PATCH 10/13] libstdc++: Remove dg-options "-std=gnu++23" from std::expected tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++23 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++26
as well.

libstdc++-v3/ChangeLog:

* testsuite/20_util/expected/assign.cc: Remove dg-options.
* testsuite/20_util/expected/bad.cc: Likewise.
* testsuite/20_util/expected/cons.cc: Likewise.
* testsuite/20_util/expected/equality.cc: Likewise.
* testsuite/20_util/expected/illformed_neg.cc: Likewise.
* testsuite/20_util/expected/lwg3877.cc: Likewise.
* testsuite/20_util/expected/lwg3938.cc: Likewise.
* testsuite/20_util/expected/monadic.cc: Likewise.
* testsuite/20_util/expected/observers.cc: Likewise.
* testsuite/20_util/expected/requirements.cc: Likewise.
* testsuite/20_util/expected/swap.cc: Likewise.
* testsuite/20_util/expected/synopsis.cc: Likewise.
* testsuite/20_util/expected/unexpected.cc: Likewise.
* testsuite/20_util/expected/version.cc: Likewise.
---
 libstdc++-v3/testsuite/20_util/expected/assign.cc| 1 -
 libstdc++-v3/testsuite/20_util/expected/bad.cc   | 1 -
 libstdc++-v3/testsuite/20_util/expected/cons.cc  | 1 -
 libstdc++-v3/testsuite/20_util/expected/equality.cc  | 1 -
 libstdc++-v3/testsuite/20_util/expected/illformed_neg.cc | 1 -
 libstdc++-v3/testsuite/20_util/expected/lwg3877.cc   | 1 -
 libstdc++-v3/testsuite/20_util/expected/lwg3938.cc   | 1 -
 libstdc++-v3/testsuite/20_util/expected/monadic.cc   | 1 -
 libstdc++-v3/testsuite/20_util/expected/observers.cc | 1 -
 libstdc++-v3/testsuite/20_util/expected/requirements.cc  | 1 -
 libstdc++-v3/testsuite/20_util/expected/swap.cc  | 1 -
 libstdc++-v3/testsuite/20_util/expected/synopsis.cc  | 1 -
 libstdc++-v3/testsuite/20_util/expected/unexpected.cc| 1 -
 libstdc++-v3/testsuite/20_util/expected/version.cc   | 1 -
 14 files changed, 14 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/expected/assign.cc 
b/libstdc++-v3/testsuite/20_util/expected/assign.cc
index bbf5b900f4c..73f5cbcbfcd 100644
--- a/libstdc++-v3/testsuite/20_util/expected/assign.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/assign.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do run { target c++23 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/expected/bad.cc 
b/libstdc++-v3/testsuite/20_util/expected/bad.cc
index e5d7ba4afb0..c629e149da5 100644
--- a/libstdc++-v3/testsuite/20_util/expected/bad.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/bad.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do compile { target c++23 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/expected/cons.cc 
b/libstdc++-v3/testsuite/20_util/expected/cons.cc
index 6946858198c..683174e98df 100644
--- a/libstdc++-v3/testsuite/20_util/expected/cons.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/cons.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do run { target c++23 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/expected/equality.cc 
b/libstdc++-v3/testsuite/20_util/expected/equality.cc
index 1862719e73d..db19b1510a7 100644
--- a/libstdc++-v3/testsuite/20_util/expected/equality.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/equality.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do compile { target c++23 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/expected/illformed_neg.cc 
b/libstdc++-v3/testsuite/20_util/expected/illformed_neg.cc
index f1b0771aeb9..69c13b48a22 100644
--- a/libstdc++-v3/testsuite/20_util/expected/illformed_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/illformed_neg.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do compile { target c++23 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/expected/lwg3877.cc 
b/libstdc++-v3/testsuite/20_util/expected/lwg3877.cc
index 876275bfdb0..1854f5102c6 100644
--- a/libstdc++-v3/testsuite/20_util/expected/lwg3877.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/lwg3877.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do compile { target c++23 } }
 
 // LWG 3877. Incorrect constraints on const-qualified monadic overloads
diff --git a/libstdc++-v3/testsuite/20_util/expected/lwg3938.cc 
b/libstdc++-v3/testsuite/20_util/expected/lwg3938.cc
index c7e3758a902..3aa2b9d9273 100644
--- a/libstdc++-v3/testsuite/20_util/expected/lwg3938.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/lwg3938.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do compile { target c++23 } }
 
 // LWG 3938. Cannot use std::expected monadic ops with move-only error_type
diff --git a/libstdc++-v3/testsuite/20_util/expected/monadic.cc 
b/libstdc++-v3/testsuite/20_util/expected/monadic.cc
index d82774b0e1f..40f4907ea88 100644
--- a/libstdc++-v3/testsuite/20_util/expected/monadic.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/monadic.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // 

[PATCH 08/13] libstdc++: Remove dg-options "-std=gnu++20" from std::format tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/std/format/arguments/args.cc: Remove dg-options.
* testsuite/std/format/arguments/lwg3810.cc: Likewise. Likewise.
* testsuite/std/format/error.cc: Likewise.
* testsuite/std/format/format_string.cc: Likewise.
* testsuite/std/format/formatter/concept.cc: Likewise.
* testsuite/std/format/formatter/ext_float.cc: Likewise.
* testsuite/std/format/formatter/requirements.cc: Likewise.
* testsuite/std/format/functions/107871.cc: Likewise.
* testsuite/std/format/functions/format.cc: Likewise.
* testsuite/std/format/functions/format_to.cc: Likewise.
* testsuite/std/format/functions/format_to_n.cc: Likewise.
* testsuite/std/format/functions/size.cc: Likewise.
* testsuite/std/format/functions/vformat_to.cc: Likewise.
* testsuite/std/format/parse_ctx.cc: Likewise.
* testsuite/std/format/string.cc: Likewise.
* testsuite/std/format/string_neg.cc: Likewise.
* testsuite/std/format/functions/format_c++23.cc: Removed.
---
 libstdc++-v3/testsuite/std/format/arguments/args.cc | 1 -
 libstdc++-v3/testsuite/std/format/arguments/lwg3810.cc  | 1 -
 libstdc++-v3/testsuite/std/format/error.cc  | 1 -
 libstdc++-v3/testsuite/std/format/format_string.cc  | 1 -
 libstdc++-v3/testsuite/std/format/formatter/concept.cc  | 1 -
 libstdc++-v3/testsuite/std/format/formatter/ext_float.cc| 1 -
 libstdc++-v3/testsuite/std/format/formatter/requirements.cc | 1 -
 libstdc++-v3/testsuite/std/format/functions/107871.cc   | 1 -
 libstdc++-v3/testsuite/std/format/functions/format.cc   | 1 -
 libstdc++-v3/testsuite/std/format/functions/format_c++23.cc | 5 -
 libstdc++-v3/testsuite/std/format/functions/format_to.cc| 1 -
 libstdc++-v3/testsuite/std/format/functions/format_to_n.cc  | 1 -
 libstdc++-v3/testsuite/std/format/functions/size.cc | 1 -
 libstdc++-v3/testsuite/std/format/functions/vformat_to.cc   | 1 -
 libstdc++-v3/testsuite/std/format/parse_ctx.cc  | 1 -
 libstdc++-v3/testsuite/std/format/string.cc | 1 -
 libstdc++-v3/testsuite/std/format/string_neg.cc | 1 -
 17 files changed, 21 deletions(-)
 delete mode 100644 libstdc++-v3/testsuite/std/format/functions/format_c++23.cc

diff --git a/libstdc++-v3/testsuite/std/format/arguments/args.cc 
b/libstdc++-v3/testsuite/std/format/arguments/args.cc
index ae2eab6d560..a45f3fb24df 100644
--- a/libstdc++-v3/testsuite/std/format/arguments/args.cc
+++ b/libstdc++-v3/testsuite/std/format/arguments/args.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/std/format/arguments/lwg3810.cc 
b/libstdc++-v3/testsuite/std/format/arguments/lwg3810.cc
index 9ccb654de1b..f89f40203cb 100644
--- a/libstdc++-v3/testsuite/std/format/arguments/lwg3810.cc
+++ b/libstdc++-v3/testsuite/std/format/arguments/lwg3810.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do compile { target c++20 } }
 
 // LWG 3810. CTAD for std::basic_format_args
diff --git a/libstdc++-v3/testsuite/std/format/error.cc 
b/libstdc++-v3/testsuite/std/format/error.cc
index a6918f5ab2e..878f60e0ec9 100644
--- a/libstdc++-v3/testsuite/std/format/error.cc
+++ b/libstdc++-v3/testsuite/std/format/error.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/std/format/format_string.cc 
b/libstdc++-v3/testsuite/std/format/format_string.cc
index 1dd6ca8f125..71c3d5d68f6 100644
--- a/libstdc++-v3/testsuite/std/format/format_string.cc
+++ b/libstdc++-v3/testsuite/std/format/format_string.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do compile { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/std/format/formatter/concept.cc 
b/libstdc++-v3/testsuite/std/format/formatter/concept.cc
index fe56dc44a68..e28a8c20a87 100644
--- a/libstdc++-v3/testsuite/std/format/formatter/concept.cc
+++ b/libstdc++-v3/testsuite/std/format/formatter/concept.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++23" }
 // { dg-do compile { target c++23 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/std/format/formatter/ext_float.cc 
b/libstdc++-v3/testsuite/std/format/formatter/ext_float.cc
index 89810295b64..82e696fa797 100644
--- a/libstdc++-v3/testsuite/std/format/formatter/ext_float.cc
+++ b/libstdc++-v3/testsuite/std/format/formatter/ext_float.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/std/format/formatter/requirements.cc 
b/libstdc++-v3/testsuite/std/format/formatter/requirements.cc
index 7d95f7fafe9..bde67e586ef 100644
--- 

[PATCH 05/13] libstdc++: Remove dg-options "-std=c++20" from and tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

There doesn't seem to be any reason they need to use strict -std=c++20
mode, so don't add the { dg-add-options strict_std } directive, just let
them use strict or non-strict modes.

libstdc++-v3/ChangeLog:

* testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc:
Remove dg-options.
* testsuite/23_containers/span/contiguous_range_neg.cc:
Likewise.
* testsuite/23_containers/span/everything.cc: Likewise.
---
 .../testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc | 1 -
 .../testsuite/23_containers/span/contiguous_range_neg.cc   | 3 +--
 libstdc++-v3/testsuite/23_containers/span/everything.cc| 3 +--
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/libstdc++-v3/testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc 
b/libstdc++-v3/testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc
index df68fb7c82f..1964803cbd1 100644
--- a/libstdc++-v3/testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc
+++ b/libstdc++-v3/testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=c++20" }
 // { dg-do compile { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/23_containers/span/contiguous_range_neg.cc 
b/libstdc++-v3/testsuite/23_containers/span/contiguous_range_neg.cc
index d5f64922052..2ed44740a86 100644
--- a/libstdc++-v3/testsuite/23_containers/span/contiguous_range_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/contiguous_range_neg.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/23_containers/span/everything.cc 
b/libstdc++-v3/testsuite/23_containers/span/everything.cc
index 74f943e937f..31c17346dd3 100644
--- a/libstdc++-v3/testsuite/23_containers/span/everything.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/everything.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++2a" }
-// { dg-do run { target c++2a } }
+// { dg-do run { target c++20 } }
 
 #include 
 
-- 
2.41.0



[PATCH 12/13] libstdc++: Remove dg-options "-std=gnu++2a" from XFAIL std::span tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

We can also combine the { dg-require-effective-target c++2a } directive
with the dg-do selector.

We need to add the no_pch options for tests that define
_GLIBCXX_ASSERTIONS in the test, otherwise the PCH is included without
that defined.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/span/back_assert_neg.cc: Remove
dg-options and add effective target selector to dg-do. Add
no_pch.
* testsuite/23_containers/span/back_neg.cc: Likewise.
* testsuite/23_containers/span/cons_1_assert_neg.cc: Likewise.
* testsuite/23_containers/span/cons_2_assert_neg.cc: Likewise.
* testsuite/23_containers/span/first_2_assert_neg.cc: Likewise.
* testsuite/23_containers/span/first_assert_neg.cc: Likewise.
* testsuite/23_containers/span/first_neg.cc: Likewise.
* testsuite/23_containers/span/front_assert_neg.cc: Likewise.
* testsuite/23_containers/span/front_neg.cc: Likewise.
* testsuite/23_containers/span/index_op_assert_neg.cc: Likewise.
* testsuite/23_containers/span/index_op_neg.cc: Likewise.
* testsuite/23_containers/span/last_2_assert_neg.cc: Likewise.
* testsuite/23_containers/span/last_assert_neg.cc: Likewise.
* testsuite/23_containers/span/last_neg.cc: Likewise.
* testsuite/23_containers/span/subspan_2_assert_neg.cc:
Likewise.
* testsuite/23_containers/span/subspan_3_assert_neg.cc:
Likewise.
* testsuite/23_containers/span/subspan_4_assert_neg.cc:
Likewise.
* testsuite/23_containers/span/subspan_5_assert_neg.cc:
Likewise.
* testsuite/23_containers/span/subspan_6_assert_neg.cc:
Likewise.
* testsuite/23_containers/span/subspan_assert_neg.cc: Likewise.
* testsuite/23_containers/span/subspan_neg.cc: Likewise.
* testsuite/24_iterators/range_operations/advance_debug_neg.cc:
Likewise.
---
 libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc | 5 ++---
 libstdc++-v3/testsuite/23_containers/span/back_neg.cc| 3 +--
 .../testsuite/23_containers/span/cons_1_assert_neg.cc| 5 ++---
 .../testsuite/23_containers/span/cons_2_assert_neg.cc| 5 ++---
 .../testsuite/23_containers/span/first_2_assert_neg.cc   | 5 ++---
 .../testsuite/23_containers/span/first_assert_neg.cc | 5 ++---
 libstdc++-v3/testsuite/23_containers/span/first_neg.cc   | 3 +--
 .../testsuite/23_containers/span/front_assert_neg.cc | 5 ++---
 libstdc++-v3/testsuite/23_containers/span/front_neg.cc   | 3 +--
 .../testsuite/23_containers/span/index_op_assert_neg.cc  | 5 ++---
 libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc| 3 +--
 .../testsuite/23_containers/span/last_2_assert_neg.cc| 5 ++---
 libstdc++-v3/testsuite/23_containers/span/last_assert_neg.cc | 5 ++---
 libstdc++-v3/testsuite/23_containers/span/last_neg.cc| 3 +--
 .../testsuite/23_containers/span/subspan_2_assert_neg.cc | 5 ++---
 .../testsuite/23_containers/span/subspan_3_assert_neg.cc | 5 ++---
 .../testsuite/23_containers/span/subspan_4_assert_neg.cc | 5 ++---
 .../testsuite/23_containers/span/subspan_5_assert_neg.cc | 5 ++---
 .../testsuite/23_containers/span/subspan_6_assert_neg.cc | 5 ++---
 .../testsuite/23_containers/span/subspan_assert_neg.cc   | 5 ++---
 libstdc++-v3/testsuite/23_containers/span/subspan_neg.cc | 3 +--
 .../24_iterators/range_operations/advance_debug_neg.cc   | 5 ++---
 22 files changed, 38 insertions(+), 60 deletions(-)

diff --git a/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc 
b/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc
index 2b4dee6df9a..b42aea3b4b4 100644
--- a/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/back_assert_neg.cc
@@ -15,9 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a" }
-// { dg-do run { xfail *-*-* } }
-// { dg-require-effective-target c++2a }
+// { dg-do run { target c++20 xfail *-*-* } }
+// { dg-add-options no_pch }
 
 #undef _GLIBCXX_ASSERTIONS
 #define _GLIBCXX_ASSERTIONS
diff --git a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc 
b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc
index 01083e60168..d3ea4f405f4 100644
--- a/libstdc++-v3/testsuite/23_containers/span/back_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/span/back_neg.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=gnu++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/23_containers/span/cons_1_assert_neg.cc 

[PATCH 09/13] libstdc++: Remove dg-options "-std=gnu++20" from std::chrono tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/20_util/duration/arithmetic/overflow_c++20.cc:
Remove dg-options.
* testsuite/20_util/duration/io.cc: Likewise.
* testsuite/std/time/clock/file/io.cc: Likewise.
* testsuite/std/time/clock/file/members.cc: Likewise.
* testsuite/std/time/clock/file/overview.cc: Likewise.
* testsuite/std/time/clock/gps/1.cc: Likewise.
* testsuite/std/time/clock/gps/io.cc: Likewise.
* testsuite/std/time/clock/local/io.cc: Likewise.
* testsuite/std/time/clock/system/io.cc: Likewise.
* testsuite/std/time/clock/tai/1.cc: Likewise.
* testsuite/std/time/clock/tai/io.cc: Likewise.
* testsuite/std/time/clock/utc/1.cc: Likewise.
* testsuite/std/time/clock/utc/io.cc: Likewise.
* testsuite/std/time/clock/utc/leap_second_info.cc: Likewise.
* testsuite/std/time/day/1.cc: Likewise.
* testsuite/std/time/day/io.cc: Likewise.
* testsuite/std/time/exceptions.cc: Likewise.
* testsuite/std/time/format.cc: Likewise.
* testsuite/std/time/hh_mm_ss/1.cc: Likewise.
* testsuite/std/time/hh_mm_ss/109772.cc: Likewise.
* testsuite/std/time/hh_mm_ss/io.cc: Likewise.
* testsuite/std/time/is_am/1.cc: Likewise.
* testsuite/std/time/is_pm/1.cc: Likewise.
* testsuite/std/time/make12/1.cc: Likewise.
* testsuite/std/time/make24/1.cc: Likewise.
* testsuite/std/time/month/1.cc: Likewise.
* testsuite/std/time/month/io.cc: Likewise.
* testsuite/std/time/month_day/1.cc: Likewise.
* testsuite/std/time/month_day/io.cc: Likewise.
* testsuite/std/time/month_day_last/1.cc: Likewise.
* testsuite/std/time/month_day_last/io.cc: Likewise.
* testsuite/std/time/month_weekday/1.cc: Likewise.
* testsuite/std/time/month_weekday/io.cc: Likewise.
* testsuite/std/time/month_weekday_last/1.cc: Likewise.
* testsuite/std/time/month_weekday_last/io.cc: Likewise.
* testsuite/std/time/parse.cc: Likewise.
* testsuite/std/time/syn_c++20.cc: Likewise.
* testsuite/std/time/time_zone/get_info_local.cc: Likewise.
* testsuite/std/time/time_zone/get_info_sys.cc: Likewise.
* testsuite/std/time/time_zone/requirements.cc: Likewise.
* testsuite/std/time/traits/is_clock.cc: Likewise.
* testsuite/std/time/tzdb/1.cc: Likewise.
* testsuite/std/time/tzdb/leap_seconds.cc: Likewise.
* testsuite/std/time/tzdb_list/1.cc: Likewise.
* testsuite/std/time/tzdb_list/requirements.cc: Likewise.
* testsuite/std/time/weekday/1.cc: Likewise.
* testsuite/std/time/weekday/io.cc: Likewise.
* testsuite/std/time/weekday_indexed/io.cc: Likewise.
* testsuite/std/time/weekday_last/1.cc: Likewise.
* testsuite/std/time/weekday_last/io.cc: Likewise.
* testsuite/std/time/year/1.cc: Likewise.
* testsuite/std/time/year/2.cc: Likewise.
* testsuite/std/time/year/io.cc: Likewise.
* testsuite/std/time/weekday_indexed/1.cc: Likewise.
* testsuite/std/time/year_month/1.cc: Likewise.
* testsuite/std/time/year_month/2.cc: Likewise.
* testsuite/std/time/year_month/io.cc: Likewise.
* testsuite/std/time/year_month_day/1.cc: Likewise.
* testsuite/std/time/year_month_day/2.cc: Likewise.
* testsuite/std/time/year_month_day/3.cc: Likewise.
* testsuite/std/time/year_month_day/4.cc: Likewise.
* testsuite/std/time/year_month_day/io.cc: Likewise.
* testsuite/std/time/year_month_day_last/1.cc: Likewise.
* testsuite/std/time/year_month_day_last/2.cc: Likewise.
* testsuite/std/time/year_month_day_last/io.cc: Likewise.
* testsuite/std/time/year_month_weekday/1.cc: Likewise.
* testsuite/std/time/year_month_weekday/2.cc: Likewise.
* testsuite/std/time/year_month_weekday/3.cc: Likewise.
* testsuite/std/time/year_month_weekday/io.cc: Likewise.
* testsuite/std/time/year_month_weekday_last/1.cc: Likewise.
* testsuite/std/time/year_month_weekday_last/2.cc: Likewise.
* testsuite/std/time/year_month_weekday_last/io.cc: Likewise.
* testsuite/std/time/zoned_time/1.cc: Likewise.
* testsuite/std/time/zoned_time/custom.cc: Likewise.
* testsuite/std/time/zoned_time/deduction.cc: Likewise.
* testsuite/std/time/zoned_time/io.cc: Likewise.
* testsuite/std/time/zoned_time/req_neg.cc: Likewise.
* testsuite/std/time/zoned_time/requirements.cc: Likewise.
* testsuite/std/time/zoned_traits.cc: Likewise.
---
 .../testsuite/20_util/duration/arithmetic/overflow_c++20.cc| 1 -
 libstdc++-v3/testsuite/20_util/duration/io.cc  | 1 -
 

[PATCH 02/13] libstdc++: Replace dg-options "-std=c++11" with dg-add-options strict_std

2023-09-11 Thread Jonathan Wakely via Gcc-patches
These tests can (and should) also be run for later standards, so replace
the { dg-options "-std=c++11" } with { dg-add-options strict_std } and a
target selector for c++11.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/deque/48101-2_neg.cc: Replace
dg-options with target selector.
* testsuite/23_containers/forward_list/48101-2_neg.cc: Likewise.
* testsuite/23_containers/list/48101-2_neg.cc: Likewise.
* testsuite/23_containers/map/48101-2_neg.cc: Likewise.
* testsuite/23_containers/map/48101_neg.cc: Likewise.
* testsuite/23_containers/multimap/48101-2_neg.cc: Likewise.
* testsuite/23_containers/multimap/48101_neg.cc: Likewise.
* testsuite/23_containers/multiset/48101-2_neg.cc: Likewise.
* testsuite/23_containers/set/48101-2_neg.cc: Likewise.
* testsuite/23_containers/unordered_map/48101-2_neg.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/48101-2_neg.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/48101-2_neg.cc:
Likewise.
* testsuite/23_containers/unordered_set/48101-2_neg.cc:
Likewise.
* testsuite/23_containers/vector/48101-2_neg.cc: Likewise.
---
 libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc | 4 ++--
 .../testsuite/23_containers/forward_list/48101-2_neg.cc   | 4 ++--
 libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc  | 4 ++--
 libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc   | 4 ++--
 libstdc++-v3/testsuite/23_containers/map/48101_neg.cc | 3 +--
 libstdc++-v3/testsuite/23_containers/multimap/48101-2_neg.cc  | 4 ++--
 libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc| 3 +--
 libstdc++-v3/testsuite/23_containers/multiset/48101-2_neg.cc  | 4 ++--
 libstdc++-v3/testsuite/23_containers/set/48101-2_neg.cc   | 4 ++--
 .../testsuite/23_containers/unordered_map/48101-2_neg.cc  | 4 ++--
 .../testsuite/23_containers/unordered_multimap/48101-2_neg.cc | 4 ++--
 .../testsuite/23_containers/unordered_multiset/48101-2_neg.cc | 4 ++--
 .../testsuite/23_containers/unordered_set/48101-2_neg.cc  | 4 ++--
 libstdc++-v3/testsuite/23_containers/vector/48101-2_neg.cc| 4 ++--
 14 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc 
b/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc
index 041f0cb88b3..d5cb13ec4db 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/48101-2_neg.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-do compile }
-// { dg-options "-std=c++11" }
+// { dg-do compile { target c++11 } }
+// { dg-add-options strict_std }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc 
b/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc
index 2a21876c1cf..d5cc81c6b48 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/48101-2_neg.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-do compile }
-// { dg-options "-std=c++11" }
+// { dg-do compile { target c++11 } }
+// { dg-add-options strict_std }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc 
b/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc
index 0e96022cdfe..5cea21992d9 100644
--- a/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/48101-2_neg.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-do compile }
-// { dg-options "-std=c++11" }
+// { dg-do compile { target c++11 } }
+// { dg-add-options strict_std }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc 
b/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc
index 06c4dc9e9ef..8cda993e2cb 100644
--- a/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/48101-2_neg.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-do compile }
-// { dg-options "-std=c++11" }
+// { dg-do compile { target c++11 } }
+// { dg-add-options strict_std }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc 
b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
index e9029caad21..81837954125 100644
--- a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
@@ -15,8 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-do compile }
-// { dg-options "-std=c++11" }
+// { 

[PATCH 07/13] libstdc++: Remove dg-options "-std=gnu++2a" from constrained algo tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/20_util/function_objects/range.cmp/equal_to.cc:
Remove dg-options.
* testsuite/20_util/function_objects/range.cmp/greater.cc:
Likewise.
* testsuite/20_util/function_objects/range.cmp/greater_equal.cc:
Likewise.
* testsuite/20_util/function_objects/range.cmp/less.cc:
Likewise.
* testsuite/20_util/function_objects/range.cmp/less_equal.cc:
Likewise.
* testsuite/20_util/function_objects/range.cmp/lwg3530.cc:
Likewise.
* testsuite/20_util/function_objects/range.cmp/not_equal_to.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/1.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/92878_92947.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/95788.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
Likewise.
* 
testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc:
Likewise.
* 
testsuite/20_util/specialized_algorithms/uninitialized_default_construct/constrained.cc:
Likewise.
* testsuite/20_util/specialized_algorithms/uninitialized_fill/94017.cc:
Likewise.
* 
testsuite/20_util/specialized_algorithms/uninitialized_fill/constrained.cc:
Likewise.
* 
testsuite/20_util/specialized_algorithms/uninitialized_fill_n/94017.cc:
Likewise.
* 
testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc:
Likewise.
* 
testsuite/20_util/specialized_algorithms/uninitialized_value_construct/constrained.cc:
Likewise.
* testsuite/25_algorithms/adjacent_find/constexpr.cc: Likewise.
* testsuite/25_algorithms/adjacent_find/constrained.cc:
Likewise.
* testsuite/25_algorithms/all_of/constexpr.cc: Likewise.
* testsuite/25_algorithms/all_of/constrained.cc: Likewise.
* testsuite/25_algorithms/any_of/constexpr.cc: Likewise.
* testsuite/25_algorithms/any_of/constrained.cc: Likewise.
* testsuite/25_algorithms/binary_search/constexpr.cc: Likewise.
* testsuite/25_algorithms/binary_search/constrained.cc:
Likewise.
* testsuite/25_algorithms/clamp/constrained.cc: Likewise.
* testsuite/25_algorithms/constexpr_macro.cc: Likewise.
* testsuite/25_algorithms/copy/95578.cc: Likewise.
* testsuite/25_algorithms/copy/constexpr.cc: Likewise.
* testsuite/25_algorithms/copy/constrained.cc: Likewise.
* testsuite/25_algorithms/copy/debug/constexpr_neg.cc: Likewise.
* testsuite/25_algorithms/copy_backward/95578.cc: Likewise.
* testsuite/25_algorithms/copy_backward/constexpr.cc: Likewise.
* testsuite/25_algorithms/copy_backward/constrained.cc:
Likewise.
* testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc:
Likewise.
* testsuite/25_algorithms/copy_if/constexpr.cc: Likewise.
* testsuite/25_algorithms/copy_if/constrained.cc: Likewise.
* testsuite/25_algorithms/copy_n/constexpr.cc: Likewise.
* testsuite/25_algorithms/copy_n/constrained.cc: Likewise.
* testsuite/25_algorithms/count/constexpr.cc: Likewise.
* testsuite/25_algorithms/count/constrained.cc: Likewise.
* testsuite/25_algorithms/count_if/constexpr.cc: Likewise.
* testsuite/25_algorithms/count_if/constrained.cc: Likewise.
* testsuite/25_algorithms/cpp_lib_constexpr.cc: Likewise.
* testsuite/25_algorithms/equal/95578.cc: Likewise.
* testsuite/25_algorithms/equal/constexpr.cc: Likewise.
* testsuite/25_algorithms/equal/constexpr_neg.cc: Likewise.
* testsuite/25_algorithms/equal/constrained.cc: Likewise.
* testsuite/25_algorithms/equal/debug/constexpr_neg.cc:
Likewise.
* testsuite/25_algorithms/equal_range/constexpr.cc: Likewise.
* testsuite/25_algorithms/equal_range/constrained.cc: Likewise.
* testsuite/25_algorithms/fill/94017.cc: Likewise.
* testsuite/25_algorithms/fill/constexpr.cc: Likewise.
* testsuite/25_algorithms/fill/constrained.cc: Likewise.
* testsuite/25_algorithms/fill_n/94017.cc: Likewise.
* testsuite/25_algorithms/fill_n/constexpr.cc: Likewise.
* testsuite/25_algorithms/fill_n/constrained.cc: Likewise.
* testsuite/25_algorithms/find/constexpr.cc: Likewise.
* testsuite/25_algorithms/find/constrained.cc: Likewise.
* testsuite/25_algorithms/find_end/constexpr.cc: Likewise.
* testsuite/25_algorithms/find_end/constrained.cc: Likewise.
* testsuite/25_algorithms/find_first_of/constexpr.cc: Likewise.

[PATCH 04/13] libstdc++: Replace dg-options "-std=c++20" with dg-add-options strict_std

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well. Because they test a problem seen with -std=c++20 add
the new { dg-add-options strict_std } directive so that the test runner
uses -std=c++NN not -std=gnu++NN.

libstdc++-v3/ChangeLog:

* testsuite/24_iterators/reverse_iterator/100639.cc: Remove
dg-options and add dg-add-options strict_std.
* testsuite/std/ranges/iota/93267.cc: Likewise.
* testsuite/std/ranges/iota/96042.cc: Likewise.
* testsuite/std/ranges/iota/size.cc: Likewise.
* testsuite/std/ranges/subrange/96042.cc: Likewise.
---
 .../testsuite/24_iterators/reverse_iterator/100639.cc | 4 ++--
 libstdc++-v3/testsuite/std/ranges/iota/93267.cc   | 4 ++--
 libstdc++-v3/testsuite/std/ranges/iota/96042.cc   | 4 ++--
 libstdc++-v3/testsuite/std/ranges/iota/size.cc| 2 +-
 libstdc++-v3/testsuite/std/ranges/subrange/96042.cc   | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc 
b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc
index 5d0a7f4af27..68bf4e08488 100644
--- a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/100639.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
+// { dg-add-options strict_std }
 
 // PR libstdc++/100639
 
diff --git a/libstdc++-v3/testsuite/std/ranges/iota/93267.cc 
b/libstdc++-v3/testsuite/std/ranges/iota/93267.cc
index 3bb74bbf485..4306aea4d43 100644
--- a/libstdc++-v3/testsuite/std/ranges/iota/93267.cc
+++ b/libstdc++-v3/testsuite/std/ranges/iota/93267.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
+// { dg-add-options strict_std }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/std/ranges/iota/96042.cc 
b/libstdc++-v3/testsuite/std/ranges/iota/96042.cc
index 7070a7d6b10..6c553de9ce9 100644
--- a/libstdc++-v3/testsuite/std/ranges/iota/96042.cc
+++ b/libstdc++-v3/testsuite/std/ranges/iota/96042.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++2a" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
+// { dg-add-options strict_std }
 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/std/ranges/iota/size.cc 
b/libstdc++-v3/testsuite/std/ranges/iota/size.cc
index 958cb5f03c8..28848d55561 100644
--- a/libstdc++-v3/testsuite/std/ranges/iota/size.cc
+++ b/libstdc++-v3/testsuite/std/ranges/iota/size.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++2a" }
 // { dg-do compile { target c++2a } }
+// { dg-add-options strict_std }
 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/std/ranges/subrange/96042.cc 
b/libstdc++-v3/testsuite/std/ranges/subrange/96042.cc
index bc22f999ed8..3856952eeb3 100644
--- a/libstdc++-v3/testsuite/std/ranges/subrange/96042.cc
+++ b/libstdc++-v3/testsuite/std/ranges/subrange/96042.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++20" }
-// { dg-do compile { target c++2a } }
+// { dg-do compile { target c++20 } }
+// { dg-add-options strict_std }
 
 #include 
 #include 
-- 
2.41.0



[PATCH 13/13] libstdc++: Simplify dejagnu directives for some tests using threads

2023-09-11 Thread Jonathan Wakely via Gcc-patches
Replace dg-require-effective-target directives with a target selector on
the dg-do directive.

We can also remove { dg-require-effective-target pthread } and the
associated { dg-options "-pthread" } by allowing it to run on
non-pthread targets and conditionally adding -pthread only for pthread
targets.

libstdc++-v3/ChangeLog:

* testsuite/20_util/shared_ptr/atomic/3.cc: Simplify dg
directives.
* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
Likewise.
* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/allocate.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/allocate_single.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/cons.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/cons_single.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/is_equal.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/multithreaded.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/options.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/release.cc:
Likewise.
* testsuite/20_util/synchronized_pool_resource/release_single.cc:
Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc:
Likewise.
* testsuite/30_threads/stop_token/stop_callback/destroy.cc:
Likewise.
---
 libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc   | 3 +--
 .../20_util/shared_ptr/thread/default_weaktoshared.cc   | 3 +--
 .../20_util/shared_ptr/thread/mutex_weaktoshared.cc | 3 +--
 .../20_util/synchronized_pool_resource/allocate.cc  | 6 ++
 .../20_util/synchronized_pool_resource/allocate_single.cc   | 3 +--
 .../testsuite/20_util/synchronized_pool_resource/cons.cc| 6 ++
 .../20_util/synchronized_pool_resource/cons_single.cc   | 3 +--
 .../20_util/synchronized_pool_resource/is_equal.cc  | 6 ++
 .../20_util/synchronized_pool_resource/multithreaded.cc | 6 ++
 .../testsuite/20_util/synchronized_pool_resource/options.cc | 6 ++
 .../testsuite/20_util/synchronized_pool_resource/release.cc | 6 ++
 .../20_util/synchronized_pool_resource/release_single.cc| 3 +--
 .../30_threads/condition_variable_any/stop_token/wait_on.cc | 6 ++
 .../30_threads/stop_token/stop_callback/deadlock-mt.cc  | 5 ++---
 .../30_threads/stop_token/stop_callback/destroy.cc  | 5 ++---
 15 files changed, 24 insertions(+), 46 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc 
b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc
index 8346191412c..19efcadb7ec 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc
@@ -1,6 +1,5 @@
-// { dg-do run }
+// { dg-do run { target c++11 } }
 // { dg-additional-options "-pthread" { target pthread } }
-// { dg-require-effective-target c++11 }
 // { dg-require-gthreads "" }
 
 // Copyright (C) 2014-2023 Free Software Foundation, Inc.
diff --git 
a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc 
b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
index 20c910c2fcd..af0e65e9469 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
@@ -17,10 +17,9 @@
 
 // 20.6.6.2 Template class shared_ptr [util.smartptr.shared]
 
-// { dg-do run }
+// { dg-do run { target c++11 } }
 // { dg-additional-options "-pthread" { target pthread } }
 // { dg-add-options libatomic }
-// { dg-require-effective-target c++11 }
 // { dg-require-gthreads "" }
 // { dg-require-cstdint "" }
 
diff --git 
a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc 
b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
index d6c8611aa85..07f7c49bf10 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
@@ -17,10 +17,9 @@
 
 // 20.6.6.2 Template class shared_ptr [util.smartptr.shared]
 
-// { dg-do run }
+// { dg-do run { target c++11 } }
 // { dg-additional-options "-pthread" { target pthread } }
 // { dg-add-options libatomic }
-// { dg-require-effective-target c++11 }
 // { dg-require-gthreads "" }
 // { dg-require-cstdint "" }
 
diff --git 
a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc 
b/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc
index f9a4a2f3694..822a410b6c2 100644
--- a/libstdc++-v3/testsuite/20_util/synchronized_pool_resource/allocate.cc
+++ 

[PATCH 06/13] libstdc++: Remove dg-options "-std=gnu++20" from and tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
The testsuite will automatically select C++20 for these tests now, and
removing the hardcoded -std option allows them to be tested for C++23
and C++26 as well.

libstdc++-v3/ChangeLog:

* testsuite/std/concepts/1.cc: Remove dg-options.
* testsuite/std/concepts/2.cc: Likewise.
* testsuite/std/concepts/concepts.callable/invocable.cc:
Likewise.
* testsuite/std/concepts/concepts.callable/regular_invocable.cc:
Likewise.
* testsuite/std/concepts/concepts.callable/relation.cc:
Likewise.
* testsuite/std/concepts/concepts.callable/strictweakorder.cc:
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.arithmetic/floating_point.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.arithmetic/integral.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.arithmetic/signed_integral.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.arithmetic/unsigned_integral.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.assignable/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.common/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.commonref/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.constructible/1.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.convertible/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.copyconstructible/1.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.defaultinitializable/1.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.defaultinitializable/lwg3149.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.derived/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.destructible/1.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.moveconstructible/1.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.same/1.cc:
Likewise.
* testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc: 
Likewise.
* testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc: 
Likewise.
* 
testsuite/std/concepts/concepts.lang/concept.swappable/swappable_with.cc: 
Likewise.
* testsuite/std/concepts/concepts.object/copyable.cc: Likewise.
* testsuite/std/concepts/concepts.object/movable.cc: Likewise.
* testsuite/std/concepts/concepts.object/regular.cc: Likewise.
* testsuite/std/concepts/concepts.object/semiregular.cc:
Likewise.
* testsuite/std/ranges/97600.cc: Likewise.
* testsuite/std/ranges/access/101782.cc: Likewise.
* testsuite/std/ranges/access/begin.cc: Likewise.
* testsuite/std/ranges/access/begin_neg.cc: Likewise.
* testsuite/std/ranges/access/cbegin.cc: Likewise.
* testsuite/std/ranges/access/cdata.cc: Likewise.
* testsuite/std/ranges/access/cend.cc: Likewise.
* testsuite/std/ranges/access/crbegin.cc: Likewise.
* testsuite/std/ranges/access/crend.cc: Likewise.
* testsuite/std/ranges/access/data.cc: Likewise.
* testsuite/std/ranges/access/empty.cc: Likewise.
* testsuite/std/ranges/access/end.cc: Likewise.
* testsuite/std/ranges/access/end_neg.cc: Likewise.
* testsuite/std/ranges/access/lwg3467.cc: Likewise.
* testsuite/std/ranges/access/p2602.cc: Likewise.
* testsuite/std/ranges/access/rbegin.cc: Likewise.
* testsuite/std/ranges/access/rend.cc: Likewise.
* testsuite/std/ranges/access/size.cc: Likewise.
* testsuite/std/ranges/access/size_neg.cc: Likewise.
* testsuite/std/ranges/access/ssize.cc: Likewise.
* testsuite/std/ranges/adaptors/100479.cc: Likewise.
* testsuite/std/ranges/adaptors/100577.cc: Likewise.
* testsuite/std/ranges/adaptors/93978.cc: Likewise.
* testsuite/std/ranges/adaptors/95322.cc: Likewise.
* testsuite/std/ranges/adaptors/99433.cc: Likewise.
* testsuite/std/ranges/adaptors/all.cc: Likewise.
* testsuite/std/ranges/adaptors/common.cc: Likewise.
* testsuite/std/ranges/adaptors/conditionally_borrowed.cc:
Likewise.
* testsuite/std/ranges/adaptors/counted.cc: Likewise.
* testsuite/std/ranges/adaptors/detail/copyable_box.cc:
Likewise.
* testsuite/std/ranges/adaptors/drop.cc: Likewise.
* testsuite/std/ranges/adaptors/drop_while.cc: Likewise.
* testsuite/std/ranges/adaptors/elements.cc: Likewise.
* testsuite/std/ranges/adaptors/filter.cc: Likewise.
* testsuite/std/ranges/adaptors/join.cc: Likewise.
* testsuite/std/ranges/adaptors/lazy_split.cc: Likewise.
* testsuite/std/ranges/adaptors/lazy_split_neg.cc: Likewise.
* testsuite/std/ranges/adaptors/lwg3286.cc: Likewise.
* 

[PATCH 03/13] libstdc++: Replace dg-options "-std=c++17" with dg-add-options strict_std

2023-09-11 Thread Jonathan Wakely via Gcc-patches
These tests can (and should) also be run for later standards, so replace
the { dg-options "-std=c++17" } with { dg-add-options strict_std }.

* 
testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/compile_cxx17.cc:
Replace dg-options -std=c++17 with dg-add-options strict_std.
* 
testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/compile_cxx17.cc:
Likewise.
---
 .../special_functions/07_conf_hyperg/compile_cxx17.cc   | 2 +-
 .../special_functions/17_hyperg/compile_cxx17.cc| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/compile_cxx17.cc
 
b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/compile_cxx17.cc
index 60264ebe3dd..a10ba8e517b 100644
--- 
a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/compile_cxx17.cc
+++ 
b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/compile_cxx17.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++17" }
 // { dg-do compile { target c++17 } }
+// { dg-add-options strict_std }
 
 #include 
 
diff --git 
a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/compile_cxx17.cc
 
b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/compile_cxx17.cc
index 40ea47c1ca4..91a55883f64 100644
--- 
a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/compile_cxx17.cc
+++ 
b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/17_hyperg/compile_cxx17.cc
@@ -15,8 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-options "-std=c++17" }
 // { dg-do compile { target c++17 } }
+// { dg-add-options strict_std }
 
 #include 
 
-- 
2.41.0



[PATCH 00/13] libstdc++: Add support for running tests with multiple -std options

2023-09-11 Thread Jonathan Wakely via Gcc-patches
This patch series replicates the behaviour of the g++ testsuite, so that
libstdc++ tests can easily be run for multiple different -std options in
a single testsuite run.  As described in the updated docs, the -std
options to use for every test can be overridden by setting v3_std_list
in ~/.dejagnurc or $DEJAGNU, or setting $GLIBCXX_TESTSUITE_STDS in the
environment.  If not overridden, the default is just to run with
-std=gnu++17 (so that we don't increase the time taken for a full
testsuite run).

Tests that require a newer standard than C++17 will default to that
newer standard and C++26, so e.g. std::format tests will be run with
both -std=gnu++20 and -std=gnu++26.  This does increase the number of
tests, but only for the subset of tests for C++20/23/26 features.  If
this is too costly for testers, we can change that (this might be
needed, because the C++20 tests for std::ranges and std::format are
particularly slow to compile).

Because a correct default will be chosen for tests that require
something newer than C++17, we no longer need dg-options "-std=gnu++20"
or similar in any tests.  Removing the explicit -std option allows the
test to be run for later standards via the v3_std_list settings, so that
we can verify that C++20 features still work in C++23 and C++26, for
example.  This change already found some tests which failed when run
with a later standard (see r14-3771-gf12e26f3496275).

Patches 2-13 in the series remove those unnecessary dg-options from
about half the relevant tests, but there are more than 500 others that
still need adjusting.

We can remove files like testsuite/std/format/functions/format_c++23.cc
which only exist to duplicate existing tests with a different -std
option.  We can remove that file now, and rely on format.cc being run
with multiple -std options by libstdc++ maintainers.

It might also be useful to add a 'make check-quick' target which runs a
small subset of smoke tests with every standard version in v3_std_list.
This would be a suitable target for CI bots and for packagers who want
to verify that a build of GCC is functional, without running the entire
libstdc++ testsuite.

Any comments or suggestions?

-- >8 --

Jonathan Wakely (13):
  libstdc++: Add support for running tests with multiple -std options
  libstdc++: Replace dg-options "-std=c++11" with dg-add-options
strict_std
  libstdc++: Replace dg-options "-std=c++17" with dg-add-options
strict_std
  libstdc++: Replace dg-options "-std=c++20" with dg-add-options
strict_std
  libstdc++: Remove dg-options "-std=c++20" from  and 
tests
  libstdc++: Remove dg-options "-std=gnu++20" from  and
 tests
  libstdc++: Remove dg-options "-std=gnu++2a" from constrained algo
tests
  libstdc++: Remove dg-options "-std=gnu++20" from std::format tests
  libstdc++: Remove dg-options "-std=gnu++20" from std::chrono tests
  libstdc++: Remove dg-options "-std=gnu++23" from std::expected tests
  libstdc++: Remove dg-options "-std=gnu++23" from remaining tests
  libstdc++: Remove dg-options "-std=gnu++2a" from XFAIL std::span tests
  libstdc++: Simplify dejagnu directives for some tests using threads

 libstdc++-v3/doc/html/manual/test.html|  46 +---
 libstdc++-v3/doc/xml/manual/test.xml  |  52 ++---
 .../headers/limits/synopsis_cxx23.cc  |   1 -
 .../18_support/headers/stdfloat/types_std.cc  |   1 -
 .../18_support/type_info/constexpr.cc |   2 +-
 .../19_diagnostics/stacktrace/current.cc  |   2 +-
 .../19_diagnostics/stacktrace/entry.cc|   2 +-
 .../19_diagnostics/stacktrace/stacktrace.cc   |   2 +-
 .../19_diagnostics/stacktrace/synopsis.cc |   1 -
 .../19_diagnostics/stacktrace/version.cc  |   1 -
 .../20_util/aligned_storage/deprecated-2b.cc  |   1 -
 .../20_util/aligned_union/deprecated-2b.cc|   1 -
 .../20_util/bitset/access/constexpr.cc|   1 -
 .../20_util/bitset/cons/constexpr_c++23.cc|   1 -
 .../20_util/bitset/count/constexpr.cc |   1 -
 .../testsuite/20_util/bitset/ext/constexpr.cc |   1 -
 .../bitset/operations/constexpr_c++23.cc  |   1 -
 .../testsuite/20_util/bitset/version.cc   |   1 -
 .../duration/arithmetic/overflow_c++20.cc |   1 -
 libstdc++-v3/testsuite/20_util/duration/io.cc |   1 -
 .../testsuite/20_util/expected/assign.cc  |   1 -
 .../testsuite/20_util/expected/bad.cc |   1 -
 .../testsuite/20_util/expected/cons.cc|   1 -
 .../testsuite/20_util/expected/equality.cc|   1 -
 .../20_util/expected/illformed_neg.cc |   1 -
 .../testsuite/20_util/expected/lwg3877.cc |   1 -
 .../testsuite/20_util/expected/lwg3938.cc |   1 -
 .../testsuite/20_util/expected/monadic.cc |   1 -
 .../testsuite/20_util/expected/observers.cc   |   1 -
 .../20_util/expected/requirements.cc  |   1 -
 .../testsuite/20_util/expected/swap.cc|   1 -
 .../testsuite/20_util/expected/synopsis.cc|   1 -
 .../testsuite/20_util/expected/unexpected.cc  |   1 -
 

[PATCH 01/13] libstdc++: Add support for running tests with multiple -std options

2023-09-11 Thread Jonathan Wakely via Gcc-patches
This copies the code from the compiler's gcc/testsuite/lib/g++-dg.exp so
that each test can be run multiple times, with different -std options.
This means that we can remove most { dg-options "-std=gnu++20" }
directives from tests, because the testsuite will automatically select
a set of -std options that includes that version.

Tests that should only run for a specific standard (e.g. ones that use
something like { dg-do run { target c++11_only } }) should still specify
that standard with { dg-options "-std=gnu++11" }, which overrides the
automatic selection. But a dg-options that selects a newer standard than
the default can be removed, because that standard will be selected
automatically based on a selector like { target c++20 } in the dg-do
directive. This will allow those tests to be run for more than just the
one they currently hardcode, so that e.g. std::format tests can be run
for all of C++20, C++23 and C++26. Currently that has to be done by
adding a second test file that uses a different dg-options line.

By default most tests will continue to run with only the default dialect
(currently -std=gnu++17) so that the time to run the entire testsuite is
not increased. We can revisit this later if increasing the testsuite
time (and coverage) is acceptable. Libstdc++ developers can easily
override the defaults to run for multiple versions. To test all
versions, either add 'set v3_std_list { 98 11 14 17 20 23 26 }' to
~/.dejagnurc or define GLIBCXX_TESTSUITE_STDS="98,11,14,17,20,23,26" in
the environment.

This should be more efficient than the current way to test with multple
standards, i.e. --target_board=unix{-std=c++14,-std=c++17,-std=c++20},
because today all tests with an explicit -std option hardcoded in them
get run for each target board variation but using the exact same
hardcoded -std every time. With the new approach you can just use the
default --target_board=unix and set GLIBCXX_TESTSUITE_STDS="14,17,20"
and now a test that has { target c++20 } will only run once (and be
UNSUPPORTED twice), instead of running with identical options three
times.

In order to support ~/.dejagnurc and $DEJAGNU files that need to work
with versions of GCC without this change, a new variable is added to
site.tmp to detect whether v3_std_list is supported. That allows e.g.

if { [info exists v3-use-std-list] } {
  set v3_std_list { 11 17 23 }
  set target_list { "unix{,-m32}" }
} else {
  set target_list { "unix{,-std=gnu++2b,-std=gnu++11,-m32}" }
}

libstdc++-v3/ChangeLog:

* doc/xml/manual/test.xml: Update documentation on running and
writing tests.
* doc/html/manual/test.html: Regenerate.
* testsuite/Makefile.am: Add v3-use-std-list to site.tmp
* testsuite/Makefile.in: Regenerate.
* testsuite/lib/dg-options.exp (add_options_for_strict_std): New
proc.
* testsuite/lib/libstdc++.exp (search_for): New utility proc.
(v3-dg-runtest): New proc to replace dg-runtest.
* testsuite/libstdc++-dg/conformance.exp: Use v3-dg-runtest.
---
 libstdc++-v3/doc/html/manual/test.html|  46 +---
 libstdc++-v3/doc/xml/manual/test.xml  |  52 ++---
 libstdc++-v3/testsuite/Makefile.am|   1 +
 libstdc++-v3/testsuite/Makefile.in|   1 +
 libstdc++-v3/testsuite/lib/dg-options.exp |   7 ++
 libstdc++-v3/testsuite/lib/libstdc++.exp  | 107 ++
 .../testsuite/libstdc++-dg/conformance.exp|   3 +-
 7 files changed, 186 insertions(+), 31 deletions(-)

diff --git a/libstdc++-v3/doc/html/manual/test.html 
b/libstdc++-v3/doc/html/manual/test.html
index fadadf249bb..b29c2eb359e 100644
--- a/libstdc++-v3/doc/html/manual/test.html
+++ b/libstdc++-v3/doc/html/manual/test.html
@@ -350,6 +350,16 @@ cat 27_io/objects/char/3_xin.in | 
a.outunix/-O3\"{-std=gnu++98,-std=gnu++11,}\" so 
that
   the third variation would use the default for -std
   (which is -std=gnu++14 as of GCC 6).
+
+  Since GCC 14, the libstdc++ testsuite has built-in support for running
+  tests with more than one -std, similar to 
the G++ tests.
+  Adding set v3_std_list { 11 17 23 } to
+  ~/.dejagnurc or a file named by the
+  DEJAGNU environment variable will cause every 
test to
+  be run three times, using a different -std 
each time.
+  Alternatively, a list of standard versions to test with can be specified
+  as a comma-separated list in the envvarGLIBCXX_TESTSUITE_STDS/envvar
+  environment variable.
 
   To run the libstdc++ test suite under the
   debug mode, use
@@ -467,11 +477,12 @@ cat 27_io/objects/char/3_xin.in | 
a.outonly
 be run for a specific standard (and not later standards) using an
 effective target like c++11_only. However, 
this means
-the test will be skipped by default (because the default mode is
-gnu++14), and so will only run when
--std=gnu++11 or -std=c++11 is used
-explicitly. For tests that require a specific standard it 

Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Sept 2023 at 16:40, Christophe Lyon
 wrote:
>
>
>
> On Mon, 11 Sept 2023 at 17:22, Jonathan Wakely  wrote:
>>
>> On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
>>  wrote:
>> >
>> >
>> >
>> > On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely  wrote:
>> >>
>> >> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>> >>  wrote:
>> >> >
>> >> >
>> >> >
>> >> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely  
>> >> > wrote:
>> >> >>
>> >> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> >> >>  wrote:
>> >> >> >
>> >> >> > Some targets like arm-eabi with newlib and default settings rely on
>> >> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> >> >> > implement it by default, to make users aware they have to take 
>> >> >> > special
>> >> >> > care.
>> >> >> >
>> >> >> > This makes a few tests fail to link.
>> >> >>
>> >> >> Does this mean those features are unusable on the target, or just that
>> >> >> users need to provide their own __sync_synchronize to use them?
>> >> >
>> >> >
>> >> > IIUC the user is expected to provide them.
>> >> > Looks like we discussed this in the past :-)
>> >> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>> >> > see the pointer to Ramana's comment: 
>> >> > https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>> >>
>> >> Oh yes, thanks for the reminder!
>> >>
>> >> >
>> >> > The default arch for arm-eabi is armv4t which is very old.
>> >> > When running the testsuite with something more recent (either as 
>> >> > default by configuring GCC --with-arch=XXX or by forcing -march/-mcpu 
>> >> > via dejagnu's target-board), the compiler generates barrier 
>> >> > instructions and there are no such errors.
>> >>
>> >> Ah yes, that's fine then.
>> >>
>> >> > For instance, here is a log with the defaults:
>> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>> >> > and a log when we target cortex-m0 which is still a very small cpu but 
>> >> > has barriers:
>> >> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>> >> >
>> >> > I somehow wanted to get rid of such errors with the default 
>> >> > configuration
>> >>
>> >> Yep, that makes sense, and we'll still be testing them for newer
>> >> arches on the target, so it's not completely disabling those parts of
>> >> the testsuite.
>> >>
>> >> But I'm still curious why some of those tests need this change. I
>> >> think the ones I noted below are probably failing for some other
>> >> reasons.
>> >>
>> > Just looked at  23_containers/span/back_assert_neg.cc, the linker says it 
>> > needs
>> > arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
>> > ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char 
>> > const*, int, char const*, char const*))
>> > and indeed debug.o has a reference to __sync_synchronize
>>
>> Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
>> there are no dependencies on anything else in that file, including the
>> _M_detach member function that uses atomics.
>
> indeed
>
>
>>
>> This would also be solved by -Wl,--gc-sections :-)
>
> :-)
>
>>
>> I think it would be better to move __glibcxx_assert_fail to a new
>> file, so that it doesn't make every assertion unnecessarily depend on
>> __sync_synchronize. I'll do that now.
>
> Sounds like a good idea, thanks.

Done now at r14-3846-g4a2766ed00a479
>
>>
>> We could also make the atomics in debug.o conditional, so that debug
>> mode doesn't depend on __sync_synchronize for single-threaded targets.
>> Does the arm4t arch have pthreads support in newlib?  I didn't bother
>
> No ( grep _GLIBCXX_HAS_GTHREADS 
> $objdir/arm-eabi/libstdc++-v3/include/arm-eabi/bits/c++config returns:
> /* #undef _GLIBCXX_HAS_GTHREADS */
>
>> making the use of atomics conditional, because performance is not
>> really a priority for debug mode bookkeeping. But the problem here
>> isn't just a slight performance overhead of atomics, it's that they
>> aren't even supported for arm4t.
>
> OK thanks.
>
> So finally, this uncovered at least a "bug" that  __glibcxx_assert_fail 
> should be in a dedicated object file :-)
>
> I'll revisit my patch once you have moved __glibcxx_assert_fail

That's done (at r14-3845-gc7db9000fa7cac) and there should be no more
__sync_synchronize from src/c++11/debug.o at all now (at
r14-3846-g4a2766ed00a479). With that second change, it would have been
OK for __glibcxx_assert_fail to stay in that file, but it's not really
related so it's probably better for it to be in a separate file
anyway.

That should remove the need for most of your patch!



[committed] libstdc++: Remove unconditional use of atomics in Debug Mode

2023-09-11 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

Probably worth backporting too.

-- >8 --

The fix for PR 91910 (r10-3426-gf7a3a382279585) introduced unconditional
uses of atomics into src/c++11/debug.cc, which causes linker errors for
arm4t where GCC emits an unresolved reference to __sync_synchronize.

By making the uses of atomics depend on _GLIBCXX_HAS_GTHREADS we can
avoid those unconditional references to __sync_synchronize for targets
where the atomics are unnecessary. As a minor performance optimization
we can also check the __gnu_cxx::__is_single_threaded function to avoid
atomics for single-threaded programs even where they don't cause linker
errors.

libstdc++-v3/ChangeLog:

* src/c++11/debug.cc (acquire_sequence_ptr_for_lock): New
function.
(reset_sequence_ptr): New function.
(_Safe_iterator_base::_M_detach)
(_Safe_local_iterator_base::_M_detach): Replace bare atomic_load
with acquire_sequence_ptr_for_lock.
(_Safe_iterator_base::_M_reset): Replace bare atomic_store with
reset_sequence_ptr.
---
 libstdc++-v3/src/c++11/debug.cc | 32 +---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc
index f40e995e0f3..bb0d0db6679 100644
--- a/libstdc++-v3/src/c++11/debug.cc
+++ b/libstdc++-v3/src/c++11/debug.cc
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include  // __is_single_threaded
 
 #include 
 #include 
@@ -156,6 +157,31 @@ namespace
__old->_M_reset();
   }
   }
+
+  void*
+  acquire_sequence_ptr_for_lock(__gnu_debug::_Safe_sequence_base*& seq)
+  {
+#ifdef __GTHREADS
+if (!__gnu_cxx::__is_single_threaded())
+  return __atomic_load_n(, __ATOMIC_ACQUIRE);
+#endif
+return seq;
+  }
+
+  void
+  reset_sequence_ptr(__gnu_debug::_Safe_sequence_base*& seq)
+  {
+#ifdef __GTHREADS
+if (!__gnu_cxx::__is_single_threaded())
+  {
+   __atomic_store_n(, (__gnu_debug::_Safe_sequence_base*)nullptr,
+__ATOMIC_RELEASE);
+   return;
+  }
+#endif
+seq = nullptr;
+  }
+
 } // anonymous namespace
 
 namespace __gnu_debug
@@ -439,7 +465,7 @@ namespace __gnu_debug
 // If the sequence destructor runs between loading the pointer and
 // locking the mutex, it will detach this iterator and set _M_sequence
 // to null, and then _M_detach_single() will do nothing.
-if (auto seq = __atomic_load_n(&_M_sequence, __ATOMIC_ACQUIRE))
+if (auto seq = acquire_sequence_ptr_for_lock(_M_sequence))
   {
__gnu_cxx::__scoped_lock sentry(get_safe_base_mutex(seq));
_M_detach_single();
@@ -461,7 +487,7 @@ namespace __gnu_debug
   _Safe_iterator_base::
   _M_reset() throw ()
   {
-__atomic_store_n(&_M_sequence, (_Safe_sequence_base*)0, __ATOMIC_RELEASE);
+reset_sequence_ptr(_M_sequence);
 // Do not reset version, so that a detached iterator does not look like a
 // value-initialized one.
 // _M_version = 0;
@@ -523,7 +549,7 @@ namespace __gnu_debug
   _Safe_local_iterator_base::
   _M_detach()
   {
-if (auto seq = __atomic_load_n(&_M_sequence, __ATOMIC_ACQUIRE))
+if (auto seq = acquire_sequence_ptr_for_lock(_M_sequence))
   {
__gnu_cxx::__scoped_lock sentry(get_safe_base_mutex(seq));
_M_detach_single();
-- 
2.41.0



[committed] libstdc++: Move __glibcxx_assert_fail to its own file

2023-09-11 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

Maybe worth backporting too.

-- >8 --

This avoids a dependency on the other symbols in src/c++11/debug.o when
linking statically to libstdc++.a without using -Wl,--gc-sections.

libstdc++-v3/ChangeLog:

* src/c++11/Makefile.am: Add new file.
* src/c++11/Makefile.in: Regenerate.
* src/c++11/debug.cc (__glibcxx_assert_fail): Move to ...
* src/c++11/assert_fail.cc: New file.
---
 libstdc++-v3/src/c++11/Makefile.am|  1 +
 libstdc++-v3/src/c++11/Makefile.in|  7 +++--
 libstdc++-v3/src/c++11/assert_fail.cc | 44 +++
 libstdc++-v3/src/c++11/debug.cc   | 18 ---
 4 files changed, 49 insertions(+), 21 deletions(-)
 create mode 100644 libstdc++-v3/src/c++11/assert_fail.cc

diff --git a/libstdc++-v3/src/c++11/Makefile.am 
b/libstdc++-v3/src/c++11/Makefile.am
index 682be1669a4..e7495dcccef 100644
--- a/libstdc++-v3/src/c++11/Makefile.am
+++ b/libstdc++-v3/src/c++11/Makefile.am
@@ -56,6 +56,7 @@ sources_freestanding = \
placeholders.cc
 
 sources = \
+   assert_fail.cc \
chrono.cc \
codecvt.cc \
condition_variable.cc \
diff --git a/libstdc++-v3/src/c++11/Makefile.in 
b/libstdc++-v3/src/c++11/Makefile.in
index e7a09fe3246..a10e05977bc 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -127,9 +127,9 @@ am__objects_1 = limits.lo placeholders.lo
 @ENABLE_DUAL_ABI_TRUE@ cxx11-ios_failure.lo \
 @ENABLE_DUAL_ABI_TRUE@ cxx11-shim_facets.lo cxx11-stdexcept.lo
 am__objects_3 = ctype_configure_char.lo ctype_members.lo
-am__objects_4 = chrono.lo codecvt.lo condition_variable.lo \
-   cow-stdexcept.lo ctype.lo debug.lo functexcept.lo \
-   functional.lo futex.lo future.lo hash_c++0x.lo \
+am__objects_4 = assert_fail.lo chrono.lo codecvt.lo \
+   condition_variable.lo cow-stdexcept.lo ctype.lo debug.lo \
+   functexcept.lo functional.lo futex.lo future.lo hash_c++0x.lo \
hashtable_c++0x.lo ios.lo ios_errcat.lo mutex.lo random.lo \
regex.lo shared_ptr.lo snprintf_lite.lo system_error.lo \
thread.lo $(am__objects_2) $(am__objects_3)
@@ -475,6 +475,7 @@ sources_freestanding = \
placeholders.cc
 
 sources = \
+   assert_fail.cc \
chrono.cc \
codecvt.cc \
condition_variable.cc \
diff --git a/libstdc++-v3/src/c++11/assert_fail.cc 
b/libstdc++-v3/src/c++11/assert_fail.cc
new file mode 100644
index 000..540e953da2e
--- /dev/null
+++ b/libstdc++-v3/src/c++11/assert_fail.cc
@@ -0,0 +1,44 @@
+// Debugging mode support code -*- C++ -*-
+
+// Copyright (C) 2021-2023 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+#include   // for std::fprintf, stderr
+#include  // for std::abort
+
+#ifdef _GLIBCXX_VERBOSE_ASSERT
+namespace std
+{
+  [[__noreturn__]]
+  void
+  __glibcxx_assert_fail(const char* file, int line,
+   const char* function, const char* condition) noexcept
+  {
+if (file && function && condition)
+  fprintf(stderr, "%s:%d: %s: Assertion '%s' failed.\n",
+ file, line, function, condition);
+else if (function)
+  fprintf(stderr, "%s: Undefined behavior detected.\n", function);
+abort();
+  }
+}
+#endif
diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc
index 926e8be6122..f40e995e0f3 100644
--- a/libstdc++-v3/src/c++11/debug.cc
+++ b/libstdc++-v3/src/c++11/debug.cc
@@ -45,24 +45,6 @@
 
 #include "mutex_pool.h"
 
-#ifdef _GLIBCXX_VERBOSE_ASSERT
-namespace std
-{
-  [[__noreturn__]]
-  void
-  __glibcxx_assert_fail(const char* file, int line,
-   const char* function, const char* condition) noexcept
-  {
-if (file && function && condition)
-  fprintf(stderr, "%s:%d: %s: Assertion '%s' failed.\n",
- file, line, function, condition);
-else if (function)
-  fprintf(stderr, "%s: Undefined behavior detected.\n", function);
-abort();
-  }
-}
-#endif
-
 using namespace 

Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Sept 2023 at 14:57, Christophe Lyon
 wrote:
>
>
>
> On Mon, 11 Sept 2023 at 15:12, Jonathan Wakely  wrote:
>>
>> On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
>>  wrote:
>> >
>> >
>> >
>> > On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely  wrote:
>> >>
>> >> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>> >>  wrote:
>> >> >
>> >> > Some targets like arm-eabi with newlib and default settings rely on
>> >> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> >> > implement it by default, to make users aware they have to take special
>> >> > care.
>> >> >
>> >> > This makes a few tests fail to link.
>> >>
>> >> Does this mean those features are unusable on the target, or just that
>> >> users need to provide their own __sync_synchronize to use them?
>> >
>> >
>> > IIUC the user is expected to provide them.
>> > Looks like we discussed this in the past :-)
>> > In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
>> > see the pointer to Ramana's comment: 
>> > https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html
>>
>> Oh yes, thanks for the reminder!
>>
>> >
>> > The default arch for arm-eabi is armv4t which is very old.
>> > When running the testsuite with something more recent (either as default 
>> > by configuring GCC --with-arch=XXX or by forcing -march/-mcpu via 
>> > dejagnu's target-board), the compiler generates barrier instructions and 
>> > there are no such errors.
>>
>> Ah yes, that's fine then.
>>
>> > For instance, here is a log with the defaults:
>> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
>> > and a log when we target cortex-m0 which is still a very small cpu but has 
>> > barriers:
>> > https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>> >
>> > I somehow wanted to get rid of such errors with the default 
>> > configuration
>>
>> Yep, that makes sense, and we'll still be testing them for newer
>> arches on the target, so it's not completely disabling those parts of
>> the testsuite.
>>
>> But I'm still curious why some of those tests need this change. I
>> think the ones I noted below are probably failing for some other
>> reasons.
>>
> Just looked at  23_containers/span/back_assert_neg.cc, the linker says it 
> needs
> arm-eabi/libstdc++-v3/src/.libs/libstdc++.a(debug.o) to resolve
> ./back_assert_neg-back_assert_neg.o (std::__glibcxx_assert_fail(char const*, 
> int, char const*, char const*))
> and indeed debug.o has a reference to __sync_synchronize

Aha, that's just because I put __glibcxx_assert_fail in debug.o, but
there are no dependencies on anything else in that file, including the
_M_detach member function that uses atomics.

This would also be solved by -Wl,--gc-sections :-)

I think it would be better to move __glibcxx_assert_fail to a new
file, so that it doesn't make every assertion unnecessarily depend on
__sync_synchronize. I'll do that now.

We could also make the atomics in debug.o conditional, so that debug
mode doesn't depend on __sync_synchronize for single-threaded targets.
Does the arm4t arch have pthreads support in newlib?  I didn't bother
making the use of atomics conditional, because performance is not
really a priority for debug mode bookkeeping. But the problem here
isn't just a slight performance overhead of atomics, it's that they
aren't even supported for arm4t.



Re: [PATCH v2] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT

2023-09-11 Thread Jonathan Wakely via Gcc-patches
On Thu, 31 Aug 2023 at 13:33, Ken Matsui  wrote:
>
> On Tue, Aug 8, 2023 at 1:23 PM Jonathan Wakely  wrote:
> >
> >
> >
> > On Wed, 19 Jul 2023 at 20:33, Ken Matsui via Libstdc++ 
> >  wrote:
> >>
> >> This patch defines _GLIBCXX_HAS_BUILTIN_TRAIT macro, which will be used
> >> as a flag to toggle the use of built-in traits in the type_traits header
> >> through _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify the
> >> source code.
> >>
> >> libstdc++-v3/ChangeLog:
> >>
> >> * include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Define.
> >> (_GLIBCXX_HAS_BUILTIN): Keep defined.
> >
> >
> > I think this would be a little better as:
> >
> > * include/bits/c++config (_GLIBCXX_HAS_BUILTIN): Do not undef.
> > (_GLIBCXX_HAS_BUILTIN_TRAIT): Define.
> >
> > OK for trunk with that change, thanks.
> >
> Thank you for your review! Patrick and I were discussing the naming
> conventions for the macros _GLIBCXX_HAS_BUILTIN_TRAIT and
> _GLIBCXX_NO_BUILTIN_TRAITS. It was brought to our attention that these
> namings might be ambiguous, as there are implementations that have
> corresponding built-ins but do not have fallback. Therefore, we
> believe that using _GLIBCXX_USE_BUILTIN_TRAIT instead of
> _GLIBCXX_HAS_BUILTIN_TRAIT would be more appropriate. Similarly, we
> think that _GLIBCXX_AVOID_BUILTIN_TRAITS would be a better choice than
> _GLIBCXX_NO_BUILTIN_TRAITS, as the latter implies that there are no
> built-ins, when in fact it is meant to express that the use of
> built-ins should be avoided when defining this macro. Could you please
> let me know your thoughts on these updated namings?

Yes, I agree that makes sense. I think personally I'd go with
"DISABLE" instead of "AVOID", or even "DO_NOT_USE" (to mirror "USE" in
the macro for individual traits), but either is OK.

> >
> >>
> >>
> >> Signed-off-by: Ken Matsui 
> >> ---
> >>  libstdc++-v3/include/bits/c++config | 10 +-
> >>  1 file changed, 9 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libstdc++-v3/include/bits/c++config 
> >> b/libstdc++-v3/include/bits/c++config
> >> index dd47f274d5f..984985d6fff 100644
> >> --- a/libstdc++-v3/include/bits/c++config
> >> +++ b/libstdc++-v3/include/bits/c++config
> >> @@ -854,7 +854,15 @@ namespace __gnu_cxx
> >>  # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
> >>  #endif
> >>
> >> -#undef _GLIBCXX_HAS_BUILTIN
> >> +// Returns 1 if _GLIBCXX_NO_BUILTIN_TRAITS is not defined and the compiler
> >> +// has a corresponding built-in type trait, 0 otherwise.
> >> +// _GLIBCXX_NO_BUILTIN_TRAITS can be defined to disable the use of 
> >> built-in
> >> +// traits.
> >> +#ifndef _GLIBCXX_NO_BUILTIN_TRAITS
> >> +# define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) _GLIBCXX_HAS_BUILTIN(BT)
> >> +#else
> >> +# define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) 0
> >> +#endif
> >>
> >>  // Mark code that should be ignored by the compiler, but seen by Doxygen.
> >>  #define _GLIBCXX_DOXYGEN_ONLY(X)
> >> --
> >> 2.41.0
> >>
>



[committed] libstdc++: Formatting std::thread::id and std::stacktrace (P2693R1)

2023-09-11 Thread Jonathan Wakely via Gcc-patches
Tested aarch64-linux. Pushed to trunk.

-- >8 --

New std::formatter specializations for C++23.

libstdc++-v3/ChangeLog:

* include/bits/version.def (__cpp_lib_formatters): Define.
* include/bits/version.h: Regenerate.
* include/std/stacktrace (formatter)
(formatter>): Define.
* include/std/thread (formatter): Define.
* testsuite/19_diagnostics/stacktrace/output.cc: New test.
* testsuite/19_diagnostics/stacktrace/synopsis.cc: Add
std::formatter specializations.
* testsuite/19_diagnostics/stacktrace/version.cc: Check
__cpp_lib_formatters macro.
* testsuite/30_threads/thread/id/hash.cc: Remove gthreads
dependency.
* testsuite/30_threads/thread/id/operators.cc: Likewise.
* testsuite/30_threads/thread/id/operators_c++20.cc: Likewise.
* testsuite/30_threads/thread/id/output.cc: New test.
---
 libstdc++-v3/include/bits/version.def |   9 ++
 libstdc++-v3/include/bits/version.h   |  25 +++--
 libstdc++-v3/include/std/stacktrace   |  80 ++
 libstdc++-v3/include/std/thread   |  62 +++
 .../19_diagnostics/stacktrace/output.cc   |  58 ++
 .../19_diagnostics/stacktrace/synopsis.cc |   3 +
 .../19_diagnostics/stacktrace/version.cc  |   6 +
 .../testsuite/30_threads/thread/id/hash.cc|   2 -
 .../30_threads/thread/id/operators.cc |   1 -
 .../30_threads/thread/id/operators_c++20.cc   |   1 -
 .../testsuite/30_threads/thread/id/output.cc  | 103 ++
 11 files changed, 339 insertions(+), 11 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
 create mode 100644 libstdc++-v3/testsuite/30_threads/thread/id/output.cc

diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index da8d067dd1a..8d9b2f71a2e 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1526,6 +1526,15 @@ ftms = {
   };
 };
 
+ftms = {
+  name = formatters;
+  values = {
+v = 202302;
+cxxmin = 23;
+hosted = yes;
+  };
+};
+
 ftms = {
   name = ios_noreplace;
   values = {
diff --git a/libstdc++-v3/include/std/stacktrace 
b/libstdc++-v3/include/std/stacktrace
index 358a81b82e5..da0e48d3532 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -31,10 +31,12 @@
 #include 
 
 #define __glibcxx_want_stacktrace
+#define __glibcxx_want_formatters
 #include 
 
 #ifdef __cpp_lib_stacktrace // C++ >= 23 && hosted && HAVE_STACKTRACE
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -692,6 +694,84 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   return std::move(__os).str();
 }
 
+  template<>
+class formatter
+{
+public:
+  constexpr typename basic_format_parse_context::iterator
+  parse(basic_format_parse_context& __pc)
+  {
+   __format::_Spec __spec{};
+   const auto __last = __pc.end();
+   auto __first = __pc.begin();
+
+   auto __finalize = [this, &__spec] {
+ _M_spec = __spec;
+   };
+
+   auto __finished = [&] {
+ if (__first == __last || *__first == '}')
+   {
+ __finalize();
+ return true;
+   }
+ return false;
+   };
+
+   if (__finished())
+ return __first;
+
+   __first = __spec._M_parse_fill_and_align(__first, __last);
+   if (__finished())
+ return __first;
+
+   __first = __spec._M_parse_width(__first, __last, __pc);
+   if (__finished())
+ return __first;
+
+   __throw_format_error("format error: invalid format-spec for "
+"std::stacktrace_entry");
+  }
+
+  template
+   typename basic_format_context<_Out, char>::iterator
+   format(const stacktrace_entry& __x,
+  basic_format_context<_Out, char>& __fc) const
+   {
+ std::ostringstream __os;
+ __os << __x;
+ return __format::__write(__fc.out(), __os.view());
+   }
+
+private:
+  __format::_Spec _M_spec;
+};
+
+  template
+class formatter>
+{
+public:
+  constexpr typename basic_format_parse_context::iterator
+  parse(basic_format_parse_context& __pc)
+  {
+   const auto __first = __pc.begin();
+   if (__first == __pc.end() || *__first == '}')
+ return __first;
+   __throw_format_error("format error: invalid format-spec for "
+"std::basic_stacktrace");
+  }
+
+  template
+   typename basic_format_context<_Out, char>::iterator
+   format(const basic_stacktrace<_Allocator>& __x,
+  basic_format_context<_Out, char>& __fc) const
+   {
+ std::ostringstream __os;
+ __os << __x;
+ return __format::__write(__fc.out(), __os.view());
+   }
+};
+
   namespace pmr
   {
 using stacktrace
diff --git 

Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
On Mon, 11 Sept 2023 at 13:36, Christophe Lyon
 wrote:
>
>
>
> On Mon, 11 Sept 2023 at 12:59, Jonathan Wakely  wrote:
>>
>> On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
>>  wrote:
>> >
>> > Some targets like arm-eabi with newlib and default settings rely on
>> > __sync_synchronize() to ensure synchronization.  Newlib does not
>> > implement it by default, to make users aware they have to take special
>> > care.
>> >
>> > This makes a few tests fail to link.
>>
>> Does this mean those features are unusable on the target, or just that
>> users need to provide their own __sync_synchronize to use them?
>
>
> IIUC the user is expected to provide them.
> Looks like we discussed this in the past :-)
> In  https://gcc.gnu.org/legacy-ml/gcc-patches/2016-10/msg01632.html,
> see the pointer to Ramana's comment: 
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg02751.html

Oh yes, thanks for the reminder!

>
> The default arch for arm-eabi is armv4t which is very old.
> When running the testsuite with something more recent (either as default by 
> configuring GCC --with-arch=XXX or by forcing -march/-mcpu via dejagnu's 
> target-board), the compiler generates barrier instructions and there are no 
> such errors.

Ah yes, that's fine then.

> For instance, here is a log with the defaults:
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-arm_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-arm_eabi
> and a log when we target cortex-m0 which is still a very small cpu but has 
> barriers:
> https://git.linaro.org/toolchain/ci/base-artifacts/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi.git/tree/00-sumfiles?h=linaro-local/ci/tcwg_gnu_embed_check_gcc/master-thumb_m0_eabi
>
> I somehow wanted to get rid of such errors with the default configuration

Yep, that makes sense, and we'll still be testing them for newer
arches on the target, so it's not completely disabling those parts of
the testsuite.

But I'm still curious why some of those tests need this change. I
think the ones I noted below are probably failing for some other
reasons.

>
>>
>> >
>> > This patch requires the missing thread-fence effective target in the
>> > tests that need it, making them UNSUPPORTED instead of FAIL and
>> > UNRESOLVED.
>>
>> Some of the modified tests should not be using
>> __gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
>> use the Debug Mode. I don't know where those linker errors come from.
>> For example, the 23_containers/span/*assert_neg.cc and
>> 26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
>> Neither should 25_algorithms/sample/2.cc nor
>> 26_numerics/bit/bit.pow.two/bit_ceil_neg.cc
>
>
> Ouch!  I had the feeling this patch wouldn't count as obvious :-)
>
> I confess I didn't analyze the linker map for every single test updated by 
> this patch
> I can have a deeper look based on your comment below, excluding those that 
> look "OK"
>
>>
>> The last three in the patch shouldn't use it either:
>>
>> > diff --git 
>> > a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc 
>> > b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
>> > index cb818708aef..372ed6e0c00 100644
>> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
>> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
>> > @@ -18,6 +18,7 @@
>> >  // { dg-do run { target c++14 } }
>> >  // { dg-add-options libatomic }
>> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
>> > +// { dg-require-thread-fence "" } // needed by 
>> > __gnu_debug::_Safe_sequence_base::_M_detach_all()
>> >
>> >  #include 
>> >  #include 
>> > diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc 
>> > b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
>> > index ae51979c3b4..8383e0be6a4 100644
>> > --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
>> > +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
>> > @@ -18,6 +18,7 @@
>> >  // { dg-do run { target c++14 } }
>> >  // { dg-add-options libatomic }
>> >  // { dg-xfail-if "poll not available" { *-*-rtems* } }
>> > +// { dg-require-thread-fence "" } // needed by 
>> > __gnu_debug::_Safe_sequence_base::_M_detach_all()
>> >
>> >  #include 
>> >  #include 
>> > diff --git 
>> > a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> >  
>> > b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> > index 960c1d253b5..42de45619a8 100644
>> > --- 
>> > a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> > +++ 
>> > b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
>> > @@ -16,6 +16,7 @@
>> >  // .
>> >
>> >  // { dg-do run { target c++14 } }
>> > +// { dg-require-thread-fence "" } // needed by 
>> > __gnu_debug::_Safe_sequence_base::_M_detach_all()
>> >
>> >  

Re: [PATCH] [11/12/13/14 Regression] ABI break in _Hash_node_value_base since GCC 11 [PR 111050]

2023-09-11 Thread Jonathan Wakely via Gcc-patches
On Sun, 10 Sept 2023 at 14:57, François Dumont via Libstdc++
 wrote:
>
> Following confirmation of the fix by TC here is the patch where I'm
> simply adding a 'constexpr' on _M_next().
>
> Please let me know this ChangeLog entry is correct. I would prefer this
> patch to be assigned to 'TC' with me as co-author but I don't know how
> to do such a thing. Unless I need to change my user git identity to do so ?

Sam already explained that, but please check with Tim how he wants to
be credited, if at all. He doesn't have a copyright assignment, and
hasn't added a DCO sign-off to the patch, but it's small enough to not
need it as this is the first contribution credited to him.


>
>  libstdc++: Add constexpr qualification to _Hash_node::_M_next()

What has this constexpr addition got to do with the ABI change and the
always_inline attributes?

It certainly doesn't seem like it should be the summary line of the
git commit message.

>
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1b6f0476837205932613ddb2b3429a55c26c409d
>  changed _Hash_node_value_base to no longer derive from
> _Hash_node_base, which means
>  that its member functions expect _M_storage to be at a different
> offset. So explosions
>  result if an out-of-line definition is emitted for any of the
> member functions (say,
>  in a non-optimized build) and the resulting object file is then
> linked with code built
>  using older version of GCC/libstdc++.
>
>  libstdc++-v3/ChangeLog:
>
>  * include/bits/hashtable_policy.h
>  (_Hash_node_value_base<>::_M_valptr(),
> _Hash_node_value_base<>::_M_v())
>  Add [[__gnu__::__always_inline__]].
>  (_Hash_node<>::_M_next()): Add constexpr.
>
>  Co-authored-by: TC 
>
> Ok to commit and backport to GCC 11, 12, 13 branches ?
>
> François
>



[PATCH] libstdc++: Check if getent is available in git config script [PR111359]

2023-09-11 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux, powerpc-aix, and minimally tested on macOS 12.6
(darwin 21.6.0).

OK for trunk?

-- >8 --

contrib/ChangeLog:

PR other/111359
* gcc-git-customization.sh: Check for getent before using it.
Use id on macOS.
---
 contrib/gcc-git-customization.sh | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index 914d868f7bd..2e173e859d7 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -46,7 +46,11 @@ set_email=$(git config --get "user.email")
 if [ "x$set_user" = "x" ]
 then
 # Try to guess the user's name by looking it up in the password file
-new_user=$(getent passwd $(whoami) | awk -F: '{ print $5 }')
+if type getent >/dev/null 2>&1; then
+  new_user=$(getent passwd $(whoami) | awk -F: '{ print $5 }')
+elif [ $(uname -s) = Darwin ]; then
+  new_user=$(id -F 2>/dev/null)
+fi
 if [ "x$new_user" = "x" ]
 then
new_user="(no default)"
-- 
2.41.0



Re: [PATCH 2/2] libstdc++: Add dg-require-thread-fence in several tests

2023-09-11 Thread Jonathan Wakely via Gcc-patches
On Sun, 10 Sept 2023 at 20:31, Christophe Lyon
 wrote:
>
> Some targets like arm-eabi with newlib and default settings rely on
> __sync_synchronize() to ensure synchronization.  Newlib does not
> implement it by default, to make users aware they have to take special
> care.
>
> This makes a few tests fail to link.

Does this mean those features are unusable on the target, or just that
users need to provide their own __sync_synchronize to use them?

>
> This patch requires the missing thread-fence effective target in the
> tests that need it, making them UNSUPPORTED instead of FAIL and
> UNRESOLVED.

Some of the modified tests should not be using
__gnu_debug::_Safe_sequence_base::_M_detach_all(), because they don't
use the Debug Mode. I don't know where those linker errors come from.
For example, the 23_containers/span/*assert_neg.cc and
26_numerics/valarray/* tests shouldn't use debug iterators or atomics.
Neither should 25_algorithms/sample/2.cc nor
26_numerics/bit/bit.pow.two/bit_ceil_neg.cc

The last three in the patch shouldn't use it either:

> diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc 
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> index cb818708aef..372ed6e0c00 100644
> --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/dest.cc
> @@ -18,6 +18,7 @@
>  // { dg-do run { target c++14 } }
>  // { dg-add-options libatomic }
>  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> +// { dg-require-thread-fence "" } // needed by 
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
>
>  #include 
>  #include 
> diff --git a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc 
> b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> index ae51979c3b4..8383e0be6a4 100644
> --- a/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> +++ b/libstdc++-v3/testsuite/experimental/net/timer/waitable/ops.cc
> @@ -18,6 +18,7 @@
>  // { dg-do run { target c++14 } }
>  // { dg-add-options libatomic }
>  // { dg-xfail-if "poll not available" { *-*-rtems* } }
> +// { dg-require-thread-fence "" } // needed by 
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
>
>  #include 
>  #include 
> diff --git 
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc 
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> index 960c1d253b5..42de45619a8 100644
> --- 
> a/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> +++ 
> b/libstdc++-v3/testsuite/experimental/polymorphic_allocator/construct_pair.cc
> @@ -16,6 +16,7 @@
>  // .
>
>  // { dg-do run { target c++14 } }
> +// { dg-require-thread-fence "" } // needed by 
> __gnu_debug::_Safe_sequence_base::_M_detach_all()
>
>  #include 
>  #include 


I'm concerned with how much of the testsuite is being completely
disabled for this target.

Any tests with "debug" in the path are probably relying on the debug
mode, and any that use -D_GLIBCXX_DEBUG in dg-options are. And I
suppose it's expected that 29_atomics/* tests rely on atomic
synchronization, but it's unfortunate that those now can't be tested
for arm-eabi, and I don't understand why it only affects eight of the
atomics tests not all the other ones.

Something doesn't seem right here.



Re: [committed] libstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a

2023-09-08 Thread Jonathan Wakely via Gcc-patches
I forgot to say:

Tested x86_64-linux and aarch64-linux, built for avr, arm-eabi and
cris-elf.

Pushed to trunk.


On Fri, 8 Sept 2023 at 18:09, Jonathan Wakely via Libstdc++
 wrote:
>
> This consolidates the three static archives for extensions into one, so
> that -lstdc++exp can be used to provide the definitions of all unstable
> library features.
>
> The libstdc++_libbacktrace.a archive is now just a "noinst" convenience
> library that is only used during the build, not installed. Its contents
> are added to libstdc++exp.a, along with the new non-inline definitions
> of std::stacktrace symbols.
>
> The libstdc++fs.a archive is still installed, but its contents are
> duplicated in libstdc++exp.a now. This means -lstdc++exp can be used
> instead of -lstdc++fs. For targets using the GNU linker we should
> consider replacing libstdc++fs.a with a linker script that does
> INPUT(libstdc++exp.a).
>
> The tests for  could be changed to use
> -lstdc++exp instead of -lstdc++fs, which would allow removing
> src/filesystem/.libs from the LDFLAGS in scripts/testsuite_flags.in,
> but that can be done at a later date.
>
> libstdc++-v3/ChangeLog:
>
> * acinclude.m4 (GLIBCXX_CONFIGURE): Add c++23 directory.
> * configure: Regenerate.
> * doc/html/manual/*: Regenerate.
> * doc/xml/manual/using.xml: Update documentation on linking.
> * include/std/stacktrace: Remove declarations of libbacktrace
> APIs.
> (stacktrace_entry::_S_err_handler, stacktrace_entry::_S_init):
> Remove.
> (stacktrace_entry::_Info): New class.
> (stacktrace_entry::_M_get_info): Use _Info.
> (__stacktrace_impl): New class.
> (basic_stacktrace): Derive from __stacktrace_impl.
> (basic_stacktrace::current): Use __stacktrace_impl::_S_current.
> * scripts/testsuite_flags.in: Adjust LDFLAGS to find
> libstdc++exp instead of libstdc++_libbacktrace.
> * src/Makefile.am (SUBDIRS): Add c++23 directory.
> * src/Makefile.in: Regenerate.
> * src/c++20/Makefile.am: Fix comment.
> * src/c++20/Makefile.in: Regenerate.
> * src/c++23/Makefile.am: New file.
> * src/c++23/Makefile.in: New file.
> * src/c++23/stacktrace.cc: New file with definitions of
> stacktrace_entry::_Info and __stacktrace_impl members.
> * src/experimental/Makefile.am: Use LIBADD to include other
> libraries.
> * src/experimental/Makefile.in: Regenerate.
> * src/libbacktrace/Makefile.am: Use noinst_LTLIBRARIES.
> * src/libbacktrace/Makefile.in: Regenerate.
> * testsuite/19_diagnostics/stacktrace/current.cc: Adjust
> dg-options to use -lstdc++exp.
> * testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
> * testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
> * testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc:
> Likewise.
> ---
>  libstdc++-v3/acinclude.m4 |   2 +-
>  libstdc++-v3/configure|  16 +-
>  libstdc++-v3/doc/html/manual/using.html   |  26 +-
>  .../html/manual/using_dynamic_or_shared.html  |   4 +
>  libstdc++-v3/doc/xml/manual/using.xml |  37 +-
>  libstdc++-v3/include/std/stacktrace   | 144 +---
>  libstdc++-v3/scripts/testsuite_flags.in   |   8 +-
>  libstdc++-v3/src/Makefile.am  |   4 +-
>  libstdc++-v3/src/Makefile.in  |   7 +-
>  libstdc++-v3/src/c++20/Makefile.am|   2 +-
>  libstdc++-v3/src/c++20/Makefile.in|   2 +-
>  libstdc++-v3/src/c++23/Makefile.am| 109 +++
>  libstdc++-v3/src/c++23/Makefile.in| 747 ++
>  libstdc++-v3/src/c++23/stacktrace.cc  | 171 
>  libstdc++-v3/src/experimental/Makefile.am |  20 +
>  libstdc++-v3/src/experimental/Makefile.in |  15 +-
>  libstdc++-v3/src/libbacktrace/Makefile.am |   3 +-
>  libstdc++-v3/src/libbacktrace/Makefile.in |  88 +--
>  .../19_diagnostics/stacktrace/current.cc  |   2 +-
>  .../19_diagnostics/stacktrace/entry.cc|   2 +-
>  .../19_diagnostics/stacktrace/stacktrace.cc   |   2 +-
>  .../vector/debug/assign4_backtrace_neg.cc |   2 +-
>  22 files changed, 1185 insertions(+), 228 deletions(-)
>  create mode 100644 libstdc++-v3/src/c++23/Makefile.am
>  create mode 100644 libstdc++-v3/src/c++23/Makefile.in
>  create mode 100644 libstdc++-v3/src/c++23/stacktrace.cc
>
> diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> index fcf79503265..34faa3c049f 100644
> --- a/libstdc++-v3/acinclude.m4
> +++ b/libstdc++-v3/acinclude.m4
> @@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
># Keep these sync'd with the list in Makefile.am.  The first provides an
># expandable list at autoconf time; the second provides an expandable list
># (i.e., shell variable) at configure time.
> -  m4_define([glibcxx_SUBDIRS],[include libsupc++ 

[committed] libstdc++: Update outdated default -std in testing docs

2023-09-08 Thread Jonathan Wakely via Gcc-patches
Pushed to gcc-13 (I've removed/rewritten this text on trunk).

I'll push to the older branches too.

-- >8 --

libstdc++-v3/ChangeLog:

* doc/xml/manual/test.xml: Update reference to -std=gnu++14 as
the default.
* doc/html/manual/test.html: Regenerate.
---
 libstdc++-v3/doc/html/manual/test.html | 10 +-
 libstdc++-v3/doc/xml/manual/test.xml   | 10 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libstdc++-v3/doc/xml/manual/test.xml 
b/libstdc++-v3/doc/xml/manual/test.xml
index 964c53d2632..9853a284814 100644
--- a/libstdc++-v3/doc/xml/manual/test.xml
+++ b/libstdc++-v3/doc/xml/manual/test.xml
@@ -767,7 +767,7 @@ cat 27_io/objects/char/3_xin.in | a.out
 be run for a specific standard (and not later standards) using an
 effective target like c++11_only. However, this means
 the test will be skipped by default (because the default mode is
-gnu++14), and so will only run when
+gnu++17), and so will only run when
 -std=gnu++11 or -std=c++11 is used
 explicitly. For tests that require a specific standard it is better to
 use a dg-options directive:
@@ -783,13 +783,13 @@ cat 27_io/objects/char/3_xin.in | a.out
 Similarly, tests which depend on a newer standard than the default
 must use dg-options instead of (or in addition to)
 an effective target, so that they are not skipped by default.
-For example, tests for C++17 features should use
-// { dg-options "-std=gnu++17" }
+For example, tests for C++20 features should use
+// { dg-options "-std=gnu++20" }
 before any dg-do such as:
-// { dg-do run "c++17" }
+// { dg-do run { target c++20 } }
 The dg-options directive must come first, so that
 the -std flag has already been added to the options
-before checking the c++17 target.
+before checking the c++20 effective target.
   
 
 Examples of Test 
Directives
-- 
2.41.0



Re: [PATCH v2] libstdc++: Fix -Wunused-parameter warnings

2023-09-08 Thread Jonathan Wakely via Gcc-patches
On Thu, 7 Sept 2023 at 20:30, Pekka Seppänen  wrote:
>
> On 7.9.2023 19:40, Jonathan Wakely wrote:
> > On 29/08/23 15:04 +0300, Pekka Seppänen wrote:
> >> libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
> >> not defined.
> >>
> >> libstdc++-v3/ChangeLog:
> >>
> >> * src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
> >> * src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
> >> * src/filesystem/path.cc (path::_S_convert_loc): Likewise.
> >> ---
> >>  libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
> >>  libstdc++-v3/src/c++17/fs_path.cc | 2 +-
> >>  libstdc++-v3/src/filesystem/path.cc   | 2 +-
> >>  3 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >> mbstate_t>>(__loc);
> >>
> >> diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> b/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> index 85277763427..9554ed1ebf9 100644
> >> --- a/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> +++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
> >> @@ -137,8 +137,8 @@ namespace
> >>}
> >>
> >>void
> >> -  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
> >> -   const char* __s, const char* __smon)
> >> +  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void*
> >> clocm,
> >> +   const char* __s, [[maybe_unused]] const char* __smon)
> >
> > This line should be split to keepo it below 80 columns.
> >
>
> Done, v2 follows.

Thanks, I'll get this one committed+pushed.


>
> > Otherwise the patch looks good, but please CC the libstdc++ list for
> > libstdc++ patches. Otherwise I won't see them, and they won't be
> > reviewed.
> >
>
> My bad, I wasn't aware of this.
>
> > Do you have a GCC copyright assignment on file? If not, please add a
> > sign-off to confirm you can submit this under the DCO terms:
> > https://gcc.gnu.org/dco.html
> >
>
> Will add.
>
> >
> >>{
> >>  auto& __cloc = *static_cast<__c_locale*>(cloc);
> >>
> >> diff --git a/libstdc++-v3/src/c++17/fs_path.cc
> >> b/libstdc++-v3/src/c++17/fs_path.cc
> >> index aaea7d2725d..d65b5482e8b 100644
> >> --- a/libstdc++-v3/src/c++17/fs_path.cc
> >> +++ b/libstdc++-v3/src/c++17/fs_path.cc
> >> @@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
> >>
> >>  path::string_type
> >>  path::_S_convert_loc(const char* __first, const char* __last,
> >> - const std::locale& __loc)
> >> + [[maybe_unused]] const std::locale& __loc)
> >>  {
> >>  #if _GLIBCXX_USE_WCHAR_T
> >>auto& __cvt = std::use_facet >> mbstate_t>>(__loc);
> >> diff --git a/libstdc++-v3/src/filesystem/path.cc
> >> b/libstdc++-v3/src/filesystem/path.cc
> >> index 4c218bdae49..d04ba6d465d 100644
> >> --- a/libstdc++-v3/src/filesystem/path.cc
> >> +++ b/libstdc++-v3/src/filesystem/path.cc
> >> @@ -498,7 +498,7 @@ path::_M_trim()
> >>
> >>  path::string_type
> >>  path::_S_convert_loc(const char* __first, const char* __last,
> >> - const std::locale& __loc)
> >> + [[maybe_unused]] const std::locale& __loc)
> >>  {
> >>  #if _GLIBCXX_USE_WCHAR_T
> >>auto& __cvt = std::use_facet >
> >
>
> -- >8 --
> libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
> not defined.
>
> libstdc++-v3/ChangeLog:
>
> * src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
> * src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
> * src/filesystem/path.cc (path::_S_convert_loc): Likewise.
>
> Signed-off-by: Pekka Seppänen 
> ---
>  libstdc++-v3/src/c++11/cow-locale_init.cc | 5 +++--
>  libstdc++-v3/src/c++17/fs_path.cc | 2 +-
>  libstdc++-v3/src/filesystem/path.cc   | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc 
> b/libstdc++-v3/src/c++11/cow-locale_init.cc
> index 85277763427..f48561f5b12 100644
> --- a/libstdc++-v3/src/c++11/cow-locale_init.cc
> +++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
> @@ -137,8 +137,9 @@ namespace
>}
>
>void
> -  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
> -   const char* __s, const char* __smon)
> +  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void* clocm,
> +  const char* __s,
> +  [[maybe_unused]] const char* __smon)
>{
>  auto& __cloc = *static_cast<__c_locale*>(cloc);
>
> diff --git a/libstdc++-v3/src/c++17/fs_path.cc 
> b/libstdc++-v3/src/c++17/fs_path.cc
> index aaea7d2725d..d65b5482e8b 100644
> --- a/libstdc++-v3/src/c++17/fs_path.cc
> +++ b/libstdc++-v3/src/c++17/fs_path.cc
> @@ -1947,7 +1947,7 @@ path::_M_split_cmpts()
>
>  path::string_type
>  path::_S_convert_loc(const char* __first, const char* __last,
> -const std::locale& __loc)
> +[[maybe_unused]] const std::locale& __loc)
>  {
>  #if _GLIBCXX_USE_WCHAR_T
>auto& __cvt = std::use_facet>(__loc);
> diff --git a/libstdc++-v3/src/filesystem/path.cc 
> 

[committed] libstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a

2023-09-08 Thread Jonathan Wakely via Gcc-patches
This consolidates the three static archives for extensions into one, so
that -lstdc++exp can be used to provide the definitions of all unstable
library features.

The libstdc++_libbacktrace.a archive is now just a "noinst" convenience
library that is only used during the build, not installed. Its contents
are added to libstdc++exp.a, along with the new non-inline definitions
of std::stacktrace symbols.

The libstdc++fs.a archive is still installed, but its contents are
duplicated in libstdc++exp.a now. This means -lstdc++exp can be used
instead of -lstdc++fs. For targets using the GNU linker we should
consider replacing libstdc++fs.a with a linker script that does
INPUT(libstdc++exp.a).

The tests for  could be changed to use
-lstdc++exp instead of -lstdc++fs, which would allow removing
src/filesystem/.libs from the LDFLAGS in scripts/testsuite_flags.in,
but that can be done at a later date.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CONFIGURE): Add c++23 directory.
* configure: Regenerate.
* doc/html/manual/*: Regenerate.
* doc/xml/manual/using.xml: Update documentation on linking.
* include/std/stacktrace: Remove declarations of libbacktrace
APIs.
(stacktrace_entry::_S_err_handler, stacktrace_entry::_S_init):
Remove.
(stacktrace_entry::_Info): New class.
(stacktrace_entry::_M_get_info): Use _Info.
(__stacktrace_impl): New class.
(basic_stacktrace): Derive from __stacktrace_impl.
(basic_stacktrace::current): Use __stacktrace_impl::_S_current.
* scripts/testsuite_flags.in: Adjust LDFLAGS to find
libstdc++exp instead of libstdc++_libbacktrace.
* src/Makefile.am (SUBDIRS): Add c++23 directory.
* src/Makefile.in: Regenerate.
* src/c++20/Makefile.am: Fix comment.
* src/c++20/Makefile.in: Regenerate.
* src/c++23/Makefile.am: New file.
* src/c++23/Makefile.in: New file.
* src/c++23/stacktrace.cc: New file with definitions of
stacktrace_entry::_Info and __stacktrace_impl members.
* src/experimental/Makefile.am: Use LIBADD to include other
libraries.
* src/experimental/Makefile.in: Regenerate.
* src/libbacktrace/Makefile.am: Use noinst_LTLIBRARIES.
* src/libbacktrace/Makefile.in: Regenerate.
* testsuite/19_diagnostics/stacktrace/current.cc: Adjust
dg-options to use -lstdc++exp.
* testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
* testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
* testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc:
Likewise.
---
 libstdc++-v3/acinclude.m4 |   2 +-
 libstdc++-v3/configure|  16 +-
 libstdc++-v3/doc/html/manual/using.html   |  26 +-
 .../html/manual/using_dynamic_or_shared.html  |   4 +
 libstdc++-v3/doc/xml/manual/using.xml |  37 +-
 libstdc++-v3/include/std/stacktrace   | 144 +---
 libstdc++-v3/scripts/testsuite_flags.in   |   8 +-
 libstdc++-v3/src/Makefile.am  |   4 +-
 libstdc++-v3/src/Makefile.in  |   7 +-
 libstdc++-v3/src/c++20/Makefile.am|   2 +-
 libstdc++-v3/src/c++20/Makefile.in|   2 +-
 libstdc++-v3/src/c++23/Makefile.am| 109 +++
 libstdc++-v3/src/c++23/Makefile.in| 747 ++
 libstdc++-v3/src/c++23/stacktrace.cc  | 171 
 libstdc++-v3/src/experimental/Makefile.am |  20 +
 libstdc++-v3/src/experimental/Makefile.in |  15 +-
 libstdc++-v3/src/libbacktrace/Makefile.am |   3 +-
 libstdc++-v3/src/libbacktrace/Makefile.in |  88 +--
 .../19_diagnostics/stacktrace/current.cc  |   2 +-
 .../19_diagnostics/stacktrace/entry.cc|   2 +-
 .../19_diagnostics/stacktrace/stacktrace.cc   |   2 +-
 .../vector/debug/assign4_backtrace_neg.cc |   2 +-
 22 files changed, 1185 insertions(+), 228 deletions(-)
 create mode 100644 libstdc++-v3/src/c++23/Makefile.am
 create mode 100644 libstdc++-v3/src/c++23/Makefile.in
 create mode 100644 libstdc++-v3/src/c++23/stacktrace.cc

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index fcf79503265..34faa3c049f 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
   # Keep these sync'd with the list in Makefile.am.  The first provides an
   # expandable list at autoconf time; the second provides an expandable list
   # (i.e., shell variable) at configure time.
-  m4_define([glibcxx_SUBDIRS],[include libsupc++ src src/c++98 src/c++11 
src/c++17 src/c++20 src/filesystem src/libbacktrace src/experimental doc po 
testsuite python])
+  m4_define([glibcxx_SUBDIRS],[include libsupc++ src src/c++98 src/c++11 
src/c++17 src/c++20 src/c++23 src/filesystem src/libbacktrace src/experimental 
doc po testsuite python])
   SUBDIRS='glibcxx_SUBDIRS'
 
   # These need to be absolute 

Re: [PATCH] libstdc++: Reduce output of 'make check'

2023-09-08 Thread Jonathan Wakely via Gcc-patches
On Thu, 7 Sept 2023 at 14:32, Jonathan Wakely via Libstdc++
 wrote:
>
> Any objections to this change?

Pushed to trunk now.

>
> -- >8 --
>
> This removes the 39 lines of shell commands that get echoed when
> starting the testsuite. The fact that near the end of that output it
> prints `echo "WARNING: could not find \`runtest'" 1>&2; :;` makes it
> look like that warning is actually being shown the the user.
>
> Suppress echoing the recipe, so that users only see the actual output
> from the testsuite, not the makefile recipe as well.
>
> libstdc++-v3/ChangeLog:
>
> * testsuite/Makefile.am (check-DEJAGNU): Use @ in recipe.
> * testsuite/Makefile.in: Regenerate.
> ---
>  libstdc++-v3/testsuite/Makefile.am | 2 +-
>  libstdc++-v3/testsuite/Makefile.in | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/testsuite/Makefile.am 
> b/libstdc++-v3/testsuite/Makefile.am
> index 7adc5318192..4cee585fd8e 100644
> --- a/libstdc++-v3/testsuite/Makefile.am
> +++ b/libstdc++-v3/testsuite/Makefile.am
> @@ -117,7 +117,7 @@ $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: 
> normal%/site.exp
>
>  # Run the testsuite in normal mode.
>  check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
> -   $(if $*,@)AR="$(AR)"; export AR; \
> +   @$(if $*,@)AR="$(AR)"; export AR; \
> RANLIB="$(RANLIB)"; export RANLIB; \
> if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
>   rm -rf normal-parallel || true; \
>



Re: [PATCH] libbacktrace: Fix unconditional -Werror

2023-09-08 Thread Jonathan Wakely via Gcc-patches
On Fri, 8 Sept 2023 at 11:10, Jonathan Wakely  wrote:
>
> The patch looks good, thanks. I noticed the unconditional -Werror the other 
> day when testing a build on avr.
>
> N.B. All patches should go to gcc-patches (as well as a more specific list 
> like libstdc++ when appropriate).
>
> OK for trunk

I've pushed this now - thanks again.

>
>
>
> On Fri, 8 Sept 2023, 10:49 Alexey Lapshin via Libstdc++, 
>  wrote:
>>
>> Added to CC: jwak...@redhat.com, h...@axis.com
>>
>>
>> On Fri, 2023-09-08 at 12:39 +0400, Alexey Lapshin wrote:
>> > -Werror flag should depend on --enable-werror configure option
>> >
>> > ---
>> >  libstdc++-v3/src/libbacktrace/Makefile.am | 2 +-
>> >  libstdc++-v3/src/libbacktrace/Makefile.in | 2 +-
>> >  2 files changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/libstdc++-v3/src/libbacktrace/Makefile.am 
>> > b/libstdc++-v3/src/libbacktrace/Makefile.am
>> > index 9abf9dd64a1..27c1ea570e0 100644
>> > --- a/libstdc++-v3/src/libbacktrace/Makefile.am
>> > +++ b/libstdc++-v3/src/libbacktrace/Makefile.am
>> > @@ -45,7 +45,7 @@ libstdc___libbacktrace_la_CPPFLAGS = \
>> > $(BACKTRACE_CPPFLAGS)
>> >
>> >  WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
>> > --Wcast-qual -Werror
>> > +-Wcast-qual
>> >  C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes 
>> > -Wold-style-definition -Wno-unused-but-set-variable
>> >  CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
>> >  AM_CFLAGS = $(C_WARN_FLAGS)
>> > diff --git a/libstdc++-v3/src/libbacktrace/Makefile.in 
>> > b/libstdc++-v3/src/libbacktrace/Makefile.in
>> > index 1c1242d8827..b78c8443751 100644
>> > --- a/libstdc++-v3/src/libbacktrace/Makefile.in
>> > +++ b/libstdc++-v3/src/libbacktrace/Makefile.in
>> > @@ -368,7 +368,7 @@ VTV_CXXFLAGS = @VTV_CXXFLAGS@
>> >  VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@
>> >  VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@
>> >  WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
>> > --Wcast-qual -Werror
>> > +-Wcast-qual
>> >
>> >  XMLCATALOG = @XMLCATALOG@
>> >  XMLLINT = @XMLLINT@
>>



Re: [PATCH] libstdc++: Reduce output of 'make check'

2023-09-08 Thread Jonathan Wakely via Gcc-patches
in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
> > 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
> > 46 47 48 49 50 51
> > 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
> > 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
> > 98 99 100 101 102
> > 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
> > 120 121 122 123 124 125 126 127 128; do \
> >if [ -d normal$idx ]; then \
> >  mv -f normal$idx/libstdc++.sum normal$idx/libstdc++.sum.sep; \
> >  mv -f normal$idx/libstdc++.log normal$idx/libstdc++.log.sep; \
> >fi; \
> >  done; \
> >  /bin/sh 
> > /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/../../contrib/dg-extract-results.sh
> > \
> >normal[0-9]*/libstdc++.sum.sep > libstdc++.sum; \
> >  /bin/sh 
> > /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/../../contrib/dg-extract-results.sh
> > -L \
> >normal[0-9]*/libstdc++.log.sep > libstdc++.log; \
> >  exit 0; \
> > fi; \
> > srcdir=`CDPATH="${ZSH_VERSION+.}:" && cd
> > /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite && pwd`; export
> > srcdir; \
> > EXPECT=expect; export EXPECT; \
> > runtest=; \
> > if [ -z "$runtest" ]; then runtest=runtest; fi; \
> > tool=libstdc++; \
> > if [ -n "" ]; then \
> >  if [ -f normal-parallel/finished ]; then rm -rf ""; exit 0; fi; \
> >  GCC_RUNTEST_PARALLELIZE_DIR=`${PWDCMD-pwd}`/normal-parallel; \
> >  export GCC_RUNTEST_PARALLELIZE_DIR; \
> >  cd ""; \
> > fi; \
> > if /bin/sh -c "$runtest --version" > /dev/null 2>&1; then \
> >  $runtest  --tool $tool --srcdir $srcdir \
> >; \
> >  if [ -n "" ]; then \
> >touch $GCC_RUNTEST_PARALLELIZE_DIR/finished; \
> >  fi; \
> > else \
> >  echo "WARNING: could not find \`runtest'" 1>&2; :;\
> > fi
> > WARNING: Couldn't find the global config file.
> > dejagnu - timeout default set to 90s
> > Using /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/lib/libstdc++.exp
> > as tool init file.
> > Test run by jwakely on Fri Sep  8 11:27:44 2023
> > Native configuration is x86_64-pc-linux-gnu
> >
> >=== libstdc++ tests ===
> >
> >
> > Everything from the AR= line to the echo "WARNING" line and the "fi"
> > after it would be suppressed with this patch. I don't think making it
> > configurable (and default to still being printed) is useful.
> >
>
> You can change the default by sticking AM_SILENT_RULES([yes]) in
> configure.ac; see the "Silencing `make`" portion of the automake
> documentation:
> https://www.gnu.org/software/automake/manual/html_node/Automake-Silent-Rules.html

That doesn't address the fact that the output is never useful. I don't
want to suppress *all* build output for libstdc++, just those lines
above.

And if you try it you'll see --enable-silent-rules doesn't really help
much for libstdc++, as only half the rules are silenced. All the
libtool compile and libtool link lines are still printed in full, even
with V=0.

So more work would be needed, and it still wouldn't make those lines
from the testsuite useful to anybody, ever.


>
> >
> >
> > >
> > > On Thu, Sep 7, 2023 at 9:32 AM Jonathan Wakely via Gcc-patches
> > >  wrote:
> > > >
> > > > Any objections to this change?
> > > >
> > > > -- >8 --
> > > >
> > > > This removes the 39 lines of shell commands that get echoed when
> > > > starting the testsuite. The fact that near the end of that output it
> > > > prints `echo "WARNING: could not find \`runtest'" 1>&2; :;` makes it
> > > > look like that warning is actually being shown the the user.
> > > >
> > > > Suppress echoing the recipe, so that users only see the actual output
> > > > from the testsuite, not the makefile recipe as well.
> > > >
> > > > libstdc++-v3/ChangeLog:
> > > >
> > > > * testsuite/Makefile.am (check-DEJAGNU): Use @ in recipe.
> > > > * testsuite/Makefile.in: Regenerate.
> > > > ---
> > > >  libstdc++-v3/testsuite/Makefile.am | 2 +-
> > > >  libstdc++-v3/testsuite/Makefile.in | 2 +-
> > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/libstdc++-v3/testsuite/Makefile.am 
> > > > b/libstdc++-v3/testsuite/Makefile.am
> > > > index 7adc5318192..4cee585fd8e 100644
> > > > --- a/libstdc++-v3/testsuite/Makefile.am
> > > > +++ b/libstdc++-v3/testsuite/Makefile.am
> > > > @@ -117,7 +117,7 @@ $(check_DEJAGNU_normal_targets): 
> > > > check-DEJAGNUnormal%: normal%/site.exp
> > > >
> > > >  # Run the testsuite in normal mode.
> > > >  check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
> > > > -   $(if $*,@)AR="$(AR)"; export AR; \
> > > > +   @$(if $*,@)AR="$(AR)"; export AR; \
> > > > RANLIB="$(RANLIB)"; export RANLIB; \
> > > > if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
> > > >   rm -rf normal-parallel || true; \
> > > >
> > >
> >
>



Re: [PATCH] libstdc++: Reduce output of 'make check'

2023-09-08 Thread Jonathan Wakely via Gcc-patches
amp;& cd
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite && pwd`; export
srcdir; \
EXPECT=expect; export EXPECT; \
runtest=; \
if [ -z "$runtest" ]; then runtest=runtest; fi; \
tool=libstdc++; \
if [ -n "" ]; then \
 if [ -f normal-parallel/finished ]; then rm -rf ""; exit 0; fi; \
 GCC_RUNTEST_PARALLELIZE_DIR=`${PWDCMD-pwd}`/normal-parallel; \
 export GCC_RUNTEST_PARALLELIZE_DIR; \
 cd ""; \
fi; \
if /bin/sh -c "$runtest --version" > /dev/null 2>&1; then \
 $runtest  --tool $tool --srcdir $srcdir \
   ; \
 if [ -n "" ]; then \
   touch $GCC_RUNTEST_PARALLELIZE_DIR/finished; \
 fi; \
else \
 echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
WARNING: Couldn't find the global config file.
dejagnu - timeout default set to 90s
Using /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/lib/libstdc++.exp
as tool init file.
Test run by jwakely on Fri Sep  8 11:27:44 2023
Native configuration is x86_64-pc-linux-gnu

   === libstdc++ tests ===


Everything from the AR= line to the echo "WARNING" line and the "fi"
after it would be suppressed with this patch. I don't think making it
configurable (and default to still being printed) is useful.



>
> On Thu, Sep 7, 2023 at 9:32 AM Jonathan Wakely via Gcc-patches
>  wrote:
> >
> > Any objections to this change?
> >
> > -- >8 --
> >
> > This removes the 39 lines of shell commands that get echoed when
> > starting the testsuite. The fact that near the end of that output it
> > prints `echo "WARNING: could not find \`runtest'" 1>&2; :;` makes it
> > look like that warning is actually being shown the the user.
> >
> > Suppress echoing the recipe, so that users only see the actual output
> > from the testsuite, not the makefile recipe as well.
> >
> > libstdc++-v3/ChangeLog:
> >
> > * testsuite/Makefile.am (check-DEJAGNU): Use @ in recipe.
> > * testsuite/Makefile.in: Regenerate.
> > ---
> >  libstdc++-v3/testsuite/Makefile.am | 2 +-
> >  libstdc++-v3/testsuite/Makefile.in | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libstdc++-v3/testsuite/Makefile.am 
> > b/libstdc++-v3/testsuite/Makefile.am
> > index 7adc5318192..4cee585fd8e 100644
> > --- a/libstdc++-v3/testsuite/Makefile.am
> > +++ b/libstdc++-v3/testsuite/Makefile.am
> > @@ -117,7 +117,7 @@ $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: 
> > normal%/site.exp
> >
> >  # Run the testsuite in normal mode.
> >  check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
> > -   $(if $*,@)AR="$(AR)"; export AR; \
> > +   @$(if $*,@)AR="$(AR)"; export AR; \
> > RANLIB="$(RANLIB)"; export RANLIB; \
> > if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
> >   rm -rf normal-parallel || true; \
> >
>



Re: [PATCH] libbacktrace: Fix unconditional -Werror

2023-09-08 Thread Jonathan Wakely via Gcc-patches
The patch looks good, thanks. I noticed the unconditional -Werror the other
day when testing a build on avr.

N.B. All patches should go to gcc-patches (as well as a more specific list
like libstdc++ when appropriate).

OK for trunk



On Fri, 8 Sept 2023, 10:49 Alexey Lapshin via Libstdc++, <
libstd...@gcc.gnu.org> wrote:

> Added to CC: jwak...@redhat.com, h...@axis.com
>
>
> On Fri, 2023-09-08 at 12:39 +0400, Alexey Lapshin wrote:
> > -Werror flag should depend on --enable-werror configure option
> >
> > ---
> >  libstdc++-v3/src/libbacktrace/Makefile.am | 2 +-
> >  libstdc++-v3/src/libbacktrace/Makefile.in | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libstdc++-v3/src/libbacktrace/Makefile.am
> b/libstdc++-v3/src/libbacktrace/Makefile.am
> > index 9abf9dd64a1..27c1ea570e0 100644
> > --- a/libstdc++-v3/src/libbacktrace/Makefile.am
> > +++ b/libstdc++-v3/src/libbacktrace/Makefile.am
> > @@ -45,7 +45,7 @@ libstdc___libbacktrace_la_CPPFLAGS = \
> > $(BACKTRACE_CPPFLAGS)
> >
> >  WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
> > --Wcast-qual -Werror
> > +-Wcast-qual
> >  C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes
> -Wold-style-definition -Wno-unused-but-set-variable
> >  CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
> >  AM_CFLAGS = $(C_WARN_FLAGS)
> > diff --git a/libstdc++-v3/src/libbacktrace/Makefile.in
> b/libstdc++-v3/src/libbacktrace/Makefile.in
> > index 1c1242d8827..b78c8443751 100644
> > --- a/libstdc++-v3/src/libbacktrace/Makefile.in
> > +++ b/libstdc++-v3/src/libbacktrace/Makefile.in
> > @@ -368,7 +368,7 @@ VTV_CXXFLAGS = @VTV_CXXFLAGS@
> >  VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@
> >  VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@
> >  WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
> > --Wcast-qual -Werror
> > +-Wcast-qual
> >
> >  XMLCATALOG = @XMLCATALOG@
> >  XMLLINT = @XMLLINT@
>
>


Re: [PATCH 0/2] libstdc++: Documentation fixes.

2023-09-07 Thread Jonathan Wakely via Gcc-patches
On Mon, 21 Aug 2023 at 21:40, Jonathan Wakely  wrote:
>
>
>
> On Mon, 21 Aug 2023, 21:33 Bruno Victal,  wrote:
>>
>> This small patch-series fixes the 'doc-install-info' rule
>> and updates the URI used for docbook-xsl.
>
>
> Thanks! I'll get these committed tomorrow.

It took a little longer than that, but I've pushed them now - thanks again.


>
>
>>
>> Bruno Victal (2):
>>   libstdc++: Fix 'doc-install-info' rule.
>>   libstdc++: Update docbook xsl URI.
>>
>>  libstdc++-v3/acinclude.m4| 2 +-
>>  libstdc++-v3/doc/Makefile.am | 4 ++--
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>>
>> base-commit: f9ff6fa58217294d63f255dd02abfcc8a074f509
>> --
>> 2.40.1
>>


[committed] libstdc++: Simplify dejagnu target selector

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

A target selector allows multiple target triplets, it's not necessary to
use the || operator in a logical expression.

libstdc++-v3/ChangeLog:

* testsuite/27_io/filesystem/path/concat/94063.cc: Simplify
dg-do target selector.
---
 libstdc++-v3/testsuite/27_io/filesystem/path/concat/94063.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/concat/94063.cc 
b/libstdc++-v3/testsuite/27_io/filesystem/path/concat/94063.cc
index 50f34860550..a6894fc0254 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/concat/94063.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/concat/94063.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-do run { target { *-*-*mingw* || *-*-cygwin } } }
+// { dg-do run { target { *-*-*mingw* *-*-cygwin } } }
 // { dg-require-effective-target c++17 }
 
 #include 
-- 
2.41.0



[committed] libstdc++: Remove trailing whitespace from dejagnu files

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

Also fix the name of a source file used by an effective target check.

libstdc++-v3/ChangeLog:

* testsuite/config/default.exp: Remove trailing whitespace.
* testsuite/lib/dg-options.exp: Likewise.
* testsuite/lib/prune.exp: Likewise.
* testsuite/libstdc++-abi/abi.exp: Likewise.
* testsuite/libstdc++-dg/conformance.exp: Likewise.
* testsuite/libstdc++-prettyprinters/prettyprinters.exp:
Likewise.
* testsuite/libstdc++-xmethods/xmethods.exp: Likewise.
* testsuite/lib/libstdc++.exp: Likewise.
(check_v3_target_c_std): Fix filename for temporary source file.
---
 libstdc++-v3/testsuite/config/default.exp |  4 ++--
 libstdc++-v3/testsuite/lib/dg-options.exp |  4 ++--
 libstdc++-v3/testsuite/lib/libstdc++.exp  |  8 
 libstdc++-v3/testsuite/lib/prune.exp  |  4 ++--
 libstdc++-v3/testsuite/libstdc++-abi/abi.exp  |  6 +++---
 .../testsuite/libstdc++-dg/conformance.exp| 15 ---
 .../libstdc++-prettyprinters/prettyprinters.exp   |  4 ++--
 .../testsuite/libstdc++-xmethods/xmethods.exp |  4 ++--
 8 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/libstdc++-v3/testsuite/config/default.exp 
b/libstdc++-v3/testsuite/config/default.exp
index 6c5b57bd26f..a50f1dfe1ab 100644
--- a/libstdc++-v3/testsuite/config/default.exp
+++ b/libstdc++-v3/testsuite/config/default.exp
@@ -6,12 +6,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program 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 program; see the file COPYING3.  If not see
 # .
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp 
b/libstdc++-v3/testsuite/lib/dg-options.exp
index 15e34f8a646..7ee32fbbf71 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -6,12 +6,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program 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 program; see the file COPYING3.  If not see
 # .
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 9f3e896751a..271f8772caf 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -6,12 +6,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program 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 program; see the file COPYING3.  If not see
 # .
@@ -808,8 +808,8 @@ proc check_v3_target_c_std { } {
# Set up, compile, and execute a C++ test program that tries to use
# C99 functionality.
# For math bits, could use check_effective_target_c99_math.
-   set src fileio[pid].cc
-   set exe fileio[pid].x
+   set src c_std[pid].cc
+   set exe c_std[pid].x
 
set f [open $src "w"]
puts $f "#include "
diff --git a/libstdc++-v3/testsuite/lib/prune.exp 
b/libstdc++-v3/testsuite/lib/prune.exp
index be6d16c26e5..b4abb93294a 100644
--- a/libstdc++-v3/testsuite/lib/prune.exp
+++ b/libstdc++-v3/testsuite/lib/prune.exp
@@ -4,12 +4,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program 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 program; 

Re: [PATCH] libstdc++: Fix -Wunused-parameter warnings

2023-09-07 Thread Jonathan Wakely via Gcc-patches

On 29/08/23 15:04 +0300, Pekka Seppänen wrote:

libstdc++: Fix -Wunused-parameter warnings when _GLIBCXX_USE_WCHAR_T is
not defined.

libstdc++-v3/ChangeLog:

* src/c++11/cow-locale_init.cc: Add [[maybe_unused]] attribute.
* src/c++17/fs_path.cc (path::_S_convert_loc): Likewise.
* src/filesystem/path.cc (path::_S_convert_loc): Likewise.
---
 libstdc++-v3/src/c++11/cow-locale_init.cc | 4 ++--
 libstdc++-v3/src/c++17/fs_path.cc | 2 +-
 libstdc++-v3/src/filesystem/path.cc   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

mbstate_t>>(__loc);

diff --git a/libstdc++-v3/src/c++11/cow-locale_init.cc
b/libstdc++-v3/src/c++11/cow-locale_init.cc
index 85277763427..9554ed1ebf9 100644
--- a/libstdc++-v3/src/c++11/cow-locale_init.cc
+++ b/libstdc++-v3/src/c++11/cow-locale_init.cc
@@ -137,8 +137,8 @@ namespace
   }

   void
-  locale::_Impl::_M_init_extra(void* cloc, void* clocm,
-   const char* __s, const char* __smon)
+  locale::_Impl::_M_init_extra(void* cloc, [[maybe_unused]] void*
clocm,
+  const char* __s, [[maybe_unused]] const char* 
__smon)


This line should be split to keepo it below 80 columns.

Otherwise the patch looks good, but please CC the libstdc++ list for
libstdc++ patches. Otherwise I won't see them, and they won't be
reviewed.

Do you have a GCC copyright assignment on file? If not, please add a
sign-off to confirm you can submit this under the DCO terms:
https://gcc.gnu.org/dco.html



   {
 auto& __cloc = *static_cast<__c_locale*>(cloc);

diff --git a/libstdc++-v3/src/c++17/fs_path.cc
b/libstdc++-v3/src/c++17/fs_path.cc
index aaea7d2725d..d65b5482e8b 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -1947,7 +1947,7 @@ path::_M_split_cmpts()

 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-const std::locale& __loc)
+[[maybe_unused]] const std::locale& __loc)
 {
 #if _GLIBCXX_USE_WCHAR_T
   auto& __cvt = std::use_facet>(__loc);
diff --git a/libstdc++-v3/src/filesystem/path.cc
b/libstdc++-v3/src/filesystem/path.cc
index 4c218bdae49..d04ba6d465d 100644
--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -498,7 +498,7 @@ path::_M_trim()

 path::string_type
 path::_S_convert_loc(const char* __first, const char* __last,
-const std::locale& __loc)
+[[maybe_unused]] const std::locale& __loc)
 {
 #if _GLIBCXX_USE_WCHAR_T
   auto& __cvt = std::use_facet



Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-09-07 Thread Jonathan Wakely via Gcc-patches
On Fri, 18 Aug 2023 at 20:14, Paul M. Bendixen  wrote:
>
> Hi
> Jonathan, I just went over the proposal again as well as [compliance], which 
> Arsen mentioned ( https://wg21.link/compliance ) don't seem to mention either 
>  or .

Those headers were freestanding in C++17. They're not present in C++20
and C++23, but we support C++17 and earlier standards.

In GCC 12  and  were both installed when you
built the library with --disable-hosted-libstdcxx, so the fact they're
no longer installed for a freestanding build in GC 13 is a regression.
Please do include them.


>
> Shouldn't I just stick to the ones we know are in?
>
> (Still working on figuring out how to do the change log thing)
>
> Best regards
> Paul
>
> Den ons. 16. aug. 2023 kl. 18.50 skrev Paul M. Bendixen 
> :
>>
>> Yes, the other files are in another committee proposal, and I'm working my 
>> way through the proposals one by one.
>> Thank you for the feedback, I'll update and resend
>> /Paul
>>
>> Den ons. 16. aug. 2023 kl. 15.51 skrev Arsen Arsenović :
>>>
>>>
>>> Jonathan Wakely  writes:
>>>
>>> > On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++
>>> >  wrote:
>>> >>
>>> >> P1642 includes the header cstdarg to the freestanding implementation.
>>> >> This was probably left out by accident, this patch puts it in.
>>> >> Since this is one of the headers that go in whole cloth, there should be 
>>> >> no
>>> >> further actions needed.
>>> >
>>> > Thanks for the patch. I agree that  should be freestanding,
>>> > but I think  and  were also missed from the
>>> > change. Arsen?
>>>
>>> Indeed, we should include all three, and according to [compliance],
>>> there's a couple more headers that we should provide (cwchar, cstring,
>>> cerrno, and cmath, but these are probably significantly more involved,
>>> so we can handle them separately).
>>>
>>> As guessed, the omission was not intentional.
>>>
>>> If you could, add those two to the patch as well, edit Makefile.am and
>>> regenerate using automake 1.15.1, and see
>>> https://gcc.gnu.org/contribute.html wrt. changelogs in commit messages.
>>>
>>> Thank you!  Have a lovely day :-)
>>>
>>> [compliance]: https://eel.is/c++draft/compliance
>>>
>>> > Also, the patch should change include/Makefile.am as well (the .in
>>> > file is autogenerated from that one).
>>> >
>>> >
>>> >> This might be related to PR106953, but since that one touches the partial
>>> >> headers I'm not sure
>>>
>>> The headers mentioned in this PR are provided in freestanding,
>>> partially, in 13 already, indeed.
>>>
>>> >> /Paul M. Bendixen
>>> >>
>>> >> --
>>> >> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
>>> >> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
>>>
>>>
>>> --
>>> Arsen Arsenović
>>
>>
>>
>> --
>> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •− •/− 
>> − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//
>
>
>
> --
> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •− •/− 
> − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//



[committed] libstdc++: Add autoconf checks for mkdir, chmod, chdir, and getcwd

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Built on avr. Pushed to trunk.

-- >8 --

The filesystem code was using these functions without checking for their
existence, assuming that any UNIX-like libc with  would always
provide them. That's not true for some newlib targets like arm-eabi.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for mkdir,
chmod, chdir, and getcwd.
* config.h.in: Regenerate.
* configure: Regenerate.
* src/c++17/fs_ops.cc (create_dir): Use USE_MKDIR macro.
(fs::current_path): Use USE_GETCWD and USE_CHDIR macros.
(fs::permissions): Use USE_CHMOD macro.
* src/filesystem/ops-common.h [FILESYSTEM_IS_WINDOWS]
(chmod, mkdir, getcwd, chdir): Define new macros.
[FILESYSTEM_IS_WINDOWS] (chmod, mkdir, getcwd, chdir): Use
new macros.
* src/filesystem/ops.cc (create_dir): Use USE_MKDIR macro.
(fs::current_path): Use USE_GETCWD and USE_CHDIR macros.
(fs::permissions): Use USE_CHMOD macro.
---
 libstdc++-v3/acinclude.m4|  60 ++
 libstdc++-v3/config.h.in |  12 ++
 libstdc++-v3/configure   | 252 +++
 libstdc++-v3/src/c++17/fs_ops.cc |  12 +-
 libstdc++-v3/src/filesystem/ops-common.h |  18 +-
 libstdc++-v3/src/filesystem/ops.cc   |  10 +-
 6 files changed, 355 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 15b3d74ffb7..13159d6e95d 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -4997,6 +4997,66 @@ dnl
   if test $glibcxx_cv_dirent_d_type = yes; then
 AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a 
member of `struct dirent'.])
   fi
+dnl
+  AC_CACHE_CHECK([for chmod], glibcxx_cv_chmod, [dnl
+GCC_TRY_COMPILE_OR_LINK(
+  [
+   #include 
+  ],
+  [
+   int i = chmod("", S_IRUSR);
+  ],
+  [glibcxx_cv_chmod=yes],
+  [glibcxx_cv_chmod=no])
+  ])
+  if test $glibcxx_cv_chmod = yes; then
+AC_DEFINE(_GLIBCXX_USE_CHMOD, 1, [Define if usable chmod is available in 
.])
+  fi
+dnl
+  AC_CACHE_CHECK([for mkdir], glibcxx_cv_mkdir, [dnl
+GCC_TRY_COMPILE_OR_LINK(
+  [
+   #include 
+  ],
+  [
+   int i = mkdir("", S_IRUSR);
+  ],
+  [glibcxx_cv_mkdir=yes],
+  [glibcxx_cv_mkdir=no])
+  ])
+  if test $glibcxx_cv_mkdir = yes; then
+AC_DEFINE(_GLIBCXX_USE_MKDIR, 1, [Define if usable mkdir is available in 
.])
+  fi
+dnl
+  AC_CACHE_CHECK([for chdir], glibcxx_cv_chdir, [dnl
+GCC_TRY_COMPILE_OR_LINK(
+  [
+   #include 
+  ],
+  [
+   int i = chdir("");
+  ],
+  [glibcxx_cv_chdir=yes],
+  [glibcxx_cv_chdir=no])
+  ])
+  if test $glibcxx_cv_chdir = yes; then
+AC_DEFINE(_GLIBCXX_USE_CHDIR, 1, [Define if usable chdir is available in 
.])
+  fi
+dnl
+  AC_CACHE_CHECK([for getcwd], glibcxx_cv_getcwd, [dnl
+GCC_TRY_COMPILE_OR_LINK(
+  [
+   #include 
+  ],
+  [
+   char* s = getcwd((char*)0, 1);
+  ],
+  [glibcxx_cv_getcwd=yes],
+  [glibcxx_cv_getcwd=no])
+  ])
+  if test $glibcxx_cv_getcwd = yes; then
+AC_DEFINE(_GLIBCXX_USE_GETCWD, 1, [Define if usable getcwd is available in 
.])
+  fi
 dnl
   AC_CACHE_CHECK([for realpath], glibcxx_cv_realpath, [dnl
 GCC_TRY_COMPILE_OR_LINK(
diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc
index 6cdeac17c33..241db68bd18 100644
--- a/libstdc++-v3/src/c++17/fs_ops.cc
+++ b/libstdc++-v3/src/c++17/fs_ops.cc
@@ -577,7 +577,7 @@ namespace
   create_dir(const fs::path& p, fs::perms perm, std::error_code& ec)
   {
 bool created = false;
-#ifdef _GLIBCXX_HAVE_SYS_STAT_H
+#if _GLIBCXX_USE_MKDIR
 posix::mode_t mode = static_cast>(perm);
 if (posix::mkdir(p.c_str(), mode))
   {
@@ -735,7 +735,7 @@ fs::path
 fs::current_path(error_code& ec)
 {
   path p;
-#if defined _GLIBCXX_HAVE_UNISTD_H && ! defined __AVR__
+#if _GLIBCXX_USE_GETCWD
 #if defined __GLIBC__ || defined _GLIBCXX_FILESYSTEM_IS_WINDOWS
   if (char_ptr cwd = char_ptr{posix::getcwd(nullptr, 0)})
 {
@@ -783,7 +783,7 @@ fs::current_path(error_code& ec)
}
 }
 #endif  // __GLIBC__
-#else   // _GLIBCXX_HAVE_UNISTD_H
+#else   // _GLIBCXX_USE_GETCWD
   ec = std::make_error_code(std::errc::function_not_supported);
 #endif
   return p;
@@ -801,7 +801,7 @@ fs::current_path(const path& p)
 void
 fs::current_path(const path& p, error_code& ec) noexcept
 {
-#ifdef _GLIBCXX_HAVE_UNISTD_H
+#if _GLIBCXX_USE_CHDIR
   if (posix::chdir(p.c_str()))
 ec.assign(errno, std::generic_category());
   else
@@ -1097,6 +1097,7 @@ void
 fs::permissions(const path& p, perms prms, perm_options opts,
error_code& ec) noexcept
 {
+#if _GLIBCXX_USE_FCHMODAT || _GLIBCXX_USE_CHMOD
   const bool replace = is_set(opts, perm_options::replace);
   const bool add = is_set(opts, perm_options::add);
   const bool remove = is_set(opts, 

[committed] libstdc++: Disable support by default for avr

2023-09-07 Thread Jonathan Wakely via Gcc-patches
libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Disable by default
for avr.
* configure: Regenerate.
---
 libstdc++-v3/acinclude.m4 | 5 -
 libstdc++-v3/configure| 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index b7210e09d89..15b3d74ffb7 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5481,7 +5481,10 @@ BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS 
-DBACKTRACE_ELF_SIZE=$elfsize"
 
   AC_MSG_CHECKING([whether to build libbacktrace support])
   if test "$enable_libstdcxx_backtrace" = "auto"; then
-enable_libstdcxx_backtrace="$is_hosted"
+case "$host" in
+  avr-*-*) enable_libstdcxx_backtrace=no ;;
+  *) enable_libstdcxx_backtrace="$is_hosted" ;;
+esac
   fi
   AC_MSG_RESULT($enable_libstdcxx_backtrace)
   if test "$enable_libstdcxx_backtrace" = "yes"; then



[PATCH] libstdc++: Reduce output of 'make check'

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Any objections to this change?

-- >8 --

This removes the 39 lines of shell commands that get echoed when
starting the testsuite. The fact that near the end of that output it
prints `echo "WARNING: could not find \`runtest'" 1>&2; :;` makes it
look like that warning is actually being shown the the user.

Suppress echoing the recipe, so that users only see the actual output
from the testsuite, not the makefile recipe as well.

libstdc++-v3/ChangeLog:

* testsuite/Makefile.am (check-DEJAGNU): Use @ in recipe.
* testsuite/Makefile.in: Regenerate.
---
 libstdc++-v3/testsuite/Makefile.am | 2 +-
 libstdc++-v3/testsuite/Makefile.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/Makefile.am 
b/libstdc++-v3/testsuite/Makefile.am
index 7adc5318192..4cee585fd8e 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -117,7 +117,7 @@ $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: 
normal%/site.exp
 
 # Run the testsuite in normal mode.
 check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
-   $(if $*,@)AR="$(AR)"; export AR; \
+   @$(if $*,@)AR="$(AR)"; export AR; \
RANLIB="$(RANLIB)"; export RANLIB; \
if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
  rm -rf normal-parallel || true; \



[committed] libstdc++: Fix tests that fail in C++23

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

The tests for the std::ranges access CPOs (ranges::begin etc) use
pathological types with ridiculous overload sets for begin/end/data
members, to exercise all the corner cases in the specification.

Since P2278R4 "cbegin should always return a constant iterator" was
implemented for C++23 mode, some of the range access CPOs now require
the argument to satisfy the range concept, which was not previously
required. The behaviour of the CPO also changes for corner cases where
the type is a range R for which constant_range is satisfied in
addition to constant_range (meaning there's no need to wrap its
iterators in const_iterator). Adjust the expected results for those
pathological types that changed meaning in C++23, and add some new types
to verify other corner cases.

Some other range adaptor tests fail for C++20 because they assert that
ranges::end and ranges::cend return different types, which is not true
when the type satisfies constant_range.

This fixes the tests to PASS for both C++20 and C++23 (and later).

libstdc++-v3/ChangeLog:

* testsuite/std/ranges/access/cbegin.cc: Adjust for C++23
compatibility.
* testsuite/std/ranges/access/cdata.cc: Likewise.
* testsuite/std/ranges/access/cend.cc: Likewise.
* testsuite/std/ranges/access/crbegin.cc: Likewise.
* testsuite/std/ranges/access/crend.cc: Likewise.
* testsuite/std/ranges/adaptors/take.cc: Likewise.
* testsuite/std/ranges/adaptors/take_while.cc: Likewise.
* testsuite/std/ranges/adaptors/transform.cc: Likewise.
---
 .../testsuite/std/ranges/access/cbegin.cc | 13 ++
 .../testsuite/std/ranges/access/cdata.cc  | 38 +-
 .../testsuite/std/ranges/access/cend.cc   | 29 +-
 .../testsuite/std/ranges/access/crbegin.cc| 40 ++-
 .../testsuite/std/ranges/access/crend.cc  | 33 ++-
 .../testsuite/std/ranges/adaptors/take.cc |  2 +
 .../std/ranges/adaptors/take_while.cc |  2 +
 .../std/ranges/adaptors/transform.cc  |  4 ++
 8 files changed, 154 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc 
b/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc
index 10376040c16..3667b0d021f 100644
--- a/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc
+++ b/libstdc++-v3/testsuite/std/ranges/access/cbegin.cc
@@ -48,6 +48,10 @@ struct R
   friend int* begin(R&&); // this function is not defined
   friend const int* begin(const R& r) noexcept { return r.a + 2; }
   friend const int* begin(const R&&); // this function is not defined
+
+#if __cpp_lib_ranges_as_const
+  friend const int* end(const R&) noexcept; // C++23 requires this.
+#endif
 };
 
 struct RV // view on an R
@@ -56,6 +60,10 @@ struct RV // view on an R
 
   friend int* begin(RV&); // this function is not defined
   friend const int* begin(const RV& rv) noexcept { return 
begin(std::as_const(rv.r)); }
+
+#if __cpp_lib_ranges_as_const
+  friend const int* end(const RV&) noexcept; // C++23 requires this.
+#endif
 };
 
 // Allow ranges::begin to work with RV&&
@@ -88,6 +96,11 @@ struct RR
   friend int* begin(RR&& r) { return r.a + 1; }
   friend const int* begin(const RR& r) { return r.a + 2; }
   friend const int* begin(const RR&& r) noexcept { return r.a + 3; }
+
+#if __cpp_lib_ranges_as_const
+  short* end() noexcept { return  + 1; }   // C++23 requires this.
+  const long* end() const { return  + 1; } // C++23 requires this.
+#endif
 };
 
 // N.B. this is a lie, cbegin on an RR rvalue will return a dangling pointer.
diff --git a/libstdc++-v3/testsuite/std/ranges/access/cdata.cc 
b/libstdc++-v3/testsuite/std/ranges/access/cdata.cc
index f0f45eeb6bf..d69b04c8f74 100644
--- a/libstdc++-v3/testsuite/std/ranges/access/cdata.cc
+++ b/libstdc++-v3/testsuite/std/ranges/access/cdata.cc
@@ -41,15 +41,43 @@ test01()
   static_assert( has_cdata );
   static_assert( has_cdata );
   R r;
-  const R& c = r;
+#if ! __cpp_lib_ranges_as_const
   VERIFY( std::ranges::cdata(r) == (R*)nullptr );
   static_assert( noexcept(std::ranges::cdata(r)) );
+#else
+  // constant_range is not satisfied, so cdata(r) == data(r).
+  VERIFY( std::ranges::cdata(r) ==  );
+  static_assert( ! noexcept(std::ranges::cdata(r)) );
+#endif
+  const R& c = r;
   VERIFY( std::ranges::cdata(c) == (R*)nullptr );
   static_assert( noexcept(std::ranges::cdata(c)) );
 
   // not lvalues and not borrowed ranges
   static_assert( !has_cdata );
   static_assert( !has_cdata );
+
+  struct R2
+  {
+// These overloads mean that range and range are satisfied.
+int* begin();
+int* end();
+const int* begin() const;
+const int* end() const;
+
+int i = 0;
+int j = 0;
+int* data() { return  }
+const R2* data() const noexcept { return nullptr; }
+  };
+  static_assert( has_cdata );
+  static_assert( has_cdata );
+  R2 r2;
+  VERIFY( std::ranges::cdata(r2) == (R2*)nullptr );
+  

[committed] libstdc++: Fix missing/misplaced { dg-options "-std=gnu++20" } in tests

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

These tests do not run by default, because the c++20 effective target
selector isn't matched.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/unordered_map/operations/1.cc: Add
dg-options for C++20 mode.
* testsuite/23_containers/unordered_multimap/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/operations/1.cc:
Likewise.
* testsuite/23_containers/unordered_set/operations/1.cc:
Likewise.
* testsuite/std/time/parse.cc: Move dg-options before dg-do.
---
 .../testsuite/23_containers/unordered_map/operations/1.cc   | 1 +
 .../testsuite/23_containers/unordered_multimap/operations/1.cc  | 1 +
 .../testsuite/23_containers/unordered_multiset/operations/1.cc  | 1 +
 .../testsuite/23_containers/unordered_set/operations/1.cc   | 1 +
 libstdc++-v3/testsuite/std/time/parse.cc| 2 +-
 5 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc 
b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc
index cfeca606c55..835f845621b 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/operations/1.cc
@@ -15,6 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
+// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git 
a/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/1.cc 
b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/1.cc
index 7e3867f345b..988a66695ef 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/operations/1.cc
@@ -15,6 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
+// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git 
a/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/1.cc 
b/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/1.cc
index 7db4d129c52..91b0f87cab8 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/operations/1.cc
@@ -15,6 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
+// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc 
b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc
index b2f13990b56..dea21df7bcb 100644
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/operations/1.cc
@@ -15,6 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
+// { dg-options "-std=gnu++20" }
 // { dg-do run { target c++20 } }
 
 #include 
diff --git a/libstdc++-v3/testsuite/std/time/parse.cc 
b/libstdc++-v3/testsuite/std/time/parse.cc
index 86222d59596..0ef56cf1cfa 100644
--- a/libstdc++-v3/testsuite/std/time/parse.cc
+++ b/libstdc++-v3/testsuite/std/time/parse.cc
@@ -1,5 +1,5 @@
-// { dg-do run { target c++20 } }
 // { dg-options "-std=gnu++20" }
+// { dg-do run { target c++20 } }
 
 #include 
 #include 
-- 
2.41.0



[committed] libstdc++: Simplify C++20 poison pill overloads (P2602R2)

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

This implements the C++23 change "Poison Pills are Too Toxic". This
makes sense to do unconditionally for C++20, as the corner cases that it
fixes are considered to be defects in the C++20 design (e.g. LWG3480 was
needed to fix directory iterators because of these pills being too
toxic).

libstdc++-v3/ChangeLog:

* include/bits/iterator_concepts.h (__imove::iter_move): Define
poison pill as deleted for consistency.
(__access::begin): Replace with a single declaration.
* include/bits/ranges_base.h (__access::end, __access::rbegin)
(__access::rend, __access::size): Likewise.
* include/bits/version.def (ranges): Update value for C++23.
* include/bits/version.h: Regenerate.
* libsupc++/compare (__compare): Add missing poison pill
overloads.
* testsuite/std/ranges/version_c++23.cc: Adjust expected value
of __cpp_lib_ranges.
* testsuite/std/ranges/access/p2602.cc: New test.
---
 libstdc++-v3/include/bits/iterator_concepts.h |  7 ++---
 libstdc++-v3/include/bits/ranges_base.h   | 14 +++--
 libstdc++-v3/include/bits/version.def |  2 +-
 libstdc++-v3/include/bits/version.h   |  4 +--
 libstdc++-v3/libsupc++/compare|  6 
 .../testsuite/std/ranges/access/p2602.cc  | 31 +++
 .../testsuite/std/ranges/version_c++23.cc |  2 +-
 7 files changed, 49 insertions(+), 17 deletions(-)
 create mode 100644 libstdc++-v3/testsuite/std/ranges/access/p2602.cc

diff --git a/libstdc++-v3/include/bits/iterator_concepts.h 
b/libstdc++-v3/include/bits/iterator_concepts.h
index 869d52e378b..3517663db9a 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -100,7 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 /// @cond undocumented
 namespace __imove
 {
-  void iter_move();
+  void iter_move() = delete;
 
   template
concept __adl_imove
@@ -979,9 +979,8 @@ namespace ranges
  { __decay_copy(__t.begin()) } -> input_or_output_iterator;
};
 
-// Poison pills so that unqualified lookup doesn't find std::begin.
-void begin(auto&) = delete;
-void begin(const auto&) = delete;
+// Poison pill so that unqualified lookup doesn't find std::begin.
+void begin() = delete;
 
 template
   concept __adl_begin = __class_or_enum>
diff --git a/libstdc++-v3/include/bits/ranges_base.h 
b/libstdc++-v3/include/bits/ranges_base.h
index 35861755c0b..7fa43d1965a 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -133,9 +133,8 @@ namespace ranges
  { __decay_copy(__t.end()) } -> sentinel_for<__range_iter_t<_Tp>>;
};
 
-// Poison pills so that unqualified lookup doesn't find std::end.
-void end(auto&) = delete;
-void end(const auto&) = delete;
+// Poison pill so that unqualified lookup doesn't find std::end.
+void end() = delete;
 
 template
   concept __adl_end = __class_or_enum>
@@ -184,8 +183,7 @@ namespace ranges
  { __decay_copy(__t.rbegin()) } -> input_or_output_iterator;
};
 
-void rbegin(auto&) = delete;
-void rbegin(const auto&) = delete;
+void rbegin() = delete;
 
 template
   concept __adl_rbegin = __class_or_enum>
@@ -248,8 +246,7 @@ namespace ranges
-> sentinel_for(__t)))>;
};
 
-void rend(auto&) = delete;
-void rend(const auto&) = delete;
+void rend() = delete;
 
 template
   concept __adl_rend = __class_or_enum>
@@ -306,8 +303,7 @@ namespace ranges
  { __decay_copy(__t.size()) } -> __detail::__is_integer_like;
};
 
-void size(auto&) = delete;
-void size(const auto&) = delete;
+void size() = delete;
 
 template
   concept __adl_size = __class_or_enum>
diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index 44b916e3897..da8d067dd1a 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1045,7 +1045,7 @@ ftms = {
 ftms = {
   name = ranges;
   values = {
-v = 202207;
+v = 202211;
 cxxmin = 23;
 extra_cond = "__glibcxx_concepts";
   };
diff --git a/libstdc++-v3/include/bits/version.h 
b/libstdc++-v3/include/bits/version.h
index 9fada98eee3..22cc21119c5 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -1290,9 +1290,9 @@
 // from version.def line 1046
 #if !defined(__cpp_lib_ranges)
 # if (__cplusplus >= 202302L) && (__glibcxx_concepts)
-#  define __glibcxx_ranges 202207L
+#  define __glibcxx_ranges 202211L
 #  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)
-#   define __cpp_lib_ranges 202207L
+#   define __cpp_lib_ranges 202211L
 #  endif
 # elif (__cplusplus >= 202002L) && (__glibcxx_concepts)
 #  define __glibcxx_ranges 202110L
diff --git 

[committed] libstdc++: Avoid -Wunused-parameter warning in testsuite helper

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_iterators.h (is_customization_point_object):
Remove parameter name.
---
 libstdc++-v3/testsuite/util/testsuite_iterators.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h 
b/libstdc++-v3/testsuite/util/testsuite_iterators.h
index 55045e48d56..d296a2cf18c 100644
--- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
+++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
@@ -916,7 +916,7 @@ namespace __gnu_test
   // Test for basic properties of C++20 16.3.3.6 [customization.point.object].
   template
 constexpr bool
-is_customization_point_object(T& obj) noexcept
+is_customization_point_object(T&) noexcept
 {
   // A [CPO] is a function object with a literal class type.
   static_assert( std::is_class_v || std::is_union_v );
-- 
2.41.0



[committed] libstdc++: Rename C++20 Customization Point Objects

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

This makes the naming of the CPO types and namespaces simpler and more
consistent. With this change the string "cust" won't appear in
diagnostics related to these CPOs, which avoids confusion about what it
means (customization? customer?). Users don't really need to care that
these are called "customization point objects", so don't show them the
string "cust". Names like "__imove::_IterMove" are preferable to names
like "__cust_imove::_IMove" as the former is more obviously related to
the public API "ranges::iter_move".

Instead of a plethora of inline namespaces for all the different CPO
objects, define them all in an inline namespace called _Cpo (which isn't
shown to users anyway, unlike the types of those objects).

libstdc++-v3/ChangeLog:

* include/bits/iterator_concepts.h (ranges::__cust_imove):
Rename to ranges::__imove.
(_IMove): Rename to _IterMove.
(ranges::__cust_iswap): Rename to ranges::__iswap.
(ranges::__cust): Rename to ranges::_Cpo.
(ranges::__cust_access): Rename to ranges::__access.
* include/bits/ranges_base.h (ranges::__cust_access): Rename to
ranges::__access.
(ranges::__cust): Rename to ranges::_Cpo.
* include/std/concepts (ranges::__cust_swap):  Rename to
ranges::__swap.
(ranges::__cust): Rename to ranges::_Cpo.
* libsupc++/compare (__cmp_cust): Rename to __compare.
(__cmp_algo): Rename to _Cpo.
---
 libstdc++-v3/include/bits/iterator_concepts.h |  46 
 libstdc++-v3/include/bits/ranges_base.h   | 100 +-
 libstdc++-v3/include/std/concepts |  13 +--
 libstdc++-v3/libsupc++/compare|  31 +++---
 4 files changed, 98 insertions(+), 92 deletions(-)

diff --git a/libstdc++-v3/include/bits/iterator_concepts.h 
b/libstdc++-v3/include/bits/iterator_concepts.h
index e32e94dc9fc..869d52e378b 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -97,7 +97,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   namespace ranges
   {
-namespace __cust_imove
+/// @cond undocumented
+namespace __imove
 {
   void iter_move();
 
@@ -106,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  = (std::__detail::__class_or_enum>)
  && requires(_Tp&& __t) { iter_move(static_cast<_Tp&&>(__t)); };
 
-  struct _IMove
+  struct _IterMove
   {
   private:
template
@@ -153,19 +154,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  return *__e;
  }
   };
-} // namespace __cust_imove
+} // namespace __imove
+/// @endcond
 
-inline namespace __cust
-{
-  inline constexpr __cust_imove::_IMove iter_move{};
-} // inline namespace __cust
+inline namespace _Cpo {
+  inline constexpr __imove::_IterMove iter_move{};
+}
   } // namespace ranges
 
   template<__detail::__dereferenceable _Tp>
-requires __detail::
-  __can_reference>
-using iter_rvalue_reference_t
-  = ranges::__cust_imove::_IMove::__type<_Tp&>;
+requires 
__detail::__can_reference>
+using iter_rvalue_reference_t = ranges::__imove::_IterMove::__type<_Tp&>;
 
   template struct incrementable_traits { };
 
@@ -832,7 +831,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 namespace ranges
 {
-  namespace __cust_iswap
+  /// @cond undocumented
+  namespace __iswap
   {
 template
   void iter_swap(_It1, _It2) = delete;
@@ -873,8 +873,8 @@ namespace ranges
 *std::declval<_Up>()));
  else
return noexcept(*std::declval<_Tp>()
-   = __iter_exchange_move(std::declval<_Up>(),
-  std::declval<_Tp>()));
+   = __iswap::__iter_exchange_move(std::declval<_Up>(),
+   std::declval<_Tp>()));
}
 
 public:
@@ -896,15 +896,15 @@ namespace ranges
  && swappable_with, iter_reference_t<_Up>>)
ranges::swap(*__e1, *__e2);
  else
-   *__e1 = __iter_exchange_move(__e2, __e1);
+   *__e1 = __iswap::__iter_exchange_move(__e2, __e1);
}
 };
-  } // namespace __cust_iswap
+  } // namespace __iswap
+  /// @endcond
 
-  inline namespace __cust
-  {
-inline constexpr __cust_iswap::_IterSwap iter_swap{};
-  } // inline namespace __cust
+  inline namespace _Cpo {
+inline constexpr __iswap::_IterSwap iter_swap{};
+  }
 
 } // namespace ranges
 
@@ -960,7 +960,7 @@ namespace ranges
   inline constexpr unreachable_sentinel_t unreachable_sentinel{};
 
   // This is the namespace for [range.access] CPOs.
-  namespace ranges::__cust_access
+  namespace ranges::__access
   {
 using std::__detail::__class_or_enum;
 
@@ -1004,14 +1004,14 @@ namespace ranges
else
  return begin(__t);
   }
-  } // namespace ranges::__cust_access
+  } // namespace 

[committed] libstdc++: Relax range adaptors for move-only types (P2494R2)

2023-09-07 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

This is a C++23 feature that relaxes the constraints on some range
adaptors, to support move-only types.

libstdc++-v3/ChangeLog:

* include/bits/version.def (ranges): Update value.
* include/bits/version.h: Regenerate.
* include/std/ranges (__detail::__boxable): Use
move_constructible instead of copy_constructible for C++23.
(__detail::__box): Adjust constraints for partial
specialization.
(single_view, transform_view): Use __box_constructible instead
of copy_constructible in constraints.
(zip_transform_view, adjacent_transform_view, repeat_view): Use
move_constructible instead of copy_constructible in constraints.
* testsuite/std/ranges/adaptors/adjacent_transform/1.cc: Check
construction from move-only argument.
* testsuite/std/ranges/adaptors/transform.cc: Likewise.
* testsuite/std/ranges/repeat/1.cc: Likewise.
* testsuite/std/ranges/single_view.cc: Likewise.
* testsuite/std/ranges/zip_transform/1.cc: Likewise.
* testsuite/std/ranges/version_c++23.cc: Adjust expected value
of __cpp_lib_ranges.
---
 libstdc++-v3/include/bits/version.def |  2 +-
 libstdc++-v3/include/bits/version.h   |  4 +-
 libstdc++-v3/include/std/ranges   | 72 +--
 .../ranges/adaptors/adjacent_transform/1.cc   | 14 
 .../std/ranges/adaptors/transform.cc  | 19 +
 libstdc++-v3/testsuite/std/ranges/repeat/1.cc | 12 
 .../testsuite/std/ranges/single_view.cc   | 17 +
 .../testsuite/std/ranges/version_c++23.cc |  2 +-
 .../testsuite/std/ranges/zip_transform/1.cc   | 14 
 9 files changed, 131 insertions(+), 25 deletions(-)

diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
index 80c13d4a447..44b916e3897 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -1045,7 +1045,7 @@ ftms = {
 ftms = {
   name = ranges;
   values = {
-v = 202202;
+v = 202207;
 cxxmin = 23;
 extra_cond = "__glibcxx_concepts";
   };
diff --git a/libstdc++-v3/include/bits/version.h 
b/libstdc++-v3/include/bits/version.h
index 5bddb4b8adc..9fada98eee3 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -1290,9 +1290,9 @@
 // from version.def line 1046
 #if !defined(__cpp_lib_ranges)
 # if (__cplusplus >= 202302L) && (__glibcxx_concepts)
-#  define __glibcxx_ranges 202202L
+#  define __glibcxx_ranges 202207L
 #  if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges)
-#   define __cpp_lib_ranges 202202L
+#   define __cpp_lib_ranges 202207L
 #  endif
 # elif (__cplusplus >= 202002L) && (__glibcxx_concepts)
 #  define __glibcxx_ranges 202110L
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 3477323d871..1d529a886be 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -106,8 +106,14 @@ namespace ranges
 
   namespace __detail
   {
+#if __cpp_lib_ranges >= 202207L // C++ >= 23
+// P2494R2 Relaxing range adaptors to allow for move only types
+template
+  concept __boxable = move_constructible<_Tp> && is_object_v<_Tp>;
+#else
 template
   concept __boxable = copy_constructible<_Tp> && is_object_v<_Tp>;
+#endif
 
 template<__boxable _Tp>
   struct __box : std::optional<_Tp>
@@ -132,7 +138,7 @@ namespace ranges
constexpr __box&
operator=(const __box& __that)
noexcept(is_nothrow_copy_constructible_v<_Tp>)
-   requires (!copyable<_Tp>)
+   requires (!copyable<_Tp>) && copy_constructible<_Tp>
{
  if (this != std::__addressof(__that))
{
@@ -160,13 +166,22 @@ namespace ranges
}
   };
 
-// For types which are already copyable, this specialization of the
-// copyable wrapper stores the object directly without going through
-// std::optional.  It provides just the subset of the primary template's
-// API that we currently use.
+template
+  concept __boxable_copyable
+   = copy_constructible<_Tp>
+   && (copyable<_Tp> || (is_nothrow_move_constructible_v<_Tp>
+   && is_nothrow_copy_constructible_v<_Tp>));
+template
+  concept __boxable_movable
+   = (!copy_constructible<_Tp>)
+   && (movable<_Tp> || is_nothrow_move_constructible_v<_Tp>);
+
+// For types which are already copyable (or since C++23, movable)
+// this specialization of the box wrapper stores the object directly
+// without going through std::optional.  It provides just the subset of
+// the primary template's API that we currently use.
 template<__boxable _Tp>
-  requires copyable<_Tp> || (is_nothrow_move_constructible_v<_Tp>
-&& is_nothrow_copy_constructible_v<_Tp>)
+  requires 

Re: [RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-09-06 Thread Jonathan Wakely via Gcc-patches
On Thu, 7 Sept 2023 at 00:10, Jonathan Wakely  wrote:
>
> On Thu, 7 Sept 2023 at 00:09, Hans-Peter Nilsson  wrote:
> >
> > > From: Jonathan Wakely 
> > > Date: Wed, 6 Sep 2023 23:30:08 +0100
> >
> > > On Mon, 4 Sept 2023 at 17:49, Jonathan Wakely  
> > > wrote:
> > > >
> > > > On Mon, 4 Sept 2023 at 17:47, Hans-Peter Nilsson via Libstdc++
> > > >  wrote:
> > > > >
> > > > > > Date: Fri, 1 Sep 2023 12:16:40 +0100
> > > > > > Reply-To: Jonathan Wakely 
> > > > > >
> > > > > > On Wed, 23 Aug 2023 at 17:03, Jonathan Wakely via Libstdc++
> > > > > >  wrote:
> > > > > > >
> > > > > > > Any objections to this? It's a C++23 feture, so should be enabled 
> > > > > > > by
> > > > > > > default.
> > > > > >
> > > > > > I've pushed this to trunk, so let's see what breaks!
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > -- >8 --
> > > > > > >
> > > > > > > This causes libstdc++_libbacktrace.a to be built by default. This 
> > > > > > > might
> > > > > > > fail on some targets, in which case we can make the 'auto' choice 
> > > > > > > expand
> > > > > > > to either 'yes' or 'no' depending on the target.
> > > > > > >
> > > > > > > libstdc++-v3/ChangeLog:
> > > > > > >
> > > > > > > * acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Default to yes.
> > > > > > > * configure: Regenerate.
> > > > >
> > > > > Incidentally, should check_effective_target_stacktrace in
> > > > > libstdc++.exp also be adjusted to match; removing the
> > > > > _GLIBCXX_HOSTED condition?
> > > >
> > > > No, it should still depend on is_hosted. The acinclude.m4 macro should
> > > > check that.
> > >
> > > Done in r14-3761-g6de5f5a4fe85bd
> >
> > Aha, that's what you meant.  I thought you meant that just
> > check_effective_target_stacktrace should be gated on
> > $is_hosted.
> >
> > Yeah, it makes sense not to have backtrace enabled by
> > default for ! $is_hosted.  On the other hand, bare-iron
> > targets like cris-elf apparently *are* hosted, according to
> > "#if __STDC_HOSTED__".  I guess I'll have to dig into what
> > the definition of "hosted" is, because I don't agree by the
> > layman obvious definition.  Maybe there's a bug to fix.
>
> I don't think there's a bug. $is_hosted is true for
> --enable-hosted-libstdcxx which is on by default.

And IIRC __STDC_HOSTED__ is defined unless you compile with -ffreestanding.


>
> > There sure are many yaks to shave these days.
> >
> > brgds, H-P
> >



Re: [RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-09-06 Thread Jonathan Wakely via Gcc-patches
On Thu, 7 Sept 2023 at 00:09, Hans-Peter Nilsson  wrote:
>
> > From: Jonathan Wakely 
> > Date: Wed, 6 Sep 2023 23:30:08 +0100
>
> > On Mon, 4 Sept 2023 at 17:49, Jonathan Wakely  wrote:
> > >
> > > On Mon, 4 Sept 2023 at 17:47, Hans-Peter Nilsson via Libstdc++
> > >  wrote:
> > > >
> > > > > Date: Fri, 1 Sep 2023 12:16:40 +0100
> > > > > Reply-To: Jonathan Wakely 
> > > > >
> > > > > On Wed, 23 Aug 2023 at 17:03, Jonathan Wakely via Libstdc++
> > > > >  wrote:
> > > > > >
> > > > > > Any objections to this? It's a C++23 feture, so should be enabled by
> > > > > > default.
> > > > >
> > > > > I've pushed this to trunk, so let's see what breaks!
> > > > >
> > > > >
> > > > > >
> > > > > > -- >8 --
> > > > > >
> > > > > > This causes libstdc++_libbacktrace.a to be built by default. This 
> > > > > > might
> > > > > > fail on some targets, in which case we can make the 'auto' choice 
> > > > > > expand
> > > > > > to either 'yes' or 'no' depending on the target.
> > > > > >
> > > > > > libstdc++-v3/ChangeLog:
> > > > > >
> > > > > > * acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Default to yes.
> > > > > > * configure: Regenerate.
> > > >
> > > > Incidentally, should check_effective_target_stacktrace in
> > > > libstdc++.exp also be adjusted to match; removing the
> > > > _GLIBCXX_HOSTED condition?
> > >
> > > No, it should still depend on is_hosted. The acinclude.m4 macro should
> > > check that.
> >
> > Done in r14-3761-g6de5f5a4fe85bd
>
> Aha, that's what you meant.  I thought you meant that just
> check_effective_target_stacktrace should be gated on
> $is_hosted.
>
> Yeah, it makes sense not to have backtrace enabled by
> default for ! $is_hosted.  On the other hand, bare-iron
> targets like cris-elf apparently *are* hosted, according to
> "#if __STDC_HOSTED__".  I guess I'll have to dig into what
> the definition of "hosted" is, because I don't agree by the
> layman obvious definition.  Maybe there's a bug to fix.

I don't think there's a bug. $is_hosted is true for
--enable-hosted-libstdcxx which is on by default.


> There sure are many yaks to shave these days.
>
> brgds, H-P
>



Re: [RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-09-06 Thread Jonathan Wakely via Gcc-patches
On Mon, 4 Sept 2023 at 17:49, Jonathan Wakely  wrote:
>
> On Mon, 4 Sept 2023 at 17:47, Hans-Peter Nilsson via Libstdc++
>  wrote:
> >
> > > Date: Fri, 1 Sep 2023 12:16:40 +0100
> > > Reply-To: Jonathan Wakely 
> > >
> > > On Wed, 23 Aug 2023 at 17:03, Jonathan Wakely via Libstdc++
> > >  wrote:
> > > >
> > > > Any objections to this? It's a C++23 feture, so should be enabled by
> > > > default.
> > >
> > > I've pushed this to trunk, so let's see what breaks!
> > >
> > >
> > > >
> > > > -- >8 --
> > > >
> > > > This causes libstdc++_libbacktrace.a to be built by default. This might
> > > > fail on some targets, in which case we can make the 'auto' choice expand
> > > > to either 'yes' or 'no' depending on the target.
> > > >
> > > > libstdc++-v3/ChangeLog:
> > > >
> > > > * acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Default to yes.
> > > > * configure: Regenerate.
> >
> > Incidentally, should check_effective_target_stacktrace in
> > libstdc++.exp also be adjusted to match; removing the
> > _GLIBCXX_HOSTED condition?
>
> No, it should still depend on is_hosted. The acinclude.m4 macro should
> check that.

Done in r14-3761-g6de5f5a4fe85bd



[committed] libstdc++: Disable support by default for freestanding

2023-09-06 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux and x86_64-elf. Pushed to trunk.

-- >8 --

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Disable by default
for freestanding.
* configure: Regenerate.
---
 libstdc++-v3/acinclude.m4 | 2 +-
 libstdc++-v3/configure| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 50c808c6b2d..b7210e09d89 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5481,7 +5481,7 @@ BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS 
-DBACKTRACE_ELF_SIZE=$elfsize"
 
   AC_MSG_CHECKING([whether to build libbacktrace support])
   if test "$enable_libstdcxx_backtrace" = "auto"; then
-enable_libstdcxx_backtrace=yes
+enable_libstdcxx_backtrace="$is_hosted"
   fi
   AC_MSG_RESULT($enable_libstdcxx_backtrace)
   if test "$enable_libstdcxx_backtrace" = "yes"; then
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index db1932300c0..dcb9fd6158c 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -73156,7 +73156,7 @@ BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS 
-DBACKTRACE_ELF_SIZE=$elfsize"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build 
libbacktrace support" >&5
 $as_echo_n "checking whether to build libbacktrace support... " >&6; }
   if test "$enable_libstdcxx_backtrace" = "auto"; then
-enable_libstdcxx_backtrace=yes
+enable_libstdcxx_backtrace="$is_hosted"
   fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: 
$enable_libstdcxx_backtrace" >&5
 $as_echo "$enable_libstdcxx_backtrace" >&6; }
-- 
2.41.0



Re: [RFC] libstdc++: Make --enable-libstdcxx-backtrace=auto default to yes

2023-09-04 Thread Jonathan Wakely via Gcc-patches
On Mon, 4 Sept 2023 at 17:47, Hans-Peter Nilsson via Libstdc++
 wrote:
>
> > Date: Fri, 1 Sep 2023 12:16:40 +0100
> > Reply-To: Jonathan Wakely 
> >
> > On Wed, 23 Aug 2023 at 17:03, Jonathan Wakely via Libstdc++
> >  wrote:
> > >
> > > Any objections to this? It's a C++23 feture, so should be enabled by
> > > default.
> >
> > I've pushed this to trunk, so let's see what breaks!
> >
> >
> > >
> > > -- >8 --
> > >
> > > This causes libstdc++_libbacktrace.a to be built by default. This might
> > > fail on some targets, in which case we can make the 'auto' choice expand
> > > to either 'yes' or 'no' depending on the target.
> > >
> > > libstdc++-v3/ChangeLog:
> > >
> > > * acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Default to yes.
> > > * configure: Regenerate.
>
> Incidentally, should check_effective_target_stacktrace in
> libstdc++.exp also be adjusted to match; removing the
> _GLIBCXX_HOSTED condition?

No, it should still depend on is_hosted. The acinclude.m4 macro should
check that.


[committed] libstdc++: Remove unnecessary dg-options and outdated comment

2023-09-04 Thread Jonathan Wakely via Gcc-patches
Tested x86_64-linux. Pushed to trunk.

-- >8 --

It's no longer true that 1.0if has type float _Complex when GNU
extensions are enabled, so remove the hardcoded -std option.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/complex/literals/types.cc: Remove
dg-options and add target selector instead.
---
 libstdc++-v3/testsuite/26_numerics/complex/literals/types.cc | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libstdc++-v3/testsuite/26_numerics/complex/literals/types.cc 
b/libstdc++-v3/testsuite/26_numerics/complex/literals/types.cc
index 5cc46d741ef..69c6781d739 100644
--- a/libstdc++-v3/testsuite/26_numerics/complex/literals/types.cc
+++ b/libstdc++-v3/testsuite/26_numerics/complex/literals/types.cc
@@ -1,7 +1,4 @@
-// Use -std=c++14 explicitly, because -std=gnu++14 enables GNU extension for
-// complex literals, so 1.0if is __complex__ float not std::complex.
-// { dg-options "-std=c++14" }
-// { dg-do compile }
+// { dg-do compile { target c++14 } }
 
 // Copyright (C) 2013-2023 Free Software Foundation, Inc.
 //
-- 
2.41.0



  1   2   3   4   5   6   7   8   9   10   >