Closed
Bug 764616
Opened 11 years ago
Closed 11 years ago
platform.h: In constructor ‘Sampler::Sampler(int, bool)’: warning: ‘Sampler::active_’ will be initialized after ... Atomic32 Sampler::paused_’ ... when initialized here [-Wreorder]
Categories
(Core :: Gecko Profiler, defect)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
(Whiteboard: [build_warning])
Attachments
(1 file)
1.91 KB,
patch
|
BenWa
:
review+
|
Details | Diff | Splinter Review |
../../../mozilla/tools/profiler/platform.h: In constructor ‘Sampler::Sampler(int, bool)’: ../../../mozilla/tools/profiler/platform.h:237:12: warning: ‘Sampler::active_’ will be initialized after [-Wreorder] ../../../mozilla/tools/profiler/platform.h:236:12: warning: ‘Atomic32 Sampler::paused_’ [-Wreorder] ../../../mozilla/tools/profiler/platform-linux.cc:182:1: warning: when initialized here [-Wreorder] Looks like http://hg.mozilla.org/mozilla-central/rev/fdea12fb0063 added "paused_" to the constructor init lists in the wrong order. (after active_, instead of before active_)
Assignee | ||
Comment 1•11 years ago
|
||
Comment 2•11 years ago
|
||
Comment on attachment 632926 [details] [diff] [review] fix It pains me that compiler complain about this.
Attachment #632926 -
Flags: review?(bgirard) → review+
Assignee | ||
Comment 3•11 years ago
|
||
Yeah. :) (It really only matters when the init list is invoking actual constructors and functions (instead of just initializing a boolean value) -- then, it's more important so that it's clear which functions actually get invoked first.) Thanks for the review! Pushed to m-i: https://hg.mozilla.org/integration/mozilla-inbound/rev/669274e1fcf7
OS: Linux → All
Hardware: x86_64 → All
Target Milestone: --- → mozilla16
Comment 4•11 years ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #3) > Yeah. :) (It really only matters when the init list is invoking actual > constructors and functions (instead of just initializing a boolean value) -- > then, it's more important so that it's clear which functions actually get > invoked first.) IIRC even in that case the compiler will generate code to initialize the members in the order they're declared in the class. This warning is only useful to tell the developer that the order in which they initialize class members in the definition of the constructor actually doesn't matter. I also agree that warning this for POD types is a waste of everybody's time, and for the case where the initialization has side effects, the compiler can probably pick a better warning message!
Updated•11 years ago
|
Whiteboard: [build_warning]
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Ehsan Akhgari [:ehsan] from comment #4) > IIRC even in that case the compiler will generate code to initialize the > members in the order they're declared in the class. (Correct -- that's what I meant, sorry if it wasn't clear.)
Comment 6•11 years ago
|
||
Thanks for the clarification ^-^.
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/669274e1fcf7
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•