Modified: trunk/Tools/ChangeLog (245869 => 245870)
--- trunk/Tools/ChangeLog 2019-05-29 21:28:09 UTC (rev 245869)
+++ trunk/Tools/ChangeLog 2019-05-29 22:04:58 UTC (rev 245870)
@@ -1,3 +1,17 @@
+2019-05-29 David Kilzer <[email protected]>
+
+ check-webkit-style reports false-positive build/include_order warning in WTF C++ source files
+ <https://webkit.org/b/198349>
+
+ Reviewed by Alex Christensen.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (_classify_include): Don't return early for <wtf/Header.h>
+ includes.
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (OrderOfIncludesTest.test_primary_header): Add tests for
+ <wtf/Header.h> includes.
+
2019-05-29 Geoffrey Garen <[email protected]>
WeakPtr breaks vtables when upcasting to base classes
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (245869 => 245870)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2019-05-29 21:28:09 UTC (rev 245869)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2019-05-29 22:04:58 UTC (rev 245870)
@@ -3031,7 +3031,7 @@
"""
# If it is a system header we know it is classified as _OTHER_HEADER.
- if is_system and not include.startswith('public/'):
+ if is_system and not include.startswith('public/') and not include.startswith('wtf/'):
return _OTHER_HEADER
# If the include is named config.h then this is WebCore/config.h.
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (245869 => 245870)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2019-05-29 21:28:09 UTC (rev 245869)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2019-05-29 22:04:58 UTC (rev 245870)
@@ -3129,8 +3129,10 @@
'\n'
'#include "bar.h"\n',
'')
+
# Pretend that header files exist.
os.path.isfile = lambda filename: True
+
# Missing include for existing primary header -> error.
self.assert_language_rules_check('foo.cpp',
'#include "config.h"\n'
@@ -3139,6 +3141,7 @@
'Found other header before a header this file implements. '
'Should be: config.h, primary header, blank line, and then '
'alphabetically sorted. [build/include_order] [4]')
+
# *SoftLink.cpp files should not include their headers -> no error.
self.assert_language_rules_check('FooSoftLink.cpp',
'#include "config.h"\n'
@@ -3145,6 +3148,7 @@
'\n'
'#include <wtf/SoftLinking.h>\n',
'')
+
# Having include for existing primary header -> no error.
self.assert_language_rules_check('foo.cpp',
'#include "config.h"\n'
@@ -3153,6 +3157,27 @@
'#include "bar.h"\n',
'')
+ # Having include for existing WTF primary header -> no error.
+ self.assert_language_rules_check('foo.cpp',
+ '#include "config.h"\n'
+ '#include <wtf/foo.h>\n'
+ '\n'
+ '#include <wtf/bar.h>\n',
+ '')
+
+ # WTF primary header included out of order -> error.
+ self.assert_language_rules_check('foo.cpp',
+ '#include "config.h"\n'
+ '#include <wtf/bar.h>\n'
+ '\n'
+ '#include <wtf/foo.h>\n',
+ ['Found other header before a header this file implements. '
+ 'Should be: config.h, primary header, blank line, and then '
+ 'alphabetically sorted. [build/include_order] [4]',
+ 'Found header this file implements after other header. '
+ 'Should be: config.h, primary header, blank line, and then '
+ 'alphabetically sorted. [build/include_order] [4]'])
+
os.path.isfile = self.os_path_isfile_orig
def test_public_primary_header(self):