[libcxx-commits] [PATCH] D118616: [libc++] Use -I instead of -isystem to include headers in the test suite

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 31 09:31:58 PST 2022


ldionne added a comment.

In D118616#3284245 <https://reviews.llvm.org/D118616#3284245>, @jloser wrote:

>> Ideally, we'd be able to still use -isystem, but instruct Clang to still emit warnings from the libc++ headers (e.g. we could tell Clang to emit warnings in any file inside <...>/usr/include/c++/v1).
>
> I think that this can be done with `--no-system-header-prefix=path/to/usr/include/c++/v1` FWIW. Note that while Clang supports this, GCC does not for example.
>
> In any case, I like the ideas for this patch; I'm fine with your current solution.

Thanks a lot for the information, I wasn't aware of that option at all. This is quite nice.

However, I just had a look into using that option and it looks like it doesn't help us at all. Indeed, the documentation says:

> The `–system-header-prefix=` and `–no-system-header-prefix=` command-line arguments can be used to override whether subsets of an include path are treated as system headers. When the name in a `#include` directive is found within a header search path and starts with a system prefix, the header is treated as a system header.

Since we always include libc++ headers without any prefix in the `#include <...>` directive, this doesn't help. I would have imagined that doing something like `--no-system-header-prefix=<...>/include/c++/v1` would do the trick, but trying it out confirms that it would only work if we included libc++ headers from the test suite as `#include <include/c++/v1/chrono>` for example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118616



More information about the libcxx-commits mailing list