Closed Bug 228780 Opened 21 years ago Closed 9 years ago

Fix all "Unused variable '[...]'" 'Build Warnings' (Part 2/2: "with function call")

Categories

(SeaMonkey :: Build Config, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sgautherie, Assigned: sgautherie)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning][Leave open until there is no more such warnings in tinderbox])

Attachments

(5 files, 5 obsolete files)

1.25 KB, patch
sgautherie
: review+
sgautherie
: superreview+
chofmann
: approval1.7a+
Details | Diff | Splinter Review
1.33 KB, patch
Details | Diff | Splinter Review
1.03 KB, patch
roc
: review+
dbaron
: superreview+
Details | Diff | Splinter Review
4.79 KB, patch
darin.moz
: review-
Details | Diff | Splinter Review
2.05 KB, patch
sgautherie
: review+
dmosedale
: superreview+
Details | Diff | Splinter Review
This bug goes along bug 90906.
Blocks: 217089
No longer blocks: buildwarning
Depends on: 219982, 221128
No longer depends on: 221128
Depends on: 228618
Attached patch (Av1) <nsMacMain.cpp> (obsolete) — Splinter Review
Fix for: { /builds/tinderbox/Mozilla1.6/Darwin_6.6_Clobber/mozilla/webshell/tests/viewer/nsMacMain.cpp: In function `int main(int, char**)': /builds/tinderbox/Mozilla1.6/Darwin_6.6_Clobber/mozilla/webshell/tests/viewer/nsMacMain.cpp:450: warning: unused variable `OSErr err' }
Comment on attachment 137724 [details] [diff] [review] (Av1) <nsMacMain.cpp> 'r=?': (see comment 1) I have no compiler: Can you compile/test/review it ? Thanks.
Attachment #137724 - Flags: review?(cls)
Whiteboard: [Leave open until there is no more such warnings in tinderbox]
Attached patch (Av1b) <nsMacMain.cpp> (obsolete) — Splinter Review
Patch Av1, more explicit.
Comment on attachment 137748 [details] [diff] [review] (Av1b) <nsMacMain.cpp> 'r=?': (see comment 1) I have no compiler: Can you compile/test/review it ? Thanks.
Attachment #137748 - Flags: review?(cls)
Attachment #137724 - Attachment is obsolete: true
Attachment #137724 - Flags: review?(cls)
Attached patch (Bv1) <morkParser.cpp> (obsolete) — Splinter Review
Solve { (bienvenu) 83. db/mork/src/morkParser.cpp:1375 (See build log excerpt) Unused variable `nsresult rv' 1373 mork_pos here; 1374 nsIMdbEnv *ev = mev->AsMdbEnv(); 1375 nsresult rv= mParser_Stream->Tell(ev, &here); 1376 if ( here > 0 ) // positive? 1377 --here; }
Comment on attachment 139057 [details] [diff] [review] (Bv1) <morkParser.cpp> I have no compiler: Could you compile/test/review it ? Thanks.
Attachment #139057 - Flags: review?(bienvenu)
Attachment #137748 - Flags: review?(cls) → review?(pinkerton)
Comment on attachment 137748 [details] [diff] [review] (Av1b) <nsMacMain.cpp> r=pink
Attachment #137748 - Flags: review?(pinkerton) → review+
Attachment #137748 - Flags: superreview?(bryner)
Comment on attachment 137748 [details] [diff] [review] (Av1b) <nsMacMain.cpp> The explicit |(void)| cast should not be needed. sr=bryner if you remove that.
Attachment #137748 - Flags: superreview?(bryner) → superreview+
Attachment #137748 - Attachment is obsolete: true
Av1b, with comment 8 suggestion(s): *Removal of the explicit |(void)| cast, which was only there for human reader. *Line up the next two lines of parameters, previously untouched.
Comment on attachment 141227 [details] [diff] [review] (Av1c) <nsMacMain.cpp> [Checked in: Comment 13] Keeping { (Av1b) <nsMacMain.cpp> patch 2003-12-20 05:33 PST pinkerton: review+ bryner: superreview+ }
Attachment #141227 - Flags: superreview+
Attachment #141227 - Flags: review+
Comment on attachment 141227 [details] [diff] [review] (Av1c) <nsMacMain.cpp> [Checked in: Comment 13] 'approval1.7a?': trivial warning fix, no risk.
Attachment #141227 - Flags: approval1.7a?
Comment on attachment 141227 [details] [diff] [review] (Av1c) <nsMacMain.cpp> [Checked in: Comment 13] a=chofmann
Attachment #141227 - Flags: approval1.7a? → approval1.7a+
Comment on attachment 141227 [details] [diff] [review] (Av1c) <nsMacMain.cpp> [Checked in: Comment 13] Check in: { 02/12/2004 09:11 neil%parkwaycc.co.uk mozilla/ webshell/ tests/ viewer/ nsMacMain.cpp 1.55 }
Attachment #141227 - Attachment description: (Av1c) <nsMacMain.cpp> → (Av1c) <nsMacMain.cpp> [Checked in: Comment 13]
Attachment #141227 - Attachment is obsolete: true
marking fixed
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Depends on: 240562
Comment on attachment 139057 [details] [diff] [review] (Bv1) <morkParser.cpp> const nsresult rv isn't mozilla style even if the variable only gets used once.
Attachment #139057 - Attachment is obsolete: true
Attachment #139057 - Flags: review?(bienvenu)
Bv1, with comment 15 suggestion(s); and without additional white-space cleanup.
Attachment #146639 - Flags: review?(neil.parkwaycc.co.uk)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
Comment on attachment 146639 [details] [diff] [review] (Bv1b-r) <morkParser.cpp> (for review only) I have no compiler: Can you compile/test/review it ? Thanks.
Comment on attachment 146639 [details] [diff] [review] (Bv1b-r) <morkParser.cpp> (for review only) Looks good to me, it seems more consistent with End/StartSpanOnThisByte.
Attachment #146639 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #146639 - Flags: superreview?(sspitzer)
Attachment #146639 - Flags: superreview?(sspitzer) → superreview?(bienvenu)
Comment on attachment 146639 [details] [diff] [review] (Bv1b-r) <morkParser.cpp> (for review only) No super-review from <bienvenu@nventure.com> since '2004-04-26' :-(
Attachment #146639 - Flags: superreview?(bienvenu) → superreview?(brendan)
Comment on attachment 146639 [details] [diff] [review] (Bv1b-r) <morkParser.cpp> (for review only) rs=me, I'm trusting you guys, patch looks ok from the context diff. /be
Attachment #146639 - Flags: superreview?(brendan) → superreview+
Bv1b-r, with full white-space diff.
Attachment #146639 - Attachment is obsolete: true
Comment on attachment 146639 [details] [diff] [review] (Bv1b-r) <morkParser.cpp> (for review only) moa=bienvenu
Comment on attachment 151402 [details] [diff] [review] (Bv1b-ci) <morkParser.cpp> (for check-in) [Checked in: Comment 23] Check in: { 2004-06-22 09:06 neil%parkwaycc.co.uk mozilla/ db/ mork/ src/ morkParser.cpp 1.23 }
Attachment #151402 - Attachment description: (Bv1b-ci) <morkParser.cpp> (for check-in) → (Bv1b-ci) <morkParser.cpp> (for check-in) [Checked in: Comment 23]
Attachment #151402 - Attachment is obsolete: true
Attachment #146639 - Attachment description: (Bv1b-r) <morkParser.cpp> (for review only) → (Bv1b-r) <morkParser.cpp> (for review only) [Check in: See Bv1b-ci]
Attached patch (Cv1) <nsMsgBodyHandler.cpp> (obsolete) — Splinter Review
Fix for {{ bienvenu 1. mailnews/base/search/src/nsMsgBodyHandler.cpp:133 (See build log excerpt) Unused variable `nsresult rv' 131 { 132 nsCOMPtr <nsIInputStream> inputStream; 133 nsresult rv = m_scope->GetInputStream(getter_AddRefs(inputStream)); 134 if (inputStream) 135 { }}
Matthias: I'm CC'ing you; note that for some time, my primary ISP STMP service has been enable to send you my messages... :-(
Comment on attachment 151481 [details] [diff] [review] (Cv1) <nsMsgBodyHandler.cpp> Matthias: Could you try to compile, and possibly test, this patch ? Thanks. Note {{ GetInputStream Defined as a function in: * mailnews/base/search/src/nsMsgSearchTerm.cpp, line 1464, as member of class nsMsgSearchScopeTerm }}
Attachment #151481 - Flags: superreview?(bienvenu)
Attachment #151481 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #151481 - Flags: review?(neil.parkwaycc.co.uk) → review+
Comment on attachment 151481 [details] [diff] [review] (Cv1) <nsMsgBodyHandler.cpp> Compiles and works.
Fix for {{ roc+ 22. view/src/nsViewManager.cpp:2332 (See build log excerpt) Unused variable `nsresult rv' 2330 nsCOMPtr<nsIWidget> parentWidget = getter_AddRefs(widget->GetParent()); 2331 if (parentWidget.get() != aNewWidget) { 2332 nsresult rv = widget->SetParent(aNewWidget); 2333 NS_ASSERTION(NS_SUCCEEDED(rv), "SetParent failed!"); 2334 } }} (LineNo is now 2353.) due to {{ 3.323 <roc+@cs.cmu.edu> 2004-04-07 08:22 Bug 235897. hidden widgets don't count as part of the opque region. r+sr=dbaron,a=mkaply }} (This is not in the patch attached to that bug: added when checked in.)
Comment on attachment 151802 [details] [diff] [review] (Dv1) <nsViewManager.cpp> [Checked in: Comment 45] Matthias: Could you try to compile, and possibly test, this patch ? Thanks.
Attachment #151802 - Flags: superreview?(dbaron)
Attachment #151802 - Flags: review?(roc)
Fix for 9 |Unused variable `{...}'|, blamed at warren (20, 21), mjudge (5-10), jband (7); plus a few code rewrites.
Comment on attachment 151818 [details] [diff] [review] (Ev1) <xpcom/tests/*.cpp> Matthias: Could you try to compile, and possibly test, this patch ? Thanks. Doug:
Attachment #151818 - Flags: review?(dougt)
Comment on attachment 151802 [details] [diff] [review] (Dv1) <nsViewManager.cpp> [Checked in: Comment 45] Compiles and works.
Comment on attachment 151818 [details] [diff] [review] (Ev1) <xpcom/tests/*.cpp> What must I do to compile these files? My "make -f client.mk build" doesn't do that.
Attachment #151802 - Flags: superreview?(dbaron) → superreview+
Comment on attachment 151818 [details] [diff] [review] (Ev1) <xpcom/tests/*.cpp> No super-review from <dougt@meer.net> since "2004-06-27" :-( I have no compiler (and Matthias can't): Could you compile/test/review this patch ? Thanks.
Attachment #151818 - Flags: review?(dougt) → review?(alecf)
Comment on attachment 151481 [details] [diff] [review] (Cv1) <nsMsgBodyHandler.cpp> No super-review from <bienvenu@nventure.com> since "2004-06-22" :-(
Attachment #151481 - Flags: superreview?(bienvenu) → superreview?(dmose)
Comment on attachment 151481 [details] [diff] [review] (Cv1) <nsMsgBodyHandler.cpp> > void nsMsgBodyHandler::OpenLocalFolder() > { > nsCOMPtr <nsIInputStream> inputStream; > nsresult rv = m_scope->GetInputStream(getter_AddRefs(inputStream)); >- if (inputStream) >+ if (NS_SUCCEEDED(rv) && inputStream) > { > Is there ever a legimate case where NS_SUCCEEDED(rv) could return true and inputStream could be null? If not, a better fix would be something along the lines of: > if (NS_SUCCEEDED(rv)) > { > NS_ASSERTION(inputStream, "NULL inputStream returned")
(In reply to comment #36) > (From update of attachment 151481 [details] [diff] [review]) > Is there ever a legimate case where NS_SUCCEEDED(rv) could return true and > inputStream could be null? I wouldn't know: CC'ing bienvenu (as blamed author) ! Or I could simply prepare a patch your way ?
no, if there's no input stream, an error should be returned. Adding an extra check is just code bloat.
(In reply to comment #38) > no, if there's no input stream, an error should be returned. Adding an extra > check is just code bloat. Then, should I go for the assertion, or can I simply get rid of the inputStream test (== _replaced_ by rv test only) ?
Serge: sounds like either way would be fine. Might as well just replace.
Attachment #151481 - Attachment is obsolete: true
Attachment #151481 - Flags: superreview?(dmose)
Comment on attachment 156855 [details] [diff] [review] (Cv2) <nsMsgBodyHandler.cpp> [Checked in: Comment 44] Keeping {{ (Cv1) <nsMsgBodyHandler.cpp> patch 2004-06-22 15:20 PDT neil.parkwaycc.co.uk: review+ }}
Attachment #156855 - Flags: superreview?(dmose)
Attachment #156855 - Flags: review+
Comment on attachment 156855 [details] [diff] [review] (Cv2) <nsMsgBodyHandler.cpp> [Checked in: Comment 44] sr=dmose
Attachment #156855 - Flags: superreview?(dmose) → superreview+
Comment on attachment 156855 [details] [diff] [review] (Cv2) <nsMsgBodyHandler.cpp> [Checked in: Comment 44] Check in: { 2004-08-24 03:14 neil%parkwaycc.co.uk mozilla/ mailnews/ base/ search/ src/ nsMsgBodyHandler.cpp 1.27 }
Attachment #156855 - Attachment description: (Cv2) <nsMsgBodyHandler.cpp> → (Cv2) <nsMsgBodyHandler.cpp> [Checked in: Comment 44]
Attachment #156855 - Attachment is obsolete: true
Comment on attachment 151802 [details] [diff] [review] (Dv1) <nsViewManager.cpp> [Checked in: Comment 45] checked in too.
Attachment #151802 - Flags: review?(roc) → review+
Attachment #151802 - Attachment description: (Dv1) <nsViewManager.cpp> → (Dv1) <nsViewManager.cpp> [Checked in: Comment 45]
Attachment #151802 - Attachment is obsolete: true
Product: Browser → Seamonkey
Comment on attachment 151818 [details] [diff] [review] (Ev1) <xpcom/tests/*.cpp> No review from <alecf@flett.org> since "2004-08-23" :-( I have no compiler (and Matthias can't): Could you compile/test/review this patch ? Thanks.
Attachment #151818 - Flags: review?(alecf) → review?(darin)
Comment on attachment 151818 [details] [diff] [review] (Ev1) <xpcom/tests/*.cpp> >Index: mozilla/xpcom/tests/TestArray.cpp >+#ifdef DEBUG >+ nsresult rv = >+#endif >+ aArray->Count(&cnt); > NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); hmm... the point of these tests seems to be to check that things are functioning correctly. perhaps the problem here is that NS_ASSERTION is used to do the checking. perhaps in a non-debug build it would be useful to do error checking as well. i think i'd change this to always check |rv| and then output an error message such that even in a non-debug build the user would see a problem being reported. since stdout is disabled in Win32 non-debug builds, one good soln is to use NSPR logging (that's what i do in netwerk/test). >+static void Check(const char * const s1, const char * const s2, const PRIntn n) > { >+#ifdef DEBUG >+ PRIntn clib = >+#endif >+ PL_strcmp(s1, s2); >+#ifdef DEBUG >+ PRIntn clib_n = >+#endif >+ PL_strncmp(s1, s2, n); >+/* > PRIntn clib_case = PL_strcasecmp(s1, s2); > PRIntn clib_case_n = PL_strncasecmp(s1, s2, n); >+*/ why comment out this code? should it be removed instead? >+#ifdef DEBUG >+ PRIntn u2 = >+#endif >+ nsCRT::strcmp(us1, us2); >+#ifdef DEBUG >+ PRIntn u2_n = >+#endif >+ nsCRT::strncmp(us1, us2, n); > > NS_ASSERTION(sign(clib) == sign(u2), "strcmp"); > NS_ASSERTION(sign(clib_n) == sign(u2_n), "strncmp"); > } so, the whole point of this function seems to be to perform the assertion. so, what's the point of compiling this code in non-debug builds? or better yet, why not change the code as i suggested above so that it is useful in a non-debug build? the same problem occurs throughout this patch. the only thing the patch does is silence compiler warnings in non-debug builds. you could do the same by using --disable-tests in your mozconfig. perhaps the tests should be made to work in non-debug builds instead.
Attachment #151818 - Flags: review?(darin) → review-
Attachment #151402 - Attachment is obsolete: false
Attachment #151802 - Attachment is obsolete: false
Attachment #156855 - Attachment is obsolete: false
Attachment #141227 - Attachment is obsolete: false
Attachment #146639 - Attachment description: (Bv1b-r) <morkParser.cpp> (for review only) [Check in: See Bv1b-ci] → (Bv1b-r) <morkParser.cpp> (for review only)
compiler warnings are build config, let's put this there.
Component: General → Build Config
QA Contact: general → build-config
Blocks: buildwarning
Whiteboard: [Leave open until there is no more such warnings in tinderbox] → [build_warning][Leave open until there is no more such warnings in tinderbox]
All -Wunused-variable warnings have been fixed. \o/
Status: ASSIGNED → RESOLVED
Closed: 21 years ago9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: