Title: [161535] trunk/Tools
Revision
161535
Author
[email protected]
Date
2014-01-08 18:13:07 -0800 (Wed, 08 Jan 2014)

Log Message

Missleading style error when mixing system and non-system header include lines.
https://bugs.webkit.org/show_bug.cgi?id=126564

Patch by Gergo Balogh <[email protected]> on 2014-01-08
Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_include_line):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(OrderOfIncludesTest.test_check_alphabetical_include_order):
(OrderOfIncludesTest.test_public_primary_header):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (161534 => 161535)


--- trunk/Tools/ChangeLog	2014-01-09 02:12:41 UTC (rev 161534)
+++ trunk/Tools/ChangeLog	2014-01-09 02:13:07 UTC (rev 161535)
@@ -1,3 +1,16 @@
+2014-01-08  Gergo Balogh  <[email protected]>
+
+        Missleading style error when mixing system and non-system header include lines.
+        https://bugs.webkit.org/show_bug.cgi?id=126564
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_include_line):
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (OrderOfIncludesTest.test_check_alphabetical_include_order):
+        (OrderOfIncludesTest.test_public_primary_header):
+
 2014-01-08  Seokju Kwon  <[email protected]>
 
         [EFL] Unreviewed build fix after r161522.

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2014-01-09 02:12:41 UTC (rev 161534)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2014-01-09 02:13:07 UTC (rev 161535)
@@ -2916,12 +2916,15 @@
             previous_match = _RE_PATTERN_INCLUDE.search(previous_line)
          if previous_match:
             previous_header_type = include_state.header_types[previous_line_number]
-            if previous_header_type == _OTHER_HEADER and previous_line.strip() > line.strip():
-                # This type of error is potentially a problem with this line or the previous one,
-                # so if the error is filtered for one line, report it for the next. This is so that
-                # we properly handle patches, for which only modified lines produce errors.
-                if not error(line_number - 1, 'build/include_order', 4, 'Alphabetical sorting problem.'):
-                    error(line_number, 'build/include_order', 4, 'Alphabetical sorting problem.')
+            if previous_header_type == _OTHER_HEADER:
+                if '<' in previous_line and '"' in line:
+                    error(line_number, 'build/include_order', 4, 'Bad include order. Mixing system and custom headers.')
+                elif previous_line.strip() > line.strip():
+                    # This type of error is potentially a problem with this line or the previous one,
+                    # so if the error is filtered for one line, report it for the next. This is so that
+                    # we properly handle patches, for which only modified lines produce errors.
+                    if not error(line_number - 1, 'build/include_order', 4, 'Alphabetical sorting problem.'):
+                        error(line_number, 'build/include_order', 4, 'Alphabetical sorting problem.')
 
     if error_message:
         if file_extension == 'h':

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2014-01-09 02:12:41 UTC (rev 161534)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2014-01-09 02:13:07 UTC (rev 161535)
@@ -2623,7 +2623,7 @@
         self.assert_language_rules_check('foo.h',
                                          '#include <assert.h>\n'
                                          '#include "bar.h"\n',
-                                         'Alphabetical sorting problem.  [build/include_order] [4]')
+                                         'Bad include order. Mixing system and custom headers.  [build/include_order] [4]')
 
         self.assert_language_rules_check('foo.h',
                                          '#include "bar.h"\n'
@@ -2775,7 +2775,7 @@
                                          '#include <other/foo.h>\n'
                                          '\n'
                                          '#include "a.h"\n',
-                                         'Alphabetical sorting problem.  [build/include_order] [4]')
+                                         'Bad include order. Mixing system and custom headers.  [build/include_order] [4]')
 
         # ...except that it starts with public/.
         self.assert_language_rules_check('foo.cpp',
@@ -2791,7 +2791,7 @@
                                          '#include <public/foop.h>\n'
                                          '\n'
                                          '#include "a.h"\n',
-                                         'Alphabetical sorting problem.  [build/include_order] [4]')
+                                         'Bad include order. Mixing system and custom headers.  [build/include_order] [4]')
 
     def test_check_wtf_includes(self):
         self.assert_language_rules_check('foo.cpp',
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to