Turn the mixed-sign-comparison diagnostic into a runtime behavior

diagnostic, from Eitan Adler!

llvm-svn: 155876
This commit is contained in:
Douglas Gregor 2012-05-01 01:53:49 +00:00
parent b52637051f
commit bfb4a2138c
2 changed files with 11 additions and 3 deletions

View File

@ -3952,9 +3952,10 @@ static void AnalyzeComparison(Sema &S, BinaryOperator *E) {
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.

View File

@ -333,3 +333,10 @@ struct test11S { unsigned x : 30; };
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) { }
}