diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2023-05-10 15:43:37 -0700 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2023-05-10 15:43:38 -0700 |
commit | 0ec57bf7b18e8918dd8ced007a88467b798677c6 (patch) | |
tree | ba19e58ab3bd76b98b8be25e6a50ac7ee86ea5da /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 7b5dc63fc4464e777e4210a68120b36cb283a9fd (diff) | |
download | llvm-0ec57bf7b18e8918dd8ced007a88467b798677c6.zip llvm-0ec57bf7b18e8918dd8ced007a88467b798677c6.tar.gz llvm-0ec57bf7b18e8918dd8ced007a88467b798677c6.tar.bz2 |
[libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.
In libc++'s `wchar.h`, before we forward to the system `wchar.h`, we set `__CORRECT_ISO_CPP_WCHAR_H_PROTO` to ensure it defines the correct signature (e.g. `extern "C++" const wchar_t *wmemchr` and not `extern wchar_t *wmemchr`). After D148542, there are cases where we include the system `wchar.h` from within `__mbstate_t.h` without setting that, and so we get a function type mismatch if we transitively include `wchar.h` through multiple headers in a modules-enabled build. Consistently setting it here resolves those build errors.
Alternative 1: we could put this in `__config` instead. I chose to put it here for a more limited scope.
Alternative 2: we could patch `wchar.h` itself to work correctly and remove references `__CORRECT_ISO_CPP_WCHAR_H_PROTO` from libc++ entirely. It does already set it, but with an additional condition that it is being built by GCC >= 4.4. Clang does pretend to be GCC via `__GNUC__` etc. which can be controlled via `-fgnuc-version` command line flags, but that might have other consequences.
Reviewed By: ldionne, #libc, MaskRay
Differential Revision: https://reviews.llvm.org/D150015
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions