From 19d9d2ebbed9164e3f3a20fa065a26585c990a2e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 21 Jul 2011 23:40:37 +0000 Subject: [PATCH] Avoid warning on "clang -c -Dfoo test.i". Lines like these are created when using ccache and libtool.m4 assumes that the compiler cannot print warnings about options it knows about. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135723 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index c54ced2d1d..2fb865e020 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1459,6 +1459,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (types::getPreprocessedType(InputType) != types::TY_INVALID) AddPreprocessingOptions(D, Args, CmdArgs, Output, Inputs); + // Don't warn about "clang -c -DPIC -fPIC test.i" because libtool.m4 assumes + // that "The compiler can only warn and ignore the option if not recognized". + // When building with ccache, it will pass -D options to clang even on + // preprocessed inputs and configure concludes that -fPIC is not supported. + Args.ClaimAllArgs(options::OPT_D); + // Manually translate -O to -O2 and -O4 to -O3; let clang reject // others. if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { -- 2.50.1