Modified: trunk/Tools/ChangeLog (160772 => 160773)
--- trunk/Tools/ChangeLog 2013-12-18 18:06:13 UTC (rev 160772)
+++ trunk/Tools/ChangeLog 2013-12-18 18:07:01 UTC (rev 160773)
@@ -1,5 +1,18 @@
2013-12-18 Gergo Balogh <[email protected]>
+ Should not have identifiers with underscores in them, especially not leading underscores.
+ https://bugs.webkit.org/show_bug.cgi?id=125847
+
+ Reviewed by Darin Adler.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_identifier_name_in_declaration):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (CppStyleTest.test_runtime_selfinit):
+ (WebKitStyleTest.test_names):
+
+2013-12-18 Gergo Balogh <[email protected]>
+
False webkit-check-style warnings on *.
https://bugs.webkit.org/show_bug.cgi?id=125915
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (160772 => 160773)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-18 18:06:13 UTC (rev 160772)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-18 18:07:01 UTC (rev 160773)
@@ -3219,12 +3219,15 @@
character_after_identifier_regexp = r'(?P<character_after_identifier>[[;()=,])(?!=)'
declaration_without_type_regexp = r'\s*' + identifier_regexp + r'\s*' + maybe_bitfield_regexp + character_after_identifier_regexp
declaration_with_type_regexp = r'\s*' + type_regexp + r'\s' + declaration_without_type_regexp
+ constructor_regexp = r'\s*([\w_]*::)*(?P<pre_part>[\w_]+)::(?P<post_part>[\w_]+)[(]'
is_function_arguments = False
number_of_identifiers = 0
while True:
# If we are seeing the first identifier or arguments of a
# function, there should be a type name before an identifier.
- if not number_of_identifiers or is_function_arguments:
+ constructor_check = match(constructor_regexp, line)
+ is_constructor = constructor_check and constructor_check.group('pre_part') == constructor_check.group('post_part')
+ if not is_constructor and (not number_of_identifiers or is_function_arguments):
declaration_regexp = declaration_with_type_regexp
else:
declaration_regexp = declaration_without_type_regexp
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (160772 => 160773)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-18 18:06:13 UTC (rev 160772)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-18 18:07:01 UTC (rev 160773)
@@ -751,25 +751,25 @@
def test_runtime_selfinit(self):
self.assert_multi_line_lint(
'''\
- Foo::Foo(Bar r, Bel l)
- : r_(r_)
- , l_(l_) { }''',
+ Foo::Foo(Bar raa, Bel laa)
+ : raa_(raa_)
+ , laa_(laa_) { }''',
['You seem to be initializing a member variable with itself.'
' [runtime/init] [4]',
'You seem to be initializing a member variable with itself.'
' [runtime/init] [4]'])
self.assert_multi_line_lint(
'''\
- Foo::Foo(Bar r, Bel l)
- : r_(r)
- , l_(l) { }''',
+ Foo::Foo(Bar raa, Bel laa)
+ : raa_(raa)
+ , laa_(laa) { }''',
'')
self.assert_multi_line_lint(
'''\
- Foo::Foo(Bar r)
- : r_(r)
- , l_(r_)
- , ll_(l_) { }''',
+ Foo::Foo(Bar raa)
+ : raa_(raa)
+ , laa_(raa_)
+ , llaa_(laa_) { }''',
'')
def test_runtime_rtti(self):
@@ -4677,6 +4677,14 @@
'_length' + name_underscore_error_message)
self.assert_lint('unsigned long long _length;',
'_length' + name_underscore_error_message)
+ self.assert_lint(' ::blaspace::Options::Options(double defaultLongTimeout)',
+ '')
+ self.assert_lint(' ::blaspace::Options::Options(double _default_long_timeout)',
+ '_default_long_timeout' + name_underscore_error_message)
+ self.assert_lint(' blaspace::Options::Options(double _default_long_timeout)',
+ '_default_long_timeout' + name_underscore_error_message)
+ self.assert_lint(' Options::Options(double _default_long_timeout)',
+ '_default_long_timeout' + name_underscore_error_message)
# Allow underscores in Objective C files.
self.assert_lint('unsigned long long _length;',