aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExpr.cpp17
-rw-r--r--test/SemaCXX/warn-assignment-condition.cpp9
2 files changed, 6 insertions, 20 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index c084bb0a80..ec5e3e0c3c 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -9244,17 +9244,12 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) {
== Expr::MLV_Valid) {
SourceLocation Loc = opE->getOperatorLoc();
- // Don't emit a warning if the operation occurs within a macro.
- // Sometimes extra parentheses are used within macros to make the
- // instantiation of the macro less error prone.
- if (!Loc.isMacroID()) {
- Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange();
- Diag(Loc, diag::note_equality_comparison_to_assign)
- << FixItHint::CreateReplacement(Loc, "=");
- Diag(Loc, diag::note_equality_comparison_silence)
- << FixItHint::CreateRemoval(parenE->getSourceRange().getBegin())
- << FixItHint::CreateRemoval(parenE->getSourceRange().getEnd());
- }
+ Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange();
+ Diag(Loc, diag::note_equality_comparison_to_assign)
+ << FixItHint::CreateReplacement(Loc, "=");
+ Diag(Loc, diag::note_equality_comparison_silence)
+ << FixItHint::CreateRemoval(parenE->getSourceRange().getBegin())
+ << FixItHint::CreateRemoval(parenE->getSourceRange().getEnd());
}
}
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp
index ab9d2ad4a5..27eedb9128 100644
--- a/test/SemaCXX/warn-assignment-condition.cpp
+++ b/test/SemaCXX/warn-assignment-condition.cpp
@@ -125,12 +125,3 @@ void test2() {
if ((test2 == fn)) {}
}
-// Do not warn about extra '()' used within a macro. This pattern
-// occurs frequently.
-#define COMPARE(x,y) (x == y)
-int test3(int x, int y) {
- if (COMPARE(x, y)) // no-warning
- return 0;
- return 1;
-}
-