diff options
author | John McCall <rjmccall@apple.com> | 2009-11-06 18:16:06 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-11-06 18:16:06 +0000 |
commit | 7d62a8f81f2f22e25c048edfb412b22e06c542ff (patch) | |
tree | f6295a061ddc7c262195348931dd210005c4b5c8 | |
parent | 49c952f853fe2d15dd9c9ff2a29c696bd18fca13 (diff) |
Don't warn -Wsign-compare if we're in an unevaluated context, and fixed
a typo pointed out by Fariborz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86265 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index bfaebae873..4146e2d5c4 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -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]>; diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 7f71f9c66b..9a549f1ff7 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -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. |