Closed Bug 1730759 Opened 3 years ago Closed 3 years ago

dom/events/KeyEventHandler.cpp:529:10: warning: 'return' will never be executed

Categories

(Core :: DOM: Events, defect)

defect

Tracking

()

RESOLVED FIXED
94 Branch
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.

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
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: