[libcxx-commits] [libcxx] 9f5f084 - [libcxx] Fix the type in __estimate_column_width

Stefan Pintilie via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 25 07:05:10 PST 2022


Author: Stefan Pintilie
Date: 2022-02-25T09:04:58-06:00
New Revision: 9f5f08476e8979046ad3a13865d984c428eae442

URL: https://github.com/llvm/llvm-project/commit/9f5f08476e8979046ad3a13865d984c428eae442
DIFF: https://github.com/llvm/llvm-project/commit/9f5f08476e8979046ad3a13865d984c428eae442.diff

LOG: [libcxx] Fix the type in __estimate_column_width

It seems that we are using wchar_t in __estimate_column_width and assume that
it is a 32 bit type. However, on AIX 32 the size of wchar_t is only 16 bits.

Changed wchar_t to uint32_t since the variable is being passed to a function
that uses uint32_t anyway.

Reviewed By: hubert.reinterpretcast, daltenty, Mordante, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119770

Added: 
    

Modified: 
    libcxx/include/__format/parser_std_format_spec.h
    libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string_unicode.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 57f4e46e561b1..f92a9facaa982 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -1271,7 +1271,7 @@ __estimate_column_width(const _CharT* __first, const _CharT* __last,
   size_t __result = 0;
 
   while (__first != __last) {
-    wchar_t __c = *__first;
+    uint32_t __c = *__first;
     __result += __column_width(__c);
 
     if (__result > __maximum)

diff  --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string_unicode.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string_unicode.pass.cpp
index 2f92ae8e08d44..6da15740a4016 100644
--- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string_unicode.pass.cpp
+++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_string_unicode.pass.cpp
@@ -9,9 +9,6 @@
 // UNSUPPORTED: libcpp-no-concepts
 // UNSUPPORTED: libcpp-has-no-incomplete-format
 
-// Fails for 32-bit builds on AIX.
-// UNSUPPORTED: LIBCXX-AIX-FIXME
-
 // UTF-32 doesn't work properly
 // XFAIL: windows
 


        


More information about the libcxx-commits mailing list