Closed Bug 430112 Opened 16 years ago Closed 15 years ago

<nsAutoLock.cpp>: 2 "warning: unused variable status"

Categories

(Core :: XPCOM, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: sgautherie, Assigned: sgautherie)

References

()

Details

Attachments

(1 file, 1 obsolete file)

"Linux cb-sea-linux-tbox Depend Nightly on 2008/04/21 09:16:00"
{{
/xpcom/glue/nsAutoLock.cpp: In member function ‘void nsAutoMonitor::Exit()’:
/xpcom/glue/nsAutoLock.cpp:451: warning: unused variable ‘status’
/xpcom/glue/nsAutoLock.cpp: In member function ‘void nsAutoCMonitor::Exit()’:
/xpcom/glue/nsAutoLock.cpp:478: warning: unused variable ‘status’
}}
Attached patch (Av1) <nsAutoLock.cpp> (obsolete) — Splinter Review
Assignee: nobody → sgautherie.bz
Status: NEW → ASSIGNED
Attachment #316852 - Flags: review?(bsmedberg)
That's the wrong bsmedberg to request review from, you want ":bs" or "benjamin@smedbergs.us".
Attachment #316852 - Flags: review?(bsmedberg) → review?(benjamin)
Comment on attachment 316852 [details] [diff] [review]
(Av1) <nsAutoLock.cpp>

This is ugly. Does GCC report the same warning if you do:

  PRStatus status;
  status = PR_ExitMonitor(mMonitor);
  NS_ASSERTION(...);
Attachment #316852 - Flags: review?(benjamin) → review-
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1245837743.1245841544.9931.gz&fulltext=1
Linux mozilla-central nightly on 2009/06/24 03:02:23
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1245839844.1245844096.16862.gz&fulltext=1
OS X 10.5.2 mozilla-central nightly on 2009/06/24 03:37:24
(Windows: no warnings.)

I'll _Try_ comment 3...
"sgautherie.bz#free.fr / try-ca1dd5a900a":
both ways suppress the warning :-)

I think the latter should give smaller/faster compiled code.
(The former would need a comment to explain why 2 lines.)
I'll check it in with the way you want...
Attachment #316852 - Attachment is obsolete: true
Attachment #385005 - Flags: review?(benjamin)
Attachment #385005 - Flags: review?(benjamin) → review+
Comment on attachment 385005 [details] [diff] [review]
(Bv1-Try) 2 other ways to rewrite
[Checkin: See comment 8]


Benjamin, thanks for the review, but which way do you want for checkin?
Comment on attachment 385005 [details] [diff] [review]
(Bv1-Try) 2 other ways to rewrite
[Checkin: See comment 8]

Oh, I didn't realize you had two different options here! Use the first way... any good compiler will optimize away the unused local.
Attachment #385005 - Attachment description: (Bv1-Try) 2 other ways to rewrite → (Bv1-Try) 2 other ways to rewrite [Checkin: See comment 8]
Comment on attachment 385005 [details] [diff] [review]
(Bv1-Try) 2 other ways to rewrite
[Checkin: See comment 8]


http://hg.mozilla.org/mozilla-central/rev/232b3e116bbd
(Bv1) Split the init to 2 instructions
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: