gcc: add -Wpoison-system-directories support

When packages cross-compile and use wrong paths like -I/usr/include, we
don't notice unless the headers happen to conflict, or the libraries are
incompatible.  Lets add support for the -Wpoison-system-directories that
many other distros have started adopting.

Now when you try to cross-compile and use a path like -I/usr/include, the
compiler throws an error.

This is based on work by Joseph Myers at CodeSourcery.  It has since been
improved greatly:
* The -W flags are always available.
* The configure option controls whether we warn/error by default.
* Handle all include paths in all category chains.
* Reject paths when they're specified even if they don't exist.

It is not currently upstream, nor has it been submitted at all.  There are
no plans to do so currently either.

BUG=chromium:488360
TEST=`cbuildbot chromiumos-sdk` passes  # tests arm/amd64/mipsel/x86
TEST=`cbuildbot panther_moblab-full whirlwind-release` pass
TEST=`cbuildbot {x32,arm64}-generic-full` has no new failures
TEST=x86_64-cros-linux-gnu-gcc throws warnings when using -I/usr/include

Change-Id: I7ee4cf7c3166ccf424d62d637af528686e19cb48
Reviewed-on: https://chromium-review.googlesource.com/272256
Trybot-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
7 files changed