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

RESOLVED FIXED in mozilla19

Status

()

RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks: 1 bug)

Trunk
mozilla19
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
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
(Assignee)

Comment 2

6 years ago
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<>.
(Assignee)

Updated

6 years ago
Summary: nsXBLProtoImpl fields "cx" and "versionBefore" are unused → nsXBLProtoImpl fields "cx" and "versionBefore" are unused in opt builds
(Assignee)

Updated

6 years ago
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
(Assignee)

Updated

6 years ago
Blocks: 805607
(Assignee)

Comment 3

6 years ago
Created attachment 675284 [details] [diff] [review]
fix

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)
(Assignee)

Comment 4

6 years ago
(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+
(Assignee)

Updated

6 years ago
OS: Linux → All
Hardware: x86_64 → All
https://hg.mozilla.org/mozilla-central/rev/59c09d991d7b
Status: ASSIGNED → RESOLVED
Last Resolved: 6 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.