Closed
Bug 68036
Opened 24 years ago
Closed 24 years ago
warnings in nsAutoLock.h when I build an optimized build
Categories
(SeaMonkey :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: sspitzer, Assigned: sspitzer)
References
Details
Attachments
(3 files)
|
810 bytes,
patch
|
Details | Diff | Splinter Review | |
|
853 bytes,
patch
|
Details | Diff | Splinter Review | |
|
529 bytes,
patch
|
Details | Diff | Splinter Review |
here comes a patch, chris or scott, can you review?
| Assignee | ||
Comment 1•24 years ago
|
||
Comment 2•24 years ago
|
||
I guess the other choice is to #ifdef DEBUG the whole thing, e.g.,
#ifndef DEBUG
PR_ExitMonitor(mMonitor)
#else
PRStatus status = PR_ExitMonitor(...)
NS_ASSERTION(PR_SUCCEEDED(status)
#endif
I think I'll defer to whatever scc and waterson want to do for this.
Comment 3•24 years ago
|
||
What is the warning, and wow does this fix it?
| Assignee | ||
Comment 4•24 years ago
|
||
sorry, it's an unused variable warning.
in optimized builds, NS_ASSERTION() is a no-op, so we never checked status.
Unused variable `PRStatus status'
Comment 5•24 years ago
|
||
But with your changes, isn't the variable *still* unused? Seems like doing
something like bienvenu suggests, or even hackier:
#ifdef DEBUG
PRStatus status =
#endif
PR_EnterMonitor(mMonitor);
Would be necessary.
Comment 6•24 years ago
|
||
I like waterson's minimal-change #ifdef.
/be
| Assignee | ||
Comment 7•24 years ago
|
||
no, it isn't unused, because we declare it, and the use it by assigning to it.
but agree, I like waterson's trick better. I'll submit a new patch.
| Assignee | ||
Comment 8•24 years ago
|
||
Comment 9•24 years ago
|
||
Seth, i'm going to be a style whiner: for short (fits in one page or screenful)
#ifdef...#endif blocks, the trailing comment after the #endif that restates or
summarizes the #if or #ifdef condition tends to be clutter; does it not get in
the way here, for you, when reading from the status declaration onward?
Also, compiler pedantry alert: a def (or set) is not a use. A use of foo would
be a statement of the form bar = foo; or baz(foo); while a set of foo does not
use the value. Therefore, assigning to status whether in the initializer or in
a separate statement sets a value that is not used.
/be
| Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 10•24 years ago
|
||
some background:
I build with --enable-pedantic, I've found that if I fix all the warnings I find
I'm less likely to break the ports.
my original patch (declare, then assign) removed the 'unused variable' warning,
the patch seemed reasonable, the compiler was quiet, so I was happy.
new patch coming...
Comment 11•24 years ago
|
||
Hah! A gcc --pedantic bug! I don't care enough to report it. I hope someone
does, just to get an uber-pedantic rationale for the bogus difference between an
initialized declaration and an uninitialized one followed by an assignment.
/be
| Assignee | ||
Comment 12•24 years ago
|
||
| Assignee | ||
Comment 13•24 years ago
|
||
checked in to the mailnews perf branch, it will come over in the merge...
Comment 14•24 years ago
|
||
Thanks for fixing the warning - it is very annoying, because it seems to come up
for every 3. file that is compiled optimzed, i.e. thousands of times.
| Assignee | ||
Comment 15•24 years ago
|
||
after we land, I'll bring this fix over by hand.
| Assignee | ||
Comment 16•24 years ago
|
||
fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 17•23 years ago
|
||
*** Bug 50083 has been marked as a duplicate of this bug. ***
Updated•21 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•