[cfe-commits] r71172 - in /cfe/trunk: test/Analysis/override-werror.c tools/clang-cc/AnalysisConsumer.cpp
Ted Kremenek
kremenek at apple.com
Thu May 7 12:02:53 PDT 2009
Author: kremenek
Date: Thu May 7 14:02:53 2009
New Revision: 71172
URL: http://llvm.org/viewvc/llvm-project?rev=71172&view=rev
Log:
Fix <rdar://problem/6848739>. When using -analyze, -Werror has no effect.
Added:
cfe/trunk/test/Analysis/override-werror.c
Modified:
cfe/trunk/tools/clang-cc/AnalysisConsumer.cpp
Added: cfe/trunk/test/Analysis/override-werror.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/override-werror.c?rev=71172&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/override-werror.c (added)
+++ cfe/trunk/test/Analysis/override-werror.c Thu May 7 14:02:53 2009
@@ -0,0 +1,15 @@
+// RUN: clang-cc -analyze -checker-cfref -Werror %s -analyzer-store=basic -verify &&
+// RUN: clang-cc -analyze -checker-cfref -Werror %s -analyzer-store=region -verify
+
+// This test case illustrates that using '-analyze' overrides the effect of
+// -Werror. This allows basic warnings not to interfere with producing
+// analyzer results.
+
+char* f(int *p) {
+ return p; // expected-warning{{incompatible pointer types returning 'int *', expected 'char *'}}
+}
+
+void g(int *p) {
+ if (!p) *p = 0; // expected-warning{{null}}
+}
+
Modified: cfe/trunk/tools/clang-cc/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/AnalysisConsumer.cpp?rev=71172&r1=71171&r2=71172&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/AnalysisConsumer.cpp (original)
+++ cfe/trunk/tools/clang-cc/AnalysisConsumer.cpp Thu May 7 14:02:53 2009
@@ -654,6 +654,9 @@
#include "Analyses.def"
default: break;
}
+
+ // Last, disable the effects of '-Werror' when using the AnalysisConsumer.
+ diags.setWarningsAsErrors(false);
return C.take();
}
More information about the cfe-commits
mailing list