]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix test failures for 32-bit AIX
authorJonathan Wakely <jwakely@redhat.com>
Tue, 27 May 2025 11:06:01 +0000 (12:06 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 27 May 2025 12:35:23 +0000 (13:35 +0100)
With -maix32 (the default) we only have 16-bit wchar_t so these tests
fail. The debug.cc one is because we use -fwide-exec-charset=UTF-32BE
which tries to encode each wide character as four bytes in a 2-byte
wchar_t. The format.cc one is because the clown face character can't be
encoded in a single 16-bit wchar_t.

libstdc++-v3/ChangeLog:

* testsuite/std/format/debug.cc: Disable for targets with 16-bit
wchar_t.
* testsuite/std/format/functions/format.cc: Use -DUNICODE for
targets with 32-bit wchar_t.
(test_unicode) [UNICODE]: Only run checks when UNICODE is
defined.

libstdc++-v3/testsuite/std/format/debug.cc
libstdc++-v3/testsuite/std/format/functions/format.cc

index 6165a295496381659cdf1b1c1808eeb43f008cb0..965b4dfbebc5fbd1f2a0a4aa3ad344cc60542c72 100644 (file)
@@ -1,6 +1,7 @@
 // { dg-options "-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE -DUNICODE_ENC" { target le } }
 // { dg-options "-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32BE -DUNICODE_ENC" { target be } }
 // { dg-do run { target c++23 } }
+// { dg-require-effective-target 4byte_wchar_t }
 // { dg-add-options no_pch }
 // { dg-timeout-factor 2 }
 
index 93c33b456e64c72008225abda15376587aadcbb4..e4adf3aeb706ca13937eb7286a2006cf191c10d3 100644 (file)
@@ -1,6 +1,7 @@
 // { dg-options "-fexec-charset=UTF-8" }
 // { dg-do run { target c++20 } }
 // { dg-add-options no_pch }
+// { dg-additional-options "-DUNICODE" { target 4byte_wchar_t } }
 
 #include <format>
 
@@ -511,6 +512,7 @@ test_bool()
 void
 test_unicode()
 {
+#ifdef UNICODE
   // Similar to sC example in test_std_examples, but not from the standard.
   // Verify that the character "🤡" has estimated field width 2,
   // rather than estimated field width equal to strlen("🤡"), which would be 4,
@@ -564,6 +566,7 @@ test_unicode()
     std::string sA = std::format("{:>5}", input[0]);
     VERIFY( sA == input[1] );
   }
+#endif
 }
 
 int main()