Last Comment Bug 774120 - #ifdef fields only used in debug builds
: #ifdef fields only used in debug builds
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
: -- normal (vote)
: mozilla17
Assigned To: Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
:
:
Mentors:
Depends on:
Blocks: clang
  Show dependency treegraph
 
Reported: 2012-07-15 14:21 PDT by Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
Modified: 2012-07-17 02:12 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
add #ifdef (1.27 KB, patch)
2012-07-15 14:21 PDT, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
terrence.d.cole: review+
Details | Diff | Splinter Review
updated patch (1.38 KB, patch)
2012-07-16 13:28 PDT, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
terrence.d.cole: review+
Details | Diff | Splinter Review

Description Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-07-15 14:21:05 PDT
Created attachment 642424 [details] [diff] [review]
add #ifdef

Clang warns about unused private fields.
Comment 1 Terrence Cole [:terrence] 2012-07-16 13:02:53 PDT
Comment on attachment 642424 [details] [diff] [review]
add #ifdef

Review of attachment 642424 [details] [diff] [review]:
-----------------------------------------------------------------

We only need 1 of these new DEBUG sections if we use DebugOnly.  The only place we cannot safely use DebugOnly is in the AssertRootingUnnecessary case.  Patch accepted once you've applied the nits.

::: js/src/gc/Root.h
@@ +399,2 @@
>          : cx(cx)
> +#endif

Just move cx init down into the DEBUG block in the function proper.

::: js/xpconnect/src/xpcprivate.h
@@ +3909,2 @@
>      jsid mCheck;
> +#endif

Just make mCheck a DebugOnly<jsid>, then we won't need either new DEBUG section.  While you are here, please also make the "jsid old" in the destructor a DebugOnly<jsid> and kill the DEBUG section there as well.
Comment 2 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-07-16 13:28:10 PDT
Created attachment 642701 [details] [diff] [review]
updated patch

Using DebugOnly is the the right think in here. We would still have a mCheck member that would be private and unused, which is exactly what the warning is about.

I did implement the other review request.
Comment 3 Terrence Cole [:terrence] 2012-07-16 13:30:53 PDT
Comment on attachment 642701 [details] [diff] [review]
updated patch

Review of attachment 642701 [details] [diff] [review]:
-----------------------------------------------------------------

I still don't like the change to xpcprivate, but it's not worth quibbling over for something in XPConnect.
Comment 4 Ed Morley [:emorley] 2012-07-17 02:12:28 PDT
https://hg.mozilla.org/mozilla-central/rev/808279a147bf

Note You need to log in before you can comment on or make changes to this bug.