Closed Bug 805555 Opened 8 years ago Closed 8 years ago

nsXBLProtoImpl fields "cx" and "versionBefore" are unused in opt builds

Categories

(Core :: XBL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

content/xbl/src/ is warning-free on Linux g++-4.7, so I tried marking it as FAIL_ON_WARNINGS -- but I got failures under clang on mac, due to these warnings:
../../../../../content/xbl/src/nsXBLProtoImpl.cpp:22:21: error: private field 'cx' is not used [-Werror,-Wunused-private-field]
  JSContext * const cx;
                    ^
content/xbl/src/nsXBLProtoImpl.cpp:23:13: error: private field 'versionBefore' is not used [-Werror,-Wunused-private-field]
  JSVersion versionBefore;
            ^
https://tbpl.mozilla.org/php/getParsedLog.php?id=16463653&tree=Try
BurnThemWithFire!
Component: DOM → XBL
Actually, they're used, but only in debug builds. Code snippet:

20 class AutoVersionChecker
21 {
22   JSContext * const cx;
23   JSVersion versionBefore;
24 
25 public:
26   explicit AutoVersionChecker(JSContext *cx) : cx(cx) {
27 #ifdef DEBUG
28     versionBefore = JS_GetVersion(cx);
29 #endif
30   }

So they probably want to be labeled DebugOnly<>.
Summary: nsXBLProtoImpl fields "cx" and "versionBefore" are unused → nsXBLProtoImpl fields "cx" and "versionBefore" are unused in opt builds
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Blocks: 805607
Attached patch fixSplinter Review
This marks them as DebugOnly, and also renames the constructor argument to "aCx" instead of "cx" to avoid confusion about the "cx(cx)" initialization.
                                 member-var---^   ^---arg
Attachment #675284 - Flags: review?(bzbarsky)
(In reply to Daniel Holbert [:dholbert] from comment #3)
> "aCx" instead of "cx" to avoid confusion about the "cx(cx)" initialization.
>                                        member-var---^   ^---arg

(er, my ASCII art was misaligned in comment 3; hopefully fixed in this quoted chunk)
Comment on attachment 675284 [details] [diff] [review]
fix

r=me
Attachment #675284 - Flags: review?(bzbarsky) → review+
OS: Linux → All
Hardware: x86_64 → All
https://hg.mozilla.org/mozilla-central/rev/59c09d991d7b
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.