Closed Bug 866833 Opened 12 years ago Closed 12 years ago

GCC build warning: nsControllerCommandTable.cpp:166:12 [-Wunused-but-set-variable] variable 'rv' set but not used

Categories

(Core Graveyard :: Embedding: APIs, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla23

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The only two GCC build warnings in embedding/components/commandhandler are: { embedding/components/commandhandler/src/nsControllerCommandTable.cpp:166:12 [-Wunused-but-set-variable] variable 'rv' set but not used embedding/components/commandhandler/src/nsControllerCommandTable.cpp:184:12 [-Wunused-but-set-variable] variable 'rv' set but not used } These are for two instances of this pattern... > 166 nsresult rv; > 167 rv = FindCommandHandler(aCommandName, getter_AddRefs(commandHandler)); > 168 if (!commandHandler) > 169 { ...where we capture 'rv' but we end up just checking whether the outparam is non-null as an indication of success. This file has 4 other calls to FindCommandHandler that don't bother with the 'rv' charade and just use the null-check. And from looking at the actual FindCommandHandler() impl in that file, this null-check seems to a fine indication of success/failure, in practice. So, I think we should just drop the 'rv' charade here. (Alternately we could add a "if NS_FAILED(rv)" check, but the existing null-check already covers that, so it wouldn't really be useful.)
Summary: /nsControllerCommandTable.cpp:166:12 [-Wunused-but-set-variable] variable 'rv' set but not used → nsControllerCommandTable.cpp:166:12 [-Wunused-but-set-variable] variable 'rv' set but not used
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Depends on: 201257
The file hasn't had any significant changes since then, so it's basically un-owned. Tagging bz for review, in his capacity as embedding peer. (Note: The #if DEBUG in the patch-context is a bit silly; I'm ignoring it, because it's scattered elsewhere throughout the file, too, and it's harmless.)
Attachment #743192 - Flags: review?(bzbarsky)
Attachment #743192 - Attachment description: fix v1 → fix v1: drop 'rv' since it's unnecessary and we don't bother with it elsewhere in this file
Summary: nsControllerCommandTable.cpp:166:12 [-Wunused-but-set-variable] variable 'rv' set but not used → GCC build warning: nsControllerCommandTable.cpp:166:12 [-Wunused-but-set-variable] variable 'rv' set but not used
Comment on attachment 743192 [details] [diff] [review] fix v1: drop 'rv' since it's unnecessary and we don't bother with it elsewhere in this file r=me
Attachment #743192 - Flags: review?(bzbarsky) → review+
Thanks!
Keywords: checkin-needed
Blocks: 866983
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: