[all-commits] [llvm/llvm-project] 194f98: [libc++] basic_ios<wchar_t> cannot store fill char...

Xing Xue via All-commits all-commits at lists.llvm.org
Wed Jul 17 11:47:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 194f98c2210bf40d0490613fddbf83e04c18ad9b
      https://github.com/llvm/llvm-project/commit/194f98c2210bf40d0490613fddbf83e04c18ad9b
  Author: Xing Xue <xingxue at outlook.com>
  Date:   2024-07-17 (Wed, 17 Jul 2024)

  Changed paths:
    M libcxx/cmake/caches/AIX.cmake
    M libcxx/cmake/caches/s390x-ibm-zos-ascii.cmake
    M libcxx/cmake/caches/s390x-ibm-zos.cmake
    M libcxx/include/__configuration/abi.h
    M libcxx/include/ios
    A libcxx/test/std/input.output/iostream.format/std.manip/setfill_wchar_max.pass.cpp

  Log Message:
  -----------
  [libc++] basic_ios<wchar_t> cannot store fill character WCHAR_MAX (#89305)

`libcxx std::basic_ios` uses `WEOF` to indicate the `fill` value is
uninitialized. On some platforms (e.g AIX and zOS in 64-bit mode)
`wchar_t` is 4 bytes `unsigned` and `wint_t` is also 4 bytes which means
`WEOF` cannot be distinguished from `WCHAR_MAX` by
`std::char_traits<wchar_t>::eq_int_type()`, meaning this valid character
value cannot be stored on affected platforms (as the implementation
triggers reinitialization to `widen(’ ’)`).

This patch introduces a new helper class `_FillHelper` uses a boolean
variable to indicate whether the fill character has been initialized,
which is used by default in libcxx ABI version 2. The patch does not
affect ABI version 1 except for targets AIX in 32- and 64-bit and z/OS
in 64-bit (so that the layout of the implementation is compatible with
the current IBM system provided libc++)

This is a continuation of Phabricator patch
[D124555](https://reviews.llvm.org/D124555). This patch uses a modified
version of the [approach](https://reviews.llvm.org/D124555#3566746)
suggested by @ldionne .

---------

Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>
Co-authored-by: David Tenty <daltenty.dev at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list