[PATCH] D11322: Silence the driver warnings, if we see "-w" on the Driver.

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Fri Jul 17 18:01:01 PDT 2015


filcab created this revision.
filcab added reviewers: echristo, chandlerc.
filcab added a subscriber: cfe-commits.

This patch is basically a request for comments. Since we can enable
warnings after that -w, I don't think the patch is 100% correct.

The problem that triggered this is because we have some amount of tests
that expect 0 warnings (including unit tests for -w), but -w ends up not
fully silencing everything.

http://reviews.llvm.org/D11322

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

Index: test/Index/warning-flags.c
===================================================================
--- test/Index/warning-flags.c
+++ test/Index/warning-flags.c
@@ -7,6 +7,7 @@
 // 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 *'
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -387,6 +387,9 @@
 
   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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11322.30059.patch
Type: text/x-patch
Size: 1192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150718/394341d0/attachment.bin>


More information about the cfe-commits mailing list