Much better indeed, there is only the aligned_storage adaptation left.

It will simplify my big versioned namespace patch to use cxx11 abi, very nice !

    libstdc++: [_GLIBCXX_INLINE_VERSION] Fix several tests failures

    Adapt testsuite v3_target_compile to strip version namespace from compiler     output so that dg-error and dg-warning directives do not need to consider it.

    Avoid a aligned_storage check as behavior has been fixed only when using
    gnu-versioned-namespace as it is an abi breaking change.

    libstdc++-v3/ChangeLog:

            * testsuite/lib/libstdc++.exp (v3_target_compile): Strip version namespace
            from compiler output.
            * testsuite/20_util/aligned_storage/value.cc [_GLIBCXX_INLINE_VERSION]:
            Avoid align_msa check.
            * testsuite/20_util/function/cons/70692.cc: Remove now useless __8 namespace
            pattern.
            * testsuite/23_containers/map/48101_neg.cc: Likewise.
            * testsuite/23_containers/multimap/48101_neg.cc: Likewise.

Ok to commit ? And maybe backports ?

François


On 28/04/2025 21:20, Jonathan Wakely wrote:
On 28/04/25 19:11 +0200, François Dumont wrote:
Hi

Pretty straightforward except for the aligned_storage one for which I just avoid the check when gnu-versioned-namespace mode is being used.

    libstdc++: [_GLIBCXX_INLINE_VERSION] Fix several tests failures

    Several tests are failing when libstdc++ is configured with:
    --enable-symvers=gnu-versioned-namespace

    Most of them are due to dg-error checks not considering the __8 nested namespace.

    libstdc++-v3/ChangeLog:

            * testsuite/20_util/aligned_storage/value.cc [_GLIBCXX_INLINE_VERSION]:
            Avoid align_msa check.
            * testsuite/20_util/function_objects/bind_back/111327.cc: Adapt dg-error diagnostic
            to __8 stdnested namespace.
            * testsuite/20_util/function_objects/bind_front/111327.cc: Likewise.             * testsuite/30_threads/packaged_task/cons/dangling_ref.cc: Likewise.             * testsuite/30_threads/packaged_task/cons/lwg4154_neg.cc: Likewise.
            * testsuite/std/format/ranges/format_kind_neg.cc: Likewise.

Let me know if you think it worth a backport.

Tested under Linux x86_64 w/o gnu-versioned-namespace mode.

Ok to commit ?

Could you test this instead please?

--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -648,6 +648,10 @@ proc v3_target_compile { source dest type options } {
     set v3_additional_files {}

     set comp_output [target_compile $source $dest $type $options]
+    # Strip versioned namespace from the compiler output,
+    # so that dg-error and dg-warning patterns can ignore it:
+    regsub -all "std::__8::" $comp_output "std::" comp_output
+
     if { $type == "executable" && $file_to_delete != "" } {
        file delete $file_to_delete
        if { [istarget *-*-darwin*] && [file exists $file_to_delete.dSYM] } {


This should mean we never need to use "std::(__8)?::" again :-)
diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc 
b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
index e2c6f7b5b49..6a2c42489e8 100644
--- a/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
+++ b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
@@ -21,14 +21,14 @@
 #include <type_traits>
 #include <testsuite_tr1.h>
 
-struct MSAlignType { } __attribute__((__aligned__));  
+struct MSAlignType { } __attribute__((__aligned__));
 
 void test01()
 {
   using std::aligned_storage;
   using std::alignment_of;
   using namespace __gnu_test;
-  
+
   const std::size_t align_c = alignment_of<char>::value;
   static_assert(sizeof(aligned_storage<4, align_c>::type) >= 4, "");
   static_assert(__alignof__(aligned_storage<4, align_c>::type) == align_c, "");
@@ -55,9 +55,11 @@ void test01()
   static_assert(__alignof__(aligned_storage<11, align_ct>::type) == align_ct,
                "");
 
+#if !_GLIBCXX_INLINE_VERSION
   const std::size_t align_msa = alignment_of<MSAlignType>::value;
   static_assert(sizeof(aligned_storage<5>::type) >= 5, "");
   static_assert(__alignof__(aligned_storage<5>::type) == align_msa, "");
+#endif
 }
 
 // { dg-warning "deprecated" "" { target c++23 } 0 }
diff --git a/libstdc++-v3/testsuite/20_util/function/cons/70692.cc 
b/libstdc++-v3/testsuite/20_util/function/cons/70692.cc
index b15208a2531..f9e8fe31570 100644
--- a/libstdc++-v3/testsuite/20_util/function/cons/70692.cc
+++ b/libstdc++-v3/testsuite/20_util/function/cons/70692.cc
@@ -11,4 +11,4 @@ int main()
   std::function<const int&()> ff(f);  // { dg-error "no matching function" }
   std::function<long&&()> f2(f);      // { dg-error "no matching function" }
 }
-// { dg-error "std::(__8::)?enable_if" "" { target *-*-* } 0 }
+// { dg-error "std::enable_if" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc 
b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
index 0661eeb839c..251beee24be 100644
--- a/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
@@ -28,8 +28,8 @@ test01()
   c2.find(2); // { dg-error "here" }
 }
 
-// { dg-error "_Compare = std::(__8::)?less<int.>" "" { target *-*-* } 0 }
-// { dg-error "_Compare = std::(__8::)?allocator<int>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::less<int.>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::allocator<int>" "" { target *-*-* } 0 }
 // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
 // { dg-prune-output "no match for call" }
 // { dg-prune-output "invalid conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc 
b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
index f597ef3dc7a..1c1c79d9663 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
@@ -28,8 +28,8 @@ test01()
   c2.find(2); // { dg-error "here" }
 }
 
-// { dg-error "_Compare = std::(__8::)?less<int.>" "" { target *-*-* } 0 }
-// { dg-error "_Compare = std::(__8::)?allocator<int>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::less<int.>" "" { target *-*-* } 0 }
+// { dg-error "_Compare = std::allocator<int>" "" { target *-*-* } 0 }
 // { dg-error "comparison object must be invocable" "" { target *-*-* } 0 }
 // { dg-prune-output "no match for call" }
 // { dg-prune-output "invalid conversion" }
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 3c34d18b9aa..5e958d159de 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -648,6 +648,11 @@ proc v3_target_compile { source dest type options } {
     set v3_additional_files {}
 
     set comp_output [target_compile $source $dest $type $options]
+
+    # Strip versioned namespace from the compiler output,
+    # so that dg-error and dg-warning patterns can ignore it:
+    regsub -all "std::__8::" $comp_output "std::" comp_output
+
     if { $type == "executable" && $file_to_delete != "" } {
        file delete $file_to_delete
        if { [istarget *-*-darwin*] && [file exists $file_to_delete.dSYM] } {

Reply via email to