Author: filcab Date: Sat Jul 18 01:35:24 2015 New Revision: 242606 URL: http://llvm.org/viewvc/llvm-project?rev=242606&view=rev Log: Silence the driver warnings, if we see "-w" on the Driver.
Summary: We can enable warnings after that -w, so the patch might not be 100% correct. The problem that triggered this is: we have some amount of tests that expect 0 warnings (including unit tests for -w), but -w ends up not fully silencing everything. Reviewers: echristo, chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11322 Modified: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Index/warning-flags.c Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=242606&r1=242605&r2=242606&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Sat Jul 18 01:35:24 2015 @@ -387,6 +387,9 @@ Compilation *Driver::BuildCompilation(Ar InputArgList Args = ParseArgStrings(ArgList.slice(1)); + // Silence driver warnings if requested + Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w)); + // -no-canonical-prefixes is used very early in main. Args.ClaimAllArgs(options::OPT_no_canonical_prefixes); Modified: cfe/trunk/test/Index/warning-flags.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/warning-flags.c?rev=242606&r1=242605&r2=242606&view=diff ============================================================================== --- cfe/trunk/test/Index/warning-flags.c (original) +++ cfe/trunk/test/Index/warning-flags.c Sat Jul 18 01:35:24 2015 @@ -7,6 +7,7 @@ int *bar(float *f) { return f; } // RUN: c-index-test -test-load-source-reparse 5 all -Wno-return-type %s 2>&1|FileCheck -check-prefix=CHECK-SECOND-WARNING %s // RUN: c-index-test -test-load-source all -w %s 2>&1|not grep warning: // RUN: c-index-test -test-load-source-reparse 5 all -w %s 2>&1|not grep warning: +// RUN: c-index-test -test-load-source all -w -O4 %s 2>&1|not grep warning: // CHECK-BOTH-WARNINGS: warning: control reaches end of non-void function // CHECK-BOTH-WARNINGS: warning: incompatible pointer types returning 'float *' from a function with result type 'int *' _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits