]> granicus.if.org Git - clang/commitdiff
Don't warn -Wsign-compare if we're in an unevaluated context, and fixed
authorJohn McCall <rjmccall@apple.com>
Fri, 6 Nov 2009 18:16:06 +0000 (18:16 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 6 Nov 2009 18:16:06 +0000 (18:16 +0000)
a typo pointed out by Fariborz.

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

include/clang/Basic/DiagnosticGroups.td
lib/Sema/SemaExpr.cpp

index bfaebae873cbf0a08c75e082dfa17e161fa0369c..4146e2d5c4fe3b8d1f84d0a4a8054b38deaf903c 100644 (file)
@@ -160,6 +160,6 @@ def : DiagGroup<"", [Extra]>;  // -W = -Wextra
 def : DiagGroup<"endif-labels", [ExtraTokens]>; // endif-labels = endif-tokens
 
 // A warning group for warnings that we want to have on by default in clang,
-// but which aren't no by default in GCC.
+// but which aren't on by default in GCC.
 def NonGCC : DiagGroup<"non-gcc",
     [SignCompare]>;
index 7f71f9c66bf643868d2ab4f1a6aaa38883285d30..9a549f1ff7302bc7f23769975c6e06f00af38562 100644 (file)
@@ -4454,6 +4454,10 @@ QualType Sema::CheckShiftOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
 ///   suppresses the warning in some cases
 void Sema::CheckSignCompare(Expr *lex, Expr *rex, SourceLocation OpLoc,
                             const PartialDiagnostic &PD, bool Equality) {
+  // Don't warn if we're in an unevaluated context.
+  if (ExprEvalContext == Unevaluated)
+    return;
+
   QualType lt = lex->getType(), rt = rex->getType();
 
   // Only warn if both operands are integral.