[PATCH] D13828: Do not process __config file in C mode

Eric Fiselier via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 14:11:14 PDT 2015


EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

This is not OK. First, if `__config` is first included within an `extern "C"` it will define the header guard macro but nothing else. Later, when `__config` is included again from a C++ file it won't provide any of its contents because the header guard is already defined.

Also all of the C headers provided by libc++ depend on `<__config>` to provide the `_LIBCPP_HAS_NO_SYSTEM_HEADER_PRAGMA` and `_LIBCPP_VERSION`. However this dependancy is small enough we can probably work around it in the C headers.

> stddef.h (and other files) leak into C compilation while building Chrome.


Weird, libc++'s include paths shouldn't be added by the driver during C compilation AFAIK. So it's `stddef.h` header shouldn't be found.
Are you using the clang C driver when compiling? I know your issue can arise when using the C++ driver and compiling code in `extern "C"` blocks,
but then your still compiling C++ code and you want our C headers.

Also `<__config>` should be safe to include during C compilation, if unfortuante. Can you elaborate on the problem's this is causing?


http://reviews.llvm.org/D13828





More information about the llvm-commits mailing list