[all-commits] [llvm/llvm-project] a595b9: [libc++] cuchar redeclares ::mbstate_t when it's i...

Ian Anderson via All-commits all-commits at lists.llvm.org
Mon May 1 11:48:34 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a595b931f1f91897317a4257df313bddfeb029a6
      https://github.com/llvm/llvm-project/commit/a595b931f1f91897317a4257df313bddfeb029a6
  Author: Ian Anderson <iana at apple.com>
  Date:   2023-05-01 (Mon, 01 May 2023)

  Changed paths:
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__locale
    M libcxx/include/__mbstate_t.h
    A libcxx/include/__std_mbstate_t.h
    M libcxx/include/iosfwd
    M libcxx/include/module.modulemap.in
    M libcxx/include/uchar.h
    M libcxx/include/wchar.h
    M libcxx/test/libcxx/private_headers.verify.cpp
    M libcxx/utils/generate_iwyu_mapping.py

  Log Message:
  -----------
  [libc++] cuchar redeclares ::mbstate_t when it's in its own clang module

When cuchar is compiled independently on platforms that don't have <uchar.h>, it doesn't get a declaration of mbstate_t, and so makes an empty declaration for ::mbstate_t. That conflicts with the declarations in __mbstate_t.h and cwchar since both of those headers do get mbstate_t before making ::mbstate_t.

Change `__mbstate_t.h` to just get the underlying declaration for mbstate_t and not make a declaration for ::mbstate_t. Include __mbstate_t.h in uchar.h and wchar.h when their next headers aren't available so that at least mbstate_t gets defined.

Add __std_mbstate_t.h to declare ::mbstate_t for headers that need that when cuchar or cwchar aren't available (because either _LIBCPP_HAS_NO_WIDE_CHARACTERS or _LIBCPP_CXX03_LANG).

Reviewed By: ldionne, Mordante, #libc, philnik

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




More information about the All-commits mailing list