Closed
Bug 1236323
Opened 9 years ago
Closed 9 years ago
Annotate intentional switch fallthroughs to suppress -Wimplicit-fallthrough warnings in gfx/
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
People
(Reporter: cpeterson, Assigned: cpeterson)
References
Details
Attachments
(2 files)
4.63 KB,
patch
|
nical
:
review+
|
Details | Diff | Splinter Review |
4.01 KB,
patch
|
nical
:
review+
|
Details | Diff | Splinter Review |
clang's -Wimplicit-fallthrough warnings (not yet enabled in mozilla-central) warn about switch cases that fall through without a break or return statement. MOZ_FALLTHROUGH (bug 1215411) is an annotation to suppress -Wimplicit-fallthrough warnings about switch cases that intentionally fall through without a break or return statement. MOZ_FALLTHROUGH is only needed on cases that have code.
MOZ_FALLTHROUGH_ASSERT (bug 1235277) will suppress -Wimplicit-fallthrough warnings about switch cases that MOZ_ASSERT(false) (or its alias MOZ_ASSERT_UNREACHABLE) in debug builds, but intentionally fall through in release builds.
Why do we need MOZ_FALLTHROUGH_ASSERT in addition to MOZ_FALLTHROUGH? In release builds, the MOZ_ASSERT(false) will expand to `do { } while (0)`, requiring a MOZ_FALLTHROUGH annotation to suppress a -Wimplicit-fallthrough warning. In debug builds, the MOZ_ASSERT(false) will expand to something like `if (true) { MOZ_CRASH(); }` and the MOZ_FALLTHROUGH annotation will cause a -Wunreachable-code warning. The MOZ_FALLTHROUGH_ASSERT macro breaks this warning stalemate.
gfx/thebes/gfxFcPlatformFontList.cpp:706:9: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
gfx/thebes/gfxFontconfigFonts.cpp:2183:9: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
gfx/2d/DrawTargetCG.cpp:812:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
gfx/2d/DrawTargetCairo.cpp:636:5: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
Attachment #8703398 -
Flags: review?(nical.bugzilla)
Assignee | ||
Comment 1•9 years ago
|
||
Part 2: Suppress -Wimplicit-fallthrough warnings in gfx/ from Skia header files. I will try to submit upstream fixes for these Skia warnings. Then I can remove this -Wno-implicit-fallthrough change from mozilla-central.
gfx/skia/skia/include/gpu/GrTestUtils.h:94:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
gfx/skia/skia/include/gpu/GrTypesPriv.h:181:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
Attachment #8703399 -
Flags: review?(nical.bugzilla)
Assignee | ||
Updated•9 years ago
|
Depends on: MOZ_FALLTHROUGH
Updated•9 years ago
|
Attachment #8703398 -
Flags: review?(nical.bugzilla) → review+
Updated•9 years ago
|
Attachment #8703399 -
Flags: review?(nical.bugzilla) → review+
Assignee | ||
Comment 3•9 years ago
|
||
I backed out part 2 for introducing -Wunreachable-code warnings-as-errors, which I have a fix waiting for review in bug 1237352.
Depends on: 1237352
Keywords: leave-open
Comment 5•9 years ago
|
||
bugherder |
Assignee | ||
Updated•9 years ago
|
Comment 7•9 years ago
|
||
bugherder |
You need to log in
before you can comment on or make changes to this bug.
Description
•