Closed Bug 1223265 Opened 9 years ago Closed 9 years ago

Fix -Wunreachable-code and -Wimplicit-fallthrough warnings in dom/bindings and dom/ipc

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

1. dom/ipc/ContentChild.cpp:2175:9 [-Wunreachable-code] code will never be executed

2. objdir-osx/dom/bindings/TestJSImplGenBinding.cpp:47640:9: warning: code will never be executed [-Wunreachable-code]
         ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "element of return value of TestJSImplInterface.receiveAnySequence");
         ^~~~~~~~~~~~~~~~~
objdir-osx/dom/bindings/TestJSImplGenBinding.cpp:47639:20: note: silence by adding parentheses to mark code as explicitly dead
       if (false && !CallerSubsumes(temp)) {
                    ^
                    /* DISABLES CODE */ ()

3. Also suppress clang's -Wimplicit-fallthrough warnings (not yet enabled by default in mozilla-central) in generated code about switch cases that fall through without a break or return statement. The warnings can be suppressed with the 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 #8685249 - Flags: review?(khuey)
https://hg.mozilla.org/mozilla-central/rev/239b9c7730ff
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Blocks: 1253170
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: