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

RESOLVED FIXED in Firefox 47

Status

()

Core
JavaScript Engine: JIT
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

Trunk
mozilla47
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox47 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
Created attachment 8713035 [details] [diff] [review]
AsmJS_MOZ_FALLTHROUGH.patch

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
(Assignee)

Comment 3

2 years ago
Thanks. I had just been too lazy to get around to landing this lone patch. :)

Comment 5

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/fae687abfc46
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox47: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
(Assignee)

Updated

2 years ago
Blocks: 1253170
You need to log in before you can comment on or make changes to this bug.