[libcxx-commits] [PATCH] D150015: [libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 10 06:09:30 PDT 2023


ldionne added a comment.

Does any existing test fail when we run the test suite with glibc-2.25, or do we need to add a test case for this?

I think the fix we're looking for is simply to do:

  #ifdef __cplusplus
  #  define __CORRECT_ISO_CPP_WCHAR_H_PROTO
  #endif
  
  // current if-else chain



================
Comment at: libcxx/include/__mbstate_t.h:34
 #   include <sys/_types/_mbstate_t.h> // works on Darwin
-#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
-#   include_next <wchar.h> // fall back to the C standard provider of mbstate_t
+#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include(<wchar.h>)
+#  include <wchar.h> // fall back to the C standard provider of mbstate_t
----------------
MaskRay wrote:
> Is `__has_include(<wchar.h>)` always true? libc++ ships a copy of `wchar.h` that dispatches to the C library `wchar.h` (through `#include_next <wchar.h>`).
Right, the problem is that `__has_include(<wchar.h>)` is always true because libc++ ships its own.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150015/new/

https://reviews.llvm.org/D150015



More information about the libcxx-commits mailing list