Title: [197912] trunk/Tools
Revision
197912
Author
[email protected]
Date
2016-03-09 17:53:43 -0800 (Wed, 09 Mar 2016)

Log Message

check-webkit-style: fix false-positive warnings about @try/@catch blocks in Objective-C++ source files
<http://webkit.org/b/155273>

Reviewed by Andy Estes.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_spacing_for_function_call): Ignore @catch lines.
(check_braces): Ditto.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_brace_at_begin_of_line): Add test case.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (197911 => 197912)


--- trunk/Tools/ChangeLog	2016-03-10 01:46:40 UTC (rev 197911)
+++ trunk/Tools/ChangeLog	2016-03-10 01:53:43 UTC (rev 197912)
@@ -1,3 +1,16 @@
+2016-03-09  David Kilzer  <[email protected]>
+
+        check-webkit-style: fix false-positive warnings about @try/@catch blocks in Objective-C++ source files
+        <http://webkit.org/b/155273>
+
+        Reviewed by Andy Estes.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_spacing_for_function_call): Ignore @catch lines.
+        (check_braces): Ditto.
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (CppStyleTest.test_brace_at_begin_of_line): Add test case.
+
 2016-03-09  Jason Marcell  <[email protected]>
 
         Removing reference to Dashboard.Repository.Internal.trac from open source unit tests.

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (197911 => 197912)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2016-03-10 01:46:40 UTC (rev 197911)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2016-03-10 01:53:43 UTC (rev 197912)
@@ -1476,7 +1476,7 @@
             error(line_number, 'whitespace/parens', 2,
                   'Extra space after (')
         if (search(r'\w\s+\(', function_call)
-            and not match(r'\s*(#|typedef|@property|@interface|@implementation)', function_call)):
+            and not match(r'\s*((#|typedef|@property|@interface|@implementation)|} @catch\b)', function_call)):
             error(line_number, 'whitespace/parens', 4,
                   'Extra space before ( in function call')
         # If the ) is followed only by a newline or a { + newline, assume it's
@@ -2426,7 +2426,7 @@
                   'This { should be at the end of the previous line')
     elif (search(r'\)\s*(((const|override)\s*)*\s*)?{\s*$', line)
           and line.count('(') == line.count(')')
-          and not search(r'\b(if|for|while|switch|NS_ENUM)\b', line)
+          and not search(r'(\b(if|for|while|switch|NS_ENUM)|} @catch)\b', line)
           and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)):
         error(line_number, 'whitespace/braces', 4,
               'Place brace on its own line for function definitions.')

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (197911 => 197912)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2016-03-10 01:46:40 UTC (rev 197911)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2016-03-10 01:53:43 UTC (rev 197912)
@@ -1784,6 +1784,11 @@
             '{\n'
             '}\n',
             '')
+        self.assert_multi_line_lint(
+            '    @try {\n'
+            '    } @catch (NSException *exception) {\n'
+            '    }\n',
+            '')
 
     def test_mismatching_spaces_in_parens(self):
         self.assert_lint('if (foo ) {', 'Extra space before ) in if'
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to