[libcxx-commits] [libcxx] [libc++] Mark __mbstate_t.h module as textual header (PR #200940)

Sean Perry via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 5 10:51:12 PDT 2026


perry-ca wrote:

> Is there an include cycle going on? Is it an issue of testing where the libc's wchar.h isn't covered in a module map?

That is what I understand is happening.  `__mb_state.h` has the include_next that is meant to avoid the cycle but with the modules a new preprocessor is created and `__mb_state.h` is compiled with no knowledge of the include_next state.  The macro definition for `_LIBCPP_WCHAR_H` is also lost which causes the shim definitions to be done again.  Comparing to uchar.h, something like:
```cpp
#  if __has_include_next(<wchar.h>)
#    include_next <wchar.h>
#  else
#    include <__mbstate_t.h> // provide mbstate_t
#    include <stddef.h>
#  endif

#  ifndef _LIBCPP_WCHAR_H
#    define _LIBCPP_WCHAR_H
```
in wchar.h may fix the problem.


https://github.com/llvm/llvm-project/pull/200940


More information about the libcxx-commits mailing list