Closed
Bug 1236393
Opened 8 years ago
Closed 8 years ago
Annotate intentional switch fallthrough to suppress -Wimplicit-fallthrough warning in tools/power/rapl.cpp
Categories
(Core :: General, defect)
Core
General
Tracking
()
RESOLVED
FIXED
mozilla46
Tracking | Status | |
---|---|---|
firefox46 | --- | fixed |
People
(Reporter: cpeterson, Assigned: cpeterson)
References
Details
Attachments
(1 file)
1.88 KB,
patch
|
n.nethercote
:
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 where the fallthrough is intentional. rapl.cpp deliberately uses only standard libraries and avoids Mozilla-specific code, to make it easy to compile and test on different machines. MOZ_FALLTHROUGH is defined in MFBT's Attributes.h, which we can't #include in rapl.cpp so I copied the MOZ_FALLTHROUGH definition. Should I add a comment saying this definition was copied from Attributes.h? Alternately, if you don't like the duplicate MOZ_FALLTHROUGH definitions in multiple files, I could instead suppress the warning with -Wno-implicit-fallthrough in tools/power/moz.build. tools/power/rapl.cpp:331:7 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
Attachment #8703473 -
Flags: review?(n.nethercote)
![]() |
||
Comment 1•8 years ago
|
||
Comment on attachment 8703473 [details] [diff] [review] annotate-rapl-fallthrough.patch Review of attachment 8703473 [details] [diff] [review]: ----------------------------------------------------------------- ::: tools/power/rapl.cpp @@ +53,5 @@ > //--------------------------------------------------------------------------- > > +// MOZ_FALLTHROUGH is an annotation to suppress compiler warnings about switch > +// cases that fall through without a break or return statement. MOZ_FALLTHROUGH > +// is only needed on cases that have code. I suggest changing this comment to something like "This is identical to the definition in mfbt/Attributes.h, which we don't use here because this file avoids depending on Mozilla headers."
Attachment #8703473 -
Flags: review?(n.nethercote) → review+
Assignee | ||
Comment 2•8 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #1) > I suggest changing this comment to something like "This is identical to the > definition in mfbt/Attributes.h, which we don't use here because this file > avoids depending on Mozilla headers." Thanks. I'll add this comment before landing.
Comment 4•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c1b0bb0c1201
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox46:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•