Title: [160229] trunk/Tools
- Revision
- 160229
- Author
- [email protected]
- Date
- 2013-12-06 10:54:32 -0800 (Fri, 06 Dec 2013)
Log Message
check-webkit-style: false positive warning for indentation of #ifdef code.
https://bugs.webkit.org/show_bug.cgi?id=125254
Patch by Gergo Balogh <[email protected]> on 2013-12-06
Reviewed by Darin Adler.
* Scripts/webkitpy/style/checkers/cpp.py:
(check_member_initialization_list):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(WebKitStyleTest.test_member_initialization_list):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (160228 => 160229)
--- trunk/Tools/ChangeLog 2013-12-06 18:54:00 UTC (rev 160228)
+++ trunk/Tools/ChangeLog 2013-12-06 18:54:32 UTC (rev 160229)
@@ -1,3 +1,15 @@
+2013-12-06 Gergo Balogh <[email protected]>
+
+ check-webkit-style: false positive warning for indentation of #ifdef code.
+ https://bugs.webkit.org/show_bug.cgi?id=125254
+
+ Reviewed by Darin Adler.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_member_initialization_list):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (WebKitStyleTest.test_member_initialization_list):
+
2013-12-06 Chris Fleizach <[email protected]>
Fix spelling error in style checker: beggining
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (160228 => 160229)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-06 18:54:00 UTC (rev 160228)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-06 18:54:32 UTC (rev 160229)
@@ -1986,6 +1986,7 @@
# Each member (and superclass) should be indented on a separate line,
# with the colon or comma preceding the member on that line.
begin_line = line
+ # match the start of initialization list
if search(r'^(?P<indentation>\s*)((explicit\s+)?[^\s]+\(.*\)\s?\:|^\s*\:).*[^;]*$', line):
if search(r'[^:]\:[^\:\s]+', line):
error(line_number, 'whitespace/init', 4,
@@ -2001,8 +2002,8 @@
inner_indentation = indentation + ' ' * 4
while(not search(r'{', line)):
- # Don't check inheritance style
- if search(r'\S\(.*\)', line):
+ # Don't check inheritance style and precompiler directives
+ if (not line.startswith('#')) and search(r'\S\(.*\)', line):
if not line.startswith(inner_indentation) and begin_line != line:
error(line_number, 'whitespace/indent', 4,
'Wrong number of spaces before statement. (expected: %d)' % len(inner_indentation))
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (160228 => 160229)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-06 18:54:00 UTC (rev 160228)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-06 18:54:32 UTC (rev 160229)
@@ -4940,6 +4940,18 @@
'Wrong number of spaces before statement. (expected: 12)'
' [whitespace/indent] [4]',
'Missing space after , [whitespace/comma] [3]'])
+
+ fine_example = (
+ 'MyClass::MyClass(Document* doc)\n'
+ ' : MySuperClass()\n'
+ '#if !BLA(FOO)\n'
+ ' , MySuperClass()\n'
+ ' , m_doc(0)\n'
+ '#endif\n'
+ ' , m_myMember(0)\n'
+ '{ }')
+ self.assert_multi_line_lint(fine_example, '')
+
self.assert_multi_line_lint('''\
MyClass::MyClass(Document* doc)
:MySuperClass()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes