Closed Bug 1171368 Opened 5 years ago Closed 5 years ago

layout/style/nsCSSRuleProcessor.cpp:1943:9 [-Wunreachable-code-break] 'break' will never be executed

Categories

(Core :: Layout, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Fix -Wunreachable-code-break warning in layout/style/nsCSSRuleProcessor.cpp. This case statement never hits the break because it returns false first. I moved the `return false` to match the surrounding code style with the break outside each case statement's dummy {} block scope.
Attachment #8615186 - Flags: review?(dholbert)
Comment on attachment 8615186 [details] [diff] [review]
Wunreachable-code_layout.patch

I think we should probably refactor this 'case' block to do its error-handling in early-returns (e.g. handling null doc, & handling 'begin' passing 'len'), as the other cases do in this switch statement.  That would make the logic easier to follow, IMO, and would allow us to end with a simple 'break'.

I suppose this is an improvement, though (death to unreachable code!). So, r=me.
Attachment #8615186 - Flags: review?(dholbert) → review+
https://hg.mozilla.org/mozilla-central/rev/1e76ec5ebbb5
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.