Closed Bug 1235234 Opened 8 years ago Closed 8 years ago

Fix unintentional switch fallthrough in ipc/chromium/ found by -Wimplicit-fallthrough warning

Categories

(Core :: Security: Process Sandboxing, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

ipc/chromium/src/base/process_util_mac.mm:132:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels

This patch fixes a clang -Wimplicit-fallthrough warning (not yet enabled by default in mozilla-central) about switch cases that fall through without a break or return statement. Warnings about intentional fallthroughs can be suppressed with MOZ_FALLTHROUGH, a MFBT macro for a clang compiler annotation. MOZ_FALLTHROUGH is only needed on cases that have code:

switch (foo) {
  case 1: // These cases have no code. No fallthrough annotations are needed.
  case 2:
  case 3:
    foo = 4; // This case has code, so a fallthrough annotation is needed:
    MOZ_FALLTHROUGH;
  default:
    return foo;
}
Attachment #8702096 - Flags: review?(gpascutto)
Comment on attachment 8702096 [details] [diff] [review]
ipc_MOZ_FALLTHROUGH.patch

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

I'm not sure describing this as fixing a warning is appropriate. The code is 100% buggy and the warning caught it. Can you check whether upstream is fixed?
Attachment #8702096 - Flags: review?(gpascutto) → review+
(In reply to Gian-Carlo Pascutto [:gcp] from comment #1)
> I'm not sure describing this as fixing a warning is appropriate. The code is
> 100% buggy and the warning caught it. Can you check whether upstream is
> fixed?

This function is not in the upstream process_util_mac.mm. It's a local change in mozilla-central:

https://hg.mozilla.org/mozilla-central/rev/e45446b74099
Blocks: 590057
I corrected the commit message and bug summary to mention the bug fix instead of just a warning fix.
Summary: Fix -Wimplicit-fallthrough warning in ipc/chromium/ → Fix unintentional switch fallthrough in ipc/chromium/ found by -Wimplicit-fallthrough warning
https://hg.mozilla.org/mozilla-central/rev/319b30f075a2
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Blocks: 1253170
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: