Fix -Wimplicit-fallthrough warnings in gfx

RESOLVED FIXED in Firefox 44

Status

()

defect
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

unspecified
mozilla44
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox44 fixed)

Details

Attachments

(1 attachment)

MOZ_FALLTHROUGH is an annotation to suppress clang warnings about switch cases that fall through without a break or return statement. 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;
}


gfx/gl/GLBlitHelper.cpp:395:13 [-Wimplicit-fallthrough] unannotated fall-through between switch labels

gfx/layers/apz/src/AsyncPanZoomController.cpp:1087:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/layers/apz/src/AsyncPanZoomController.cpp:1196:3 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/layers/apz/src/GestureEventListener.cpp:411:3 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/layers/apz/util/APZEventState.cpp:292:3 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/layers/apz/util/APZEventState.cpp:295:3 [-Wimplicit-fallthrough] unannotated fall-through between switch labels

widget/GfxInfoBase.cpp:1015:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
Attachment #8675357 - Flags: review?(bgirard)
Comment on attachment 8675357 [details] [diff] [review]
MOZ_FALLTHROUGH_gfx.patch

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

::: gfx/gl/GLBlitHelper.cpp
@@ +390,5 @@
>                  MOZ_ASSERT(texUnitLoc != -1, "uniform uTexUnit not found");
>                  mGL->fUniform1i(texUnitLoc, 0);
>                  break;
> +#else
> +                MOZ_FALLTHROUGH;

Even if you're preserving the semantic of old code you're patching this to make it look like the fall-through is intentional rather than a mistake. I believe the fall-through is a mistake since the ConvertPlanarYCbCr code is not appropriate for gralloc.

r+ if you change this to be:
MOZ_ASSERT_UNREACHABLE("gralloc not support on non-android");
break;
Attachment #8675357 - Flags: review?(bgirard) → review+
https://hg.mozilla.org/mozilla-central/rev/a5d54cef3b23
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Blocks: 1253170
You need to log in before you can comment on or make changes to this bug.