RESOLVED FIXED48242
check-webkit-style: false positive reported for #if macro
https://bugs.webkit.org/show_bug.cgi?id=48242
Summary check-webkit-style: false positive reported for #if macro
David Kilzer (:ddkilzer)
Reported 2010-10-25 08:42:14 PDT
Attachment 71742 [details] patch on Bug 46096, Comment #8 had a false-positive on an #if macro definition: Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1 JavaScriptCore/assembler/MacroAssemblerARM.cpp:59: More than one command on the same line in if [whitespace/parens] [4] Total errors found: 1 in 2 files I believe the check-webkit-style script though this was a standard if() statement, not an #if macro.
Attachments
Patch (2.56 KB, patch)
2010-12-02 17:20 PST, David Levin
no flags
Patch (2.79 KB, patch)
2010-12-02 19:04 PST, David Levin
no flags
David Levin
Comment 1 2010-12-02 17:20:14 PST
Eric Seidel (no email)
Comment 2 2010-12-02 17:24:39 PST
Comment on attachment 75440 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=75440&action=review Otherwise seems fine. > WebKitTools/Scripts/webkitpy/style/checkers/cpp.py:1461 > + in_preprocessor_directive = match(r'\s*#', line) Seems you want a ^ in that regexp to lock it to the front of the string. char* my_invalid_style = "You're #1\n"'; would trigger that regexp even though it shouldn't.
David Levin
Comment 3 2010-12-02 18:28:22 PST
(In reply to comment #2) > (From update of attachment 75440 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=75440&action=review > > Otherwise seems fine. > > > WebKitTools/Scripts/webkitpy/style/checkers/cpp.py:1461 > > + in_preprocessor_directive = match(r'\s*#', line) > > Seems you want a ^ in that regexp to lock it to the front of the string. > > char* my_invalid_style = "You're #1\n"'; would trigger that regexp even though it shouldn't. Good call. fwiw, re.match has an implicit ^ (http://docs.python.org/library/re.html#re.match). re.search would need the ^ I wish there was only re.search (why have another function just to mean "^" + regex_given?) but match exists, so I guess it makes sense to use it.
David Levin
Comment 4 2010-12-02 18:32:14 PST
(In reply to comment #3) > (In reply to comment #2) > > (From update of attachment 75440 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=75440&action=review > > > > Otherwise seems fine. > > > > > WebKitTools/Scripts/webkitpy/style/checkers/cpp.py:1461 > > > + in_preprocessor_directive = match(r'\s*#', line) > > > > Seems you want a ^ in that regexp to lock it to the front of the string. > > > > char* my_invalid_style = "You're #1\n"'; would trigger that regexp even though it shouldn't. > Good call. > fwiw, re.match has an implicit ^ (http://docs.python.org/library/re.html#re.match). > re.search would need the ^ > > I wish there was only re.search (why have another function just to mean "^" + regex_given?) but match exists, so I guess it makes sense to use it. But I'll add test for this though.
David Levin
Comment 5 2010-12-02 19:04:47 PST
Shinichiro Hamaji
Comment 6 2010-12-02 19:20:46 PST
Comment on attachment 75451 [details] Patch looks good
WebKit Commit Bot
Comment 7 2010-12-03 00:33:14 PST
Comment on attachment 75451 [details] Patch Clearing flags on attachment: 75451 Committed r73248: <http://trac.webkit.org/changeset/73248>
WebKit Commit Bot
Comment 8 2010-12-03 00:33:20 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.