Title: [205135] trunk/Tools
- Revision
- 205135
- Author
- [email protected]
- Date
- 2016-08-29 12:36:36 -0700 (Mon, 29 Aug 2016)
Log Message
Bug 161165 - check-webkit-style doesn't understand macros containing `else` or labels
https://bugs.webkit.org/show_bug.cgi?id=161165
Patch by JF Bastien <[email protected]> on 2016-08-29
Reviewed by Geoffrey Garen.
Fix handling of `else` in a macro. Don't handle labels in a macro:
the checker is already pretty messy in that area and it should be
a rare thing.
* Scripts/webkitpy/style/checkers/cpp.py:
(check_braces):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_else_clause_not_on_same_line_as_else):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (205134 => 205135)
--- trunk/Tools/ChangeLog 2016-08-29 19:07:59 UTC (rev 205134)
+++ trunk/Tools/ChangeLog 2016-08-29 19:36:36 UTC (rev 205135)
@@ -1,3 +1,19 @@
+2016-08-29 JF Bastien <[email protected]>
+
+ Bug 161165 - check-webkit-style doesn't understand macros containing `else` or labels
+ https://bugs.webkit.org/show_bug.cgi?id=161165
+
+ Reviewed by Geoffrey Garen.
+
+ Fix handling of `else` in a macro. Don't handle labels in a macro:
+ the checker is already pretty messy in that area and it should be
+ a rare thing.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_braces):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (CppStyleTest.test_else_clause_not_on_same_line_as_else):
+
2016-08-29 Alex Christensen <[email protected]>
API test URLParserTest.ParserFailures failing ASSERT_NOT_REACHED
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (205134 => 205135)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2016-08-29 19:07:59 UTC (rev 205134)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2016-08-29 19:36:36 UTC (rev 205135)
@@ -2507,7 +2507,9 @@
'An else should appear on the same line as the preceding }')
# Likewise, an else should never have the else clause on the same line
- if search(r'\belse [^\s{]', line) and not search(r'\belse if\b', line):
+ if (search(r'\belse [^\s{]', line)
+ and not search(r'\belse if\b', line)
+ and not search(r'\belse\s*\\$', line)):
error(line_number, 'whitespace/newline', 4,
'Else clause should never be on same line as else (use 2 lines)')
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (205134 => 205135)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2016-08-29 19:07:59 UTC (rev 205134)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2016-08-29 19:36:36 UTC (rev 205135)
@@ -2271,6 +2271,7 @@
'(use 2 lines) [whitespace/newline] [4]')
self.assert_lint(' else if (blah) {', '')
self.assert_lint(' variable_ends_in_else = true;', '')
+ self.assert_lint(' else \\', '')
def test_comma(self):
self.assert_lint('a = f(1,2);',
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes