Changeset 100499 in webkit


Ignore:
Timestamp:
Nov 16, 2011 1:51:15 PM (12 years ago)
Author:
levin@chromium.org
Message:

check-webkit-style should recognize functions even if they have OVERRIDE after them.
https://bugs.webkit.org/show_bug.cgi?id=72515

Reviewed by Adam Barth.

  • Scripts/webkitpy/style/checkers/cpp.py:
  • Scripts/webkitpy/style/checkers/cpp_unittest.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r100494 r100499  
     12011-11-16  David Levin  <levin@chromium.org>
     2
     3        check-webkit-style should recognize functions even if they have OVERRIDE after them.
     4        https://bugs.webkit.org/show_bug.cgi?id=72515
     5
     6        Reviewed by Adam Barth.
     7
     8        * Scripts/webkitpy/style/checkers/cpp.py:
     9        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     10
    1112011-11-16  Tony Chang  <tony@chromium.org>
    212
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r98950 r100499  
    21442144        # We also allow '#' for #endif and '=' for array initialization.
    21452145        previous_line = get_previous_non_blank_line(clean_lines, line_number)[0]
    2146         if ((not search(r'[;:}{)=]\s*$|\)\s*const\s*$', previous_line)
     2146        if ((not search(r'[;:}{)=]\s*$|\)\s*((const|OVERRIDE)\s*)*\s*$', previous_line)
    21472147             or search(r'\b(if|for|foreach|while|switch|else)\b', previous_line))
    21482148            and previous_line.find('#') < 0):
    21492149            error(line_number, 'whitespace/braces', 4,
    21502150                  'This { should be at the end of the previous line')
    2151     elif (search(r'\)\s*(const\s*)?{\s*$', line)
     2151    elif (search(r'\)\s*(((const|OVERRIDE)\s*)*\s*)?{\s*$', line)
    21522152          and line.count('(') == line.count(')')
    21532153          and not search(r'\b(if|for|foreach|while|switch)\b', line)
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r98950 r100499  
    15311531            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
    15321532        self.assert_multi_line_lint(
     1533            'int foo() const OVERRIDE {',
     1534            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
     1535        self.assert_multi_line_lint(
     1536            'int foo() OVERRIDE {',
     1537            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
     1538        self.assert_multi_line_lint(
    15331539            'int foo() const\n'
     1540            '{\n'
     1541            '}\n',
     1542            '')
     1543        self.assert_multi_line_lint(
     1544            'int foo() OVERRIDE\n'
    15341545            '{\n'
    15351546            '}\n',
Note: See TracChangeset for help on using the changeset viewer.