]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: [_GLIBCXX_INLINE_VERSION] Fix tests failures
authorFrançois Dumont <frs.dumont@gmail.com>
Mon, 28 Apr 2025 16:53:36 +0000 (18:53 +0200)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 30 Apr 2025 05:23:43 +0000 (07:23 +0200)
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.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
libstdc++-v3/testsuite/20_util/function/cons/70692.cc
libstdc++-v3/testsuite/23_containers/map/48101_neg.cc
libstdc++-v3/testsuite/23_containers/multimap/48101_neg.cc
libstdc++-v3/testsuite/lib/libstdc++.exp

index e2c6f7b5b4949a358d3769886feab26b73a5f3d8..6a2c42489e87b0250918f0e9f864a2cdc46e98b2 100644 (file)
 #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 }
index b15208a25317b69c99dc1f3a5c35e6c083cb74ac..f9e8fe31570c05232020dae603a686b1ec0a59a7 100644 (file)
@@ -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 }
index 0661eeb839cf50c88b0e34e2b13dcbed6ea5e8f5..251beee24be163629d98b78e392da38df991d217 100644 (file)
@@ -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" }
index f597ef3dc7ac8447c346df42e3b716d92a49b830..1c1c79d96639fee59a9d77916f238287a051618a 100644 (file)
@@ -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" }
index 3c34d18b9aab63521c63278c3be4c8b4c1ad6ebe..5e958d159de20b7249b488783a8ebb3b12608078 100644 (file)
@@ -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] } {