[Driver] Revert D139717 and add -Xparser/-Xcompiler instead
authorFangrui Song <i@maskray.me>
Thu, 22 Dec 2022 20:51:20 +0000 (12:51 -0800)
committerFangrui Song <i@maskray.me>
Thu, 22 Dec 2022 20:51:20 +0000 (12:51 -0800)
commit46cd3127fe54ab51f813492017c5acdbeb1baf26
treeef24bb7f47c2b99ef846dec80993d6d3d858bb67
parent8109d5e911c497e4093bd63c2999ee30679f1095
[Driver] Revert D139717 and add -Xparser/-Xcompiler instead

Some macOS projects use -Xparser even if it leads to a
-Wunused-command-line-argument warning. It doesn't justify adding a broad Joined
`-X` (IgnoredGCCCompat) as GCC doesn't really support these arbitrary `-X`
options.

Note: `-Xcompiler foo` is a GNU libtool option, not a driver option.
It is misused by some ChromeOS packages (but not by Gentoo).
Keep it for a while.

It seems that GCC < 4.6 reports g++: unrecognized option '-Xfoo' but exit with 0.
GCC >= 4.6 reports g++: error: unrecognized option '-Xfoo' and exits with 1.
It never supports -Xcompiler or -Xparser, so `IgnoredGCCCompat` is not justified.

Differential Revision: https://reviews.llvm.org/D140224
clang/include/clang/Driver/Options.td
clang/test/Driver/warn-Xparser.c [new file with mode: 0644]
clang/test/Misc/warn-not-error-Xfoo.c [deleted file]