Title: [160466] trunk/Tools
Revision
160466
Author
[email protected]
Date
2013-12-11 17:26:03 -0800 (Wed, 11 Dec 2013)

Log Message

check-webkit-style shouldn't check spacing in #if preprocessor lines
https://bugs.webkit.org/show_bug.cgi?id=125534

Patch by Myles C. Maxfield <[email protected]> on 2013-12-11
Reviewed by Ryosuke Niwa.

Preprocessor lines that start with #if shouldn't have to adhere to
the same spacing requirements that regular code does

* Scripts/webkitpy/style/checkers/cpp.py:
(check_spacing):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_spacing_for_binary_ops):
(WebKitStyleTest.test_line_breaking):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (160465 => 160466)


--- trunk/Tools/ChangeLog	2013-12-11 23:38:23 UTC (rev 160465)
+++ trunk/Tools/ChangeLog	2013-12-12 01:26:03 UTC (rev 160466)
@@ -1,5 +1,21 @@
 2013-12-11  Myles C. Maxfield  <[email protected]>
 
+        check-webkit-style shouldn't check spacing in #if preprocessor lines
+        https://bugs.webkit.org/show_bug.cgi?id=125534
+
+        Reviewed by Ryosuke Niwa.
+
+        Preprocessor lines that start with #if shouldn't have to adhere to
+        the same spacing requirements that regular code does
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_spacing):
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (CppStyleTest.test_spacing_for_binary_ops):
+        (WebKitStyleTest.test_line_breaking):
+
+2013-12-11  Myles C. Maxfield  <[email protected]>
+
         check-webkit-style can't determine if a comma is part of an initialization list
         https://bugs.webkit.org/show_bug.cgi?id=125537
 

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2013-12-11 23:38:23 UTC (rev 160465)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2013-12-12 01:26:03 UTC (rev 160466)
@@ -1834,9 +1834,9 @@
 
     # Don't try to do spacing checks for operator methods
     line = sub(r'operator(==|!=|<|<<|<=|>=|>>|>|\+=|-=|\*=|/=|%=|&=|\|=|^=|<<=|>>=|/)\(', 'operator\(', line)
-    # Don't try to do spacing checks for #include or #import statements at
+    # Don't try to do spacing checks for #include, #import, or #if statements at
     # minimum because it messes up checks for spacing around /
-    if match(r'\s*#\s*(?:include|import)', line):
+    if match(r'\s*#\s*(?:include|import|if)', line):
         return
     if search(r'[\w.]=[\w.]', line):
         error(line_number, 'whitespace/operators', 4,

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2013-12-11 23:38:23 UTC (rev 160465)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2013-12-12 01:26:03 UTC (rev 160466)
@@ -1766,6 +1766,7 @@
         self.assert_lint('if (a = b == 1)', '')
         self.assert_multi_line_lint('#include <sys/io.h>\n', '')
         self.assert_multi_line_lint('#import <foo/bar.h>\n', '')
+        self.assert_multi_line_lint('#if __has_include(<ApplicationServices/ApplicationServicesPriv.h>)\n', '')
 
     def test_operator_methods(self):
         self.assert_lint('String operator+(const String&, const String&);', '')
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to