dom/events/KeyEventHandler.cpp:529:10: warning: 'return' will never be executed
Categories
(Core :: DOM: Events, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
Details
Attachments
(1 file)
Unreachable-code build warning (ironically, for a line of code that's commented as being "for warning avoidance"):
dom/events/KeyEventHandler.cpp:529:10: warning: 'return' will never be executed [-Wunreachable-code-return]
return cControl | cControlMask; // for warning avoidance
I'm hitting this in a build with ac_add_options --disable-unified-build
(which might be required in order for this build warning to be displayed -- I'm not sure).
This line of code was last touched in 2004; I'm guessing this was to appease some old compilers who couldn't tell that the preceding switch
statement (which includes an equivalent default
case) would always return.
Nowadays compilers are smart enough to not worry about that, and instead, they correctly warn about this line of code being unreachable; so let's remove it.
Assignee | ||
Comment 1•3 years ago
|
||
This return statement is just a copy of the 'default' case in the preceding
switch statement. It's redundant and unreachable because every case in the
switch statement has a return statement.
clang correctly warns that it's unreachable, so this patch fixes a clang build
warning.
Pushed by dholbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a485fe15f675 Remove unreachable return statement from KeyEventHandler::KeyToMask. r=masayuki
Comment 3•3 years ago
|
||
bugherder |
Description
•