[PATCH] D13828: Do not process __config file in C mode
Richard Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 16 17:03:26 PDT 2015
rsmith added a comment.
In http://reviews.llvm.org/D13828#269391, @EricWF wrote:
> if `__config` is first included within an `extern "C"` it will define the header guard macro but nothing else
That's not how this macro works: the `__cplusplus` macro is not affected by `extern "C"`; it will be defined for all C++ compilations, whether or not we're in an `extern "C"` context. Personally, I'm sympathetic to coping with libc++'s headers being present in C compilations; it may be hard to avoid this in some circumstances, with some build tools.
If we want the `_LIBCPP_HAS_NO_SYSTEM_HEADER_PRAGMA` macro (and friends) defined by `<__config>` even in C, we could put `#ifdef __cplusplus` around just the specific parts of this header that don't work in C (the namespaces, `static_assert` emulation, `char16_t`/`char32_t`, and the use of `extern "C"`).
http://reviews.llvm.org/D13828
More information about the llvm-commits
mailing list