]> granicus.if.org Git - clang/commitdiff
Silence the driver warnings, if we see "-w" on the Driver.
authorFilipe Cabecinhas <me@filcab.net>
Sat, 18 Jul 2015 06:35:24 +0000 (06:35 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Sat, 18 Jul 2015 06:35:24 +0000 (06:35 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242606 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
test/Index/warning-flags.c

index d7a5ee9139a03fc533e0b31e332e33af93aaca6a..455e492d8321da94ddb4616665e3254cb3f993c4 100644 (file)
@@ -387,6 +387,9 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
 
   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);
 
index b76662e9eedd10ed94857159a784b06d7c00d74f..955d68c7544964ed126c0739bf422f7c70ea7af8 100644 (file)
@@ -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 *'