check-webkit-style shouldn't check spacing in #elif preprocessor lines
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 02:17:06 +0000 (02:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 02:17:06 +0000 (02:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175652

Patch by Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> on 2017-08-17
Reviewed by Alex Christensen.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/cpp.py
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

index 621a527..9f62c28 100644 (file)
@@ -1,3 +1,15 @@
+2017-08-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
+
+        check-webkit-style shouldn't check spacing in #elif preprocessor lines
+        https://bugs.webkit.org/show_bug.cgi?id=175652
+
+        Reviewed by Alex Christensen.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_spacing):
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (CppStyleTest.test_spacing_for_binary_ops):
+
 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Fix the build on other platforms after r220865
index 2f1c73b..56ed461 100644 (file)
@@ -1869,9 +1869,9 @@ def check_spacing(file_extension, clean_lines, line_number, file_state, error):
 
     # 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, #import, or #if statements at
+    # Don't try to do spacing checks for #include, #import, #if, or #elif statements at
     # minimum because it messes up checks for spacing around /
-    if match(r'\s*#\s*(?:include|import|if)', line):
+    if match(r'\s*#\s*(?:include|import|if|elif)', line):
         return
     if not is_objective_c_property and not is_objective_c_synthesize and search(r'[\w.]=[\w.]', line):
         error(line_number, 'whitespace/operators', 4,
index aa5f696..2aee931 100644 (file)
@@ -2033,6 +2033,8 @@ class CppStyleTest(CppStyleTestBase):
         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', '')
+        self.assert_multi_line_lint('#elif __has_include(<ApplicationServices/ApplicationServicesPriv.h>)\n', '')
+        self.assert_multi_line_lint('#endif // __has_include(<ApplicationServices/ApplicationServicesPriv.h>)\n', '')
         self.assert_lint('Foo&& a = bar();', '')
 
     def test_operator_methods(self):