From: Filipe Cabecinhas Date: Sat, 18 Jul 2015 06:35:24 +0000 (+0000) Subject: Silence the driver warnings, if we see "-w" on the Driver. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fdf093bc9a22a498bbb7ed95ff8099ed6350e00;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242606 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index d7a5ee9139..455e492d83 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -387,6 +387,9 @@ Compilation *Driver::BuildCompilation(ArrayRef 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); diff --git a/test/Index/warning-flags.c b/test/Index/warning-flags.c index b76662e9ee..955d68c754 100644 --- a/test/Index/warning-flags.c +++ b/test/Index/warning-flags.c @@ -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 *'