[cfe-commits] r155876 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/Sema/compare.c

Douglas Gregor dgregor at apple.com
Mon Apr 30 18:53:49 PDT 2012


Author: dgregor
Date: Mon Apr 30 20:53:49 2012
New Revision: 155876

URL: http://llvm.org/viewvc/llvm-project?rev=155876&view=rev
Log:
Turn the mixed-sign-comparison diagnostic into a runtime behavior
diagnostic, from Eitan Adler!

Modified:
    cfe/trunk/lib/Sema/SemaChecking.cpp
    cfe/trunk/test/Sema/compare.c

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=155876&r1=155875&r2=155876&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Apr 30 20:53:49 2012
@@ -3952,9 +3952,10 @@
       return;
   }
 
-  S.Diag(E->getOperatorLoc(), diag::warn_mixed_sign_comparison)
-    << LHS->getType() << RHS->getType()
-    << LHS->getSourceRange() << RHS->getSourceRange();
+  S.DiagRuntimeBehavior(E->getOperatorLoc(), E,
+    S.PDiag(diag::warn_mixed_sign_comparison)
+      << LHS->getType() << RHS->getType()
+      << LHS->getSourceRange() << RHS->getSourceRange());
 }
 
 /// Analyzes an attempt to assign the given value to a bitfield.

Modified: cfe/trunk/test/Sema/compare.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/compare.c?rev=155876&r1=155875&r2=155876&view=diff
==============================================================================
--- cfe/trunk/test/Sema/compare.c (original)
+++ cfe/trunk/test/Sema/compare.c Mon Apr 30 20:53:49 2012
@@ -333,3 +333,10 @@
 int test11(unsigned y, struct test11S *p) {
   return y > (p->x >> 24); // no-warning
 }
+
+typedef char one_char[1];
+typedef char two_chars[2];
+
+void test12(unsigned a) {
+  if (0 && -1 > a) { }
+}





More information about the cfe-commits mailing list