[PATCH] D47687: fix: [Bug 18971] - Missing -Wparentheses warning

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 8 06:07:17 PDT 2018


lebedev.ri added inline comments.


================
Comment at: include/clang/Basic/DiagnosticGroups.td:264-265
 def LogicalOpParentheses: DiagGroup<"logical-op-parentheses">;
+def LogicalOpParenthesesInMacros: DiagGroup<"logical-op-parentheses-in-macros">;
 def LogicalNotParentheses: DiagGroup<"logical-not-parentheses">;
 def ShiftOpParentheses: DiagGroup<"shift-op-parentheses">;
----------------
lebedev.ri wrote:
> `LogicalOpParenthesesInMacros` should be in `LogicalNotParentheses` group.
That should have of course been: `LogicalOpParenthesesInMacros` should be in `LogicalOpParentheses` group.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5487
+def warn_logical_and_in_logical_or_in_macros: Warning<
+  warn_logical_and_in_logical_or.Text>, InGroup<LogicalOpParenthesesInMacros>, DefaultIgnore;
+
----------------
More than 80 chars per line.
```
def warn_logical_and_in_logical_or_in_macros: Warning<
  warn_logical_and_in_logical_or.Text>, InGroup<LogicalOpParenthesesInMacros>,
  DefaultIgnore;
```



================
Comment at: test/Sema/logical-op-parentheses-in-macros.c:1
+// RUN: %clang_cc1 -Wlogical-op-parentheses-in-macros -fsyntax-only -verify %s
+
----------------
You need to also test that it is not enabled by default,
and is enabled by `-Wlogical-op-parentheses`.
It can sill be in one file, see e.g. `clang/test/Sema/tautological-unsigned-enum-zero-compare.c` for examples.


https://reviews.llvm.org/D47687





More information about the cfe-commits mailing list