Closed Bug 1243647 Opened 8 years ago Closed 8 years ago

Fix -Wimplicit-fallthrough warnings by breaking at unintentional switch fallthroughs in AsmJS.cpp

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

clang's -Wimplicit-fallthrough warnings (not yet enabled in mozilla-central) warn about switch cases that fall through without a break or return statement.

MOZ_FALLTHROUGH (bug 1215411) is an annotation to suppress -Wimplicit-fallthrough warnings where the fallthrough is intentional, but in this case, the switch fallthroughs after each ENUMERATE() look unintentional. Is that correct?

js/src/asmjs/AsmJS.cpp:2598:7: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
js/src/asmjs/AsmJS.cpp:2601:7: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
js/src/asmjs/AsmJS.cpp:2604:7: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
Attachment #8713035 - Flags: review?(bbouvier)
Comment on attachment 8713035 [details] [diff] [review]
AsmJS_MOZ_FALLTHROUGH.patch

Review of attachment 8713035 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch, this couldn't happen in practice because there's another switch preventing we ever fall in these impossible cases, but better to make it explicit.
Attachment #8713035 - Flags: review?(bbouvier) → review+
I've seen this in a Coverity report received yesterday. Marking checkin-needed to move things forward.
Status: NEW → ASSIGNED
Keywords: checkin-needed
Thanks. I had just been too lazy to get around to landing this lone patch. :)
https://hg.mozilla.org/mozilla-central/rev/fae687abfc46
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Blocks: 1253170
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: