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 <geryxyz@inf.u-szeged.hu> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 38639d94
2014-01-08 Gergo Balogh <geryxyz@inf.u-szeged.hu>
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 <seokju@webkit.org>
[EFL] Unreviewed build fix after r161522.
......
......@@ -2916,12 +2916,15 @@ def check_include_line(filename, file_extension, clean_lines, line_number, inclu
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':
......
......@@ -2623,7 +2623,7 @@ class OrderOfIncludesTest(CppStyleTestBase):
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 @@ class OrderOfIncludesTest(CppStyleTestBase):
'#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 @@ class OrderOfIncludesTest(CppStyleTestBase):
'#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',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment