RESOLVED FIXED Bug 130570
Stylechecker: False positive on inline asm code.
https://bugs.webkit.org/show_bug.cgi?id=130570
Summary Stylechecker: False positive on inline asm code.
Gergő Balogh
Reported 2014-03-21 01:29:06 PDT
The style check identifies some part of the asm code as an initialization list. Noticed in the patch https://bugs.webkit.org/show_bug.cgi?id=130500
Attachments
patch (8.15 KB, patch)
2014-03-21 01:34 PDT, Gergő Balogh
ossy: review-
ossy: commit-queue-
patch fix (5.76 KB, patch)
2014-04-08 02:32 PDT, Gergő Balogh
no flags
patch fix fix (5.71 KB, patch)
2014-04-08 03:12 PDT, Gergő Balogh
no flags
patch fix (5.71 KB, patch)
2014-04-08 08:14 PDT, Gergő Balogh
ossy: review+
ossy: commit-queue-
patch fix (5.09 KB, patch)
2014-04-08 22:43 PDT, Gergő Balogh
no flags
Gergő Balogh
Comment 1 2014-03-21 01:34:19 PDT
Csaba Osztrogonác
Comment 2 2014-04-03 07:14:11 PDT
Comment on attachment 227398 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=227398&action=review The idea is good to disable style checking inside inline assembly blocks, but we can do it little bit better. > Tools/ChangeLog:7 > + Stylechecker: False positive on inline asm code. > + https://bugs.webkit.org/show_bug.cgi?id=130570 > + > + Reviewed by NOBODY (OOPS!). > + Please add a comment that you disable style checking at all for inline assembly blocks. > Tools/Scripts/webkitpy/style/checkers/cpp.py:3616 > if match(r'\s*\b__asm\b', raw_lines[line]): # Ignore asm lines as they format differently. > return > + asm_state.process_line(raw_lines[line]) We should avoid all check below, with this early return if we are in asm block. > Tools/Scripts/webkitpy/style/checkers/cpp.py:3621 > + check_style(clean_lines, line, file_extension, class_state, file_state, enum_state, asm_state, error) Passing asm_state here is unnecessary because of the early return. Consequently we don't need any change in check_style and check_member_initialization_list. > Tools/Scripts/webkitpy/style/checkers/cpp.py:3632 > + super(_InlineASMState, self).__init__() we don't need this > Tools/Scripts/webkitpy/style/checkers/cpp.py:3636 > + if match(r'\s*asm\s+volatile\(', line): volatile should be optional > Tools/Scripts/webkitpy/style/checkers/cpp.py:3640 > + pass we don't need this pass here > Tools/Scripts/webkitpy/style/checkers/cpp.py:3642 > + def isInside(self): isInside -> is_in_asm
Gergő Balogh
Comment 3 2014-04-08 02:32:05 PDT
Created attachment 228822 [details] patch fix
Peter Gal
Comment 4 2014-04-08 02:43:19 PDT
Comment on attachment 228822 [details] patch fix View in context: https://bugs.webkit.org/attachment.cgi?id=228822&action=review > Tools/Scripts/webkitpy/style/checkers/cpp.py:3671 > + super(_InlineASMState, self).__init__() This is still present. > Tools/Scripts/webkitpy/style/checkers/cpp.py:3675 > + if match(r'\s*asm\s+(volatile){0,1}\(', line): Why use {0,1} here? why not a simple '?' ? That would achieve the same and a bit more descriptive on what we want.
Gergő Balogh
Comment 5 2014-04-08 03:12:15 PDT
Created attachment 228825 [details] patch fix fix
Peter Gal
Comment 6 2014-04-08 04:11:30 PDT
(In reply to comment #5) > Created an attachment (id=228825) [details] > patch fix fix The patch does not apply, because I think you've edited it manually. Please don't do such things if you don't know how to do it. (You've removed a line and didn't updated the line number calculations).
Gergő Balogh
Comment 7 2014-04-08 08:14:40 PDT
Created attachment 228838 [details] patch fix
Csaba Osztrogonác
Comment 8 2014-04-08 09:42:03 PDT
Comment on attachment 228838 [details] patch fix View in context: https://bugs.webkit.org/attachment.cgi?id=228838&action=review Now it looks much better, r=me. > Tools/Scripts/webkitpy/style/checkers/cpp.py:2021 > - if search(r'^(?P<indentation>\s*)((explicit\s+)?[^(\s|\?)]+\([^\?]*\)\s?\:|^(\s|\?)*\:)([^\:]|\Z)[^;]*$', line): > + is_list_start = search(r'^(?P<indentation>\s*)((explicit\s+)?[^(\s|\?)]+\([^\?]*\)\s?\:|^(\s|\?)*\:)([^\:]|\Z)[^;]*$', line) > + if is_list_start: just a nit: do we really need this change? I don't think so. Please change it back before landing.
Gergő Balogh
Comment 9 2014-04-08 22:43:23 PDT
Created attachment 228939 [details] patch fix
Csaba Osztrogonác
Comment 10 2014-04-09 02:30:15 PDT
Comment on attachment 228939 [details] patch fix View in context: https://bugs.webkit.org/attachment.cgi?id=228939&action=review r=me > Tools/Scripts/webkitpy/style/checkers/cpp.py:3653 > + if asm_state.is_in_asm(): # Ignore further checks because asm blocks formated differently. typo: formated -> formatted
Csaba Osztrogonác
Comment 11 2014-04-09 02:49:05 PDT
Note You need to log in before you can comment on or make changes to this bug.