[cfe-commits] r139180 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td test/SemaCXX/warn-assignment-condition.cpp
Ted Kremenek
kremenek at apple.com
Tue Sep 6 13:58:32 PDT 2011
Author: kremenek
Date: Tue Sep 6 15:58:32 2011
New Revision: 139180
URL: http://llvm.org/viewvc/llvm-project?rev=139180&view=rev
Log:
Place 'equality comparison with extraneous parentheses...' into a subgroup of -Wparentheses called -Wparentheses-equality.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=139180&r1=139179&r2=139180&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Tue Sep 6 15:58:32 2011
@@ -209,9 +209,11 @@
// missing parentheses; it is off by default. We do not include it
// in -Wparentheses because most users who use -Wparentheses explicitly
// do not want these warnings.
+def ParenthesesOnEquality : DiagGroup<"parentheses-equality">;
def Parentheses : DiagGroup<"parentheses",
[LogicalOpParentheses,
- BitwiseOpParentheses]>;
+ BitwiseOpParentheses,
+ ParenthesesOnEquality]>;
// -Wconversion has its own warnings, but we split a few out for
// legacy reasons:
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=139180&r1=139179&r2=139180&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Sep 6 15:58:32 2011
@@ -3668,7 +3668,7 @@
"place parentheses around the assignment to silence this warning">;
def warn_equality_with_extra_parens : Warning<"equality comparison with "
- "extraneous parentheses">, InGroup<Parentheses>;
+ "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
def note_equality_comparison_to_assign : Note<
"use '=' to turn this equality comparison into an assignment">;
def note_equality_comparison_silence : Note<
Modified: cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp?rev=139180&r1=139179&r2=139180&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp Tue Sep 6 15:58:32 2011
@@ -109,6 +109,12 @@
if ((x == 5)) {} // expected-warning {{equality comparison with extraneous parentheses}} \
// expected-note {{use '=' to turn this equality comparison into an assignment}} \
// expected-note {{remove extraneous parentheses around the comparison to silence this warning}}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wparentheses-equality"
+ if ((x == 5)) {} // no-warning
+#pragma clang diagnostic pop
+
if ((5 == x)) {}
#define EQ(x,y) ((x) == (y))
More information about the cfe-commits
mailing list