]> granicus.if.org Git - clang/commit
Add -Wpoison-system-directories warning
authorManoj Gupta <manojgupta@google.com>
Thu, 12 Sep 2019 22:36:13 +0000 (22:36 +0000)
committerManoj Gupta <manojgupta@google.com>
Thu, 12 Sep 2019 22:36:13 +0000 (22:36 +0000)
commite09b029c7f171157f06aa2d742a02a14d5b81cbd
treefb6dd5fb3310a52379198ab9221313c78274408a
parent345f2639a0c5087201b0d39afc2865d92828dd0b
Add -Wpoison-system-directories warning

When using clang as a cross-compiler, we should not use system
headers to do the compilation.
This CL adds support of a new warning flag -Wpoison-system-directories which
emits warnings if --sysroot is set and headers from common host system location
are used.
By default the warning is disabled.

The intention of the warning is to catch bad includes which are usually
generated by third party build system not targeting cross-compilation.
Such cases happen in Chrome OS when someone imports a new package or upgrade
one to a newer version from upstream.

Patch by: denik (Denis Nikitin)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371785 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticCommonKinds.td
lib/Frontend/InitHeaderSearch.cpp
test/Frontend/Inputs/sysroot_x86_64_cross_linux_tree/lib/.keep [new file with mode: 0644]
test/Frontend/Inputs/sysroot_x86_64_cross_linux_tree/usr/include/c++/.keep [new file with mode: 0644]
test/Frontend/Inputs/sysroot_x86_64_cross_linux_tree/usr/lib/gcc/.keep [new file with mode: 0644]
test/Frontend/Inputs/sysroot_x86_64_cross_linux_tree/usr/local/include/.keep [new file with mode: 0644]
test/Frontend/Inputs/sysroot_x86_64_cross_linux_tree/usr/local/lib/.keep [new file with mode: 0644]
test/Frontend/warning-poison-system-directories.c [new file with mode: 0644]