Closed Bug 1215898 Opened 6 years ago Closed 6 years ago

Fix clang's -Wimplicit-fallthrough warnings in gfx/thebes

Categories

(Core :: Graphics: Text, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

MOZ_FALLTHROUGH is an annotation to suppress clang's -Wimplicit-fallthrough 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/thebes/gfxContext.cpp:1415:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/thebes/gfxContext.cpp:1419:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/thebes/gfxFont.cpp:473:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/thebes/gfxFont.cpp:481:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/thebes/gfxFont.cpp:2999:13 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/thebes/gfxTextRun.cpp:1720:13 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
Attachment #8675364 - Flags: review?(jmuizelaar)
Comment on attachment 8675364 [details] [diff] [review]
MOZ_FALLTHROUGH_gfx-thebes.patch

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

I'm fine with these changes. But it might be worth asking the author of the code in gfxFont.cpp/gfxTextRun.cpp how they feel about the change from using 'default' for NORMAL
Attachment #8675364 - Flags: review?(jmuizelaar) → review+
Comment on attachment 8675364 [details] [diff] [review]
MOZ_FALLTHROUGH_gfx-thebes.patch

John, do you mind that I created an explicit no-op case for NS_FONT_VARIANT_CAPS_NORMAL (instead of relying on no-op default) and added a MOZ_UNREACHABLE_ASSERT to the default case? I added the assert because the NS_FONT_VARIANT_CAPS values are macros, so the compiler can't report -Wswitch-enum warnings like it could if NS_FONT_VARIANT_CAPS was an enum.

https://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxFontConstants.h#78
Attachment #8675364 - Flags: review?(jdaggett)
Blocks: 961558
Status: NEW → ASSIGNED
Component: Graphics: Layers → Graphics: Text
Comment on attachment 8675364 [details] [diff] [review]
MOZ_FALLTHROUGH_gfx-thebes.patch

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

Sure, looks reasonable.
Attachment #8675364 - Flags: review?(jdaggett) → review+
https://hg.mozilla.org/mozilla-central/rev/e83fc4b17ab5
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
removing the b2g 2.5 flag since this commit has been reverted due to an incorrect merge, sorry for the confusion
Blocks: 1253170
You need to log in before you can comment on or make changes to this bug.