]> granicus.if.org Git - clang/commitdiff
[frontend] Don't allow a mapping to a warning override an error/fatal mapping.
authorChad Rosier <mcrosier@apple.com>
Fri, 3 Feb 2012 01:49:51 +0000 (01:49 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 3 Feb 2012 01:49:51 +0000 (01:49 +0000)
rdar://10736625

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

lib/Basic/Diagnostic.cpp
test/Analysis/null-deref-ps.c
test/CodeGen/statements.c
test/Sema/return.c
test/SemaCXX/vararg-non-pod.cpp
test/SemaObjCXX/vararg-non-pod.mm

index 369c32dc1215b642af88991acde66efacd460d2c..d18d7606d84a31594bd75013d1a129c1efb32faa 100644 (file)
@@ -172,6 +172,13 @@ void DiagnosticsEngine::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map,
 
   FullSourceLoc Loc(L, *SourceMgr);
   FullSourceLoc LastStateChangePos = DiagStatePoints.back().Loc;
+  // Don't allow a mapping to a warning override an error/fatal mapping.
+  if (Map == diag::MAP_WARNING) {
+    DiagnosticMappingInfo &Info = GetCurDiagState()->getOrAddMappingInfo(Diag);
+    if (Info.getMapping() == diag::MAP_ERROR ||
+        Info.getMapping() == diag::MAP_FATAL)
+      Map = Info.getMapping();
+  }
   DiagnosticMappingInfo MappingInfo = makeMappingInfo(Map, L);
 
   // Common case; setting all the diagnostics of a group in one place.
index 31dafe1610a90e39622b1f519f274e8f52ae1dfc..a707970a34675eb488238ed0ae83d3668b9f8678 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-purge=none -verify %s -Wreturn-type
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type 
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-purge=none -verify %s -Wno-error=return-type
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,experimental.deadcode.IdempotentOperations,experimental.core -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wno-error=return-type 
 
 typedef unsigned uintptr_t;
 
index 1d4f633f6172693ca806f807ce8b2d70dbaa91ca..e2bbb5a90a818952d99c9e7247fda2662f6cb0e2 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only
+// RUN: %clang_cc1 -Wno-error=return-type %s -emit-llvm-only
 
 void test1(int x) {
 switch (x) {
index d9456b6e353bdca680d2b01193e8b4ccd23172f4..7a4c1f8e514cdb9eccaf5473b882ae962671c5cc 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang %s -fsyntax-only -Wignored-qualifiers -Wreturn-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value
+// RUN: %clang %s -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value
 
 // clang emits the following warning by default.
 // With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the 
index 7e193ec839b051c93911e47210bccef766367b5a..86b560e814c28cb3a2d6716b22f84228a0cf7468 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wnon-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-error=non-pod-varargs
 
 extern char version[];
 
index 7e5c4c6c97a0ad49122b5a16ca241ba9046048c0..5a6281d71cb2f71ea05d4d4bdbf07022ec5dbf79 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -Wnon-pod-varargs
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-error=non-pod-varargs
 
 extern char version[];