WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
62097
regression(87771): ternary operator incorrectly identified as bitfield
https://bugs.webkit.org/show_bug.cgi?id=62097
Summary
regression(87771): ternary operator incorrectly identified as bitfield
Alex Milowski
Reported
2011-06-04 13:53:29 PDT
After the patch for
bug 54807
was applied, the style check now incorrectly identifies code like: int heightDiff = m_scripts ? (m_scripts->offsetHeight() - maxHeight) / 2 : 0; as a bitfield. I had to change the code to: int heightDiff = m_scripts ? (m_scripts->offsetHeight() - maxHeight) / 2 : 0; to get it to pass the style check.
Attachments
the patch
(2.11 KB, patch)
2011-06-06 09:09 PDT
,
Yong Li
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
2011-06-04 14:29:23 PDT
I remember seeing that change go by. Guess it needs some tweaking.
Eric Seidel (no email)
Comment 2
2011-06-04 14:30:24 PDT
I wouldn't bother changing your code to make it pass the style check. the style checker just needs to be fixed.
Yong Li
Comment 3
2011-06-06 08:13:52 PDT
(In reply to
comment #2
)
> I wouldn't bother changing your code to make it pass the style check. the style checker just needs to be fixed.
I should have filtered out the ?: case...
Yong Li
Comment 4
2011-06-06 08:17:35 PDT
I'm working on this now.
Yong Li
Comment 5
2011-06-06 09:09:13 PDT
Created
attachment 96096
[details]
the patch
Eric Seidel (no email)
Comment 6
2011-06-06 10:37:05 PDT
Comment on
attachment 96096
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=96096&action=review
> Tools/Scripts/webkitpy/style/checkers/cpp.py:2925 > + matched = re.match(r'\s*((const|mutable)\s+)?(char|(short(\s+int)?)|int|long(\s+(long|int))?)\s+[a-zA-Z_][a-zA-Z0-9_]*\s*:\s*\d+\s*;', line)
seems you meant + not *, or? Unfortunate that we don't have a nice constant for "identifier" since that long regexp you added may be used in other places?
Yong Li
Comment 7
2011-06-06 11:55:56 PDT
Comment on
attachment 96096
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=96096&action=review
>> Tools/Scripts/webkitpy/style/checkers/cpp.py:2925 >> + matched = re.match(r'\s*((const|mutable)\s+)?(char|(short(\s+int)?)|int|long(\s+(long|int))?)\s+[a-zA-Z_][a-zA-Z0-9_]*\s*:\s*\d+\s*;', line) > > seems you meant + not *, or? > > Unfortunate that we don't have a nice constant for "identifier" since that long regexp you added may be used in other places?
The first character cannot be digit, so there must be one [a-zA-Z_]. Then the left can be 0-multiple [a-zA-Z0-9_]. But you are right, [a-zA-Z0-9_]+ should be enough in this case, and it is used at line 2791. I'm not sure if we prefer strict match or loose (for parsing speed?). Seems every places in the file are doing their own jobs. I tend to leave the refine to the future patches :-P
WebKit Review Bot
Comment 8
2011-06-06 12:36:20 PDT
Comment on
attachment 96096
[details]
the patch Clearing flags on attachment: 96096 Committed
r88179
: <
http://trac.webkit.org/changeset/88179
>
WebKit Review Bot
Comment 9
2011-06-06 12:36:24 PDT
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.
Top of Page
Format For Printing
XML
Clone This Bug