Changeset 167010 in webkit
- Timestamp:
- Apr 9, 2014 2:48:26 AM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r167008 r167010 1 2014-04-09 Gergo Balogh <gbalogh.u-szeged@partner.samsung.com> 2 3 Stylechecker: False positive on inline asm code. 4 https://bugs.webkit.org/show_bug.cgi?id=130570 5 6 Reviewed by Csaba Osztrogonác. 7 8 Disable stylechecking in asm blocks. 9 10 * Scripts/webkitpy/style/checkers/cpp.py: 11 (process_line): 12 (_InlineASMState): 13 (_InlineASMState.__init__): 14 (_InlineASMState.process_line): 15 (_InlineASMState.isInside): 16 (_process_lines): 17 * Scripts/webkitpy/style/checkers/cpp_unittest.py: 18 (WebKitStyleTest.test_member_initialization_list): 19 1 20 2014-04-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 21 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py
r166758 r167010 3621 3621 def process_line(filename, file_extension, 3622 3622 clean_lines, line, include_state, function_state, 3623 class_state, file_state, enum_state, error):3623 class_state, file_state, enum_state, asm_state, error): 3624 3624 """Processes a single line in the file. 3625 3625 … … 3638 3638 enum_state: A _EnumState instance which maintains an enum declaration 3639 3639 state. 3640 asm_state: The state of inline ASM code. 3640 3641 error: A callable to which errors are reported, which takes arguments: 3641 3642 line number, error level, and message … … 3648 3649 return 3649 3650 if match(r'\s*\b__asm\b', raw_lines[line]): # Ignore asm lines as they format differently. 3651 return 3652 asm_state.process_line(raw_lines[line]) 3653 if asm_state.is_in_asm(): # Ignore further checks because asm blocks formatted differently. 3650 3654 return 3651 3655 check_function_definition(filename, file_extension, clean_lines, line, function_state, error) … … 3661 3665 3662 3666 3667 class _InlineASMState(object): 3668 """Stores the state for the inline asm codes.""" 3669 def __init__(self): 3670 self._is_in_asm = False 3671 3672 def process_line(self, line): 3673 if match(r'\s*asm\s+(volatile)?\(', line): 3674 self._is_in_asm = True 3675 elif search(r'\);$', line) and self._is_in_asm: # Can not do more without a proper parser (or lexer). 3676 self._is_in_asm = False 3677 3678 def is_in_asm(self): 3679 return self._is_in_asm 3680 3681 3663 3682 def _process_lines(filename, file_extension, lines, error, min_confidence): 3664 3683 """Performs lint checks and reports any errors to the given error function. … … 3687 3706 file_state = _FileState(clean_lines, file_extension) 3688 3707 enum_state = _EnumState() 3708 asm_state = _InlineASMState() 3689 3709 for line in xrange(clean_lines.num_lines()): 3690 3710 process_line(filename, file_extension, clean_lines, line, 3691 3711 include_state, function_state, class_state, file_state, 3692 enum_state, error)3712 enum_state, asm_state, error) 3693 3713 class_state.check_finished(error) 3694 3714 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
r166758 r167010 5026 5026 'Missing space after , [whitespace/comma] [3]']) 5027 5027 5028 fine_example =(5028 self.assert_multi_line_lint(( 5029 5029 'MyClass::MyClass(Document* doc)\n' 5030 5030 ' : MySuperClass()\n' … … 5034 5034 '#endif\n' 5035 5035 ' , m_myMember(0)\n' 5036 '{ }') 5037 self.assert_multi_line_lint(fine_example, '') 5036 '{ }'), '') 5037 5038 self.assert_multi_line_lint(( 5039 'asm volatile(' 5040 ' "lock; cmpxchgl %3, %2"\n' 5041 ' "sete %1"\n' 5042 ' : "+a"(expected), "=q"(result), "+m"(*location)\n' 5043 ' : "r"(newValue)\n' 5044 ' : "memory"\n' 5045 ');'), '') 5038 5046 5039 5047 self.assert_multi_line_lint('''\
Note: See TracChangeset
for help on using the changeset viewer.