Changeset 73248 in webkit


Ignore:
Timestamp:
Dec 3, 2010 12:32:56 AM (13 years ago)
Author:
levin@chromium.org
Message:

2010-12-03 David Levin <levin@chromium.org>

Reviewed by Shinichiro Hamaji.

check-webkit-style: false positive reported for #if macro
https://bugs.webkit.org/show_bug.cgi?id=48242

  • Scripts/webkitpy/style/checkers/cpp.py: Adjusted check to avoid all preprocessor commands.
  • Scripts/webkitpy/style/checkers/cpp_unittest.py: Added test.
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r73240 r73248  
     12010-12-03  David Levin  <levin@chromium.org>
     2
     3        Reviewed by Shinichiro Hamaji.
     4
     5        check-webkit-style: false positive reported for #if macro
     6        https://bugs.webkit.org/show_bug.cgi?id=48242
     7
     8        * Scripts/webkitpy/style/checkers/cpp.py: Adjusted check to avoid
     9          all preprocessor commands.
     10        * Scripts/webkitpy/style/checkers/cpp_unittest.py: Added test.
     11
    1122010-12-02  Eric Seidel  <eric@webkit.org>
    213
  • trunk/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py

    r71989 r73248  
    14591459
    14601460            # Do not check for more than one command in macros
    1461             in_macro = match(r'\s*#define', line)
    1462             if not in_macro and not match(r'((\s*{\s*}?)|(\s*;?))\s*\\?$', rest):
     1461            in_preprocessor_directive = match(r'\s*#', line)
     1462            if not in_preprocessor_directive and not match(r'((\s*{\s*}?)|(\s*;?))\s*\\?$', rest):
    14631463                error(line_number, 'whitespace/parens', 4,
    14641464                      'More than one command on the same line in %s' % statement)
  • trunk/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r71989 r73248  
    31533153            '    if (condition) doIt();\n',
    31543154            'More than one command on the same line in if  [whitespace/parens] [4]')
     3155        # Ensure that having a # in the line doesn't hide the error.
     3156        self.assert_multi_line_lint(
     3157            '    x++; char a[] = "#";',
     3158            'More than one command on the same line  [whitespace/newline] [4]')
     3159        # Ignore preprocessor if's.
     3160        self.assert_multi_line_lint(
     3161            '    #if (condition) || (condition2)\n',
     3162            '')
    31553163
    31563164        # 2. An else statement should go on the same line as a preceding
Note: See TracChangeset for help on using the changeset viewer.