Closed Bug 661962 Opened 14 years ago Closed 14 years ago

GCC 4.6 warning: "nsINIParser.cpp:91:14: warning: variable ‘rv’ set but not used"

Categories

(Core :: XPCOM, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: dholbert, Assigned: atulagrwl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning])

Attachments

(1 file, 1 obsolete file)

Build warning when building with g++ 4.6: { xpcom/build/nsINIParser.cpp:91:14: warning: variable ‘rv’ set but not used [-Wunused-but-set-variable] } The flagged code is: 89 nsINIParser::Init(nsILocalFile* aFile) 90 { 91 nsresult rv; [...] 99 #ifdef XP_WIN 100 nsAutoString path; 101 rv = aFile->GetPath(path); 102 NS_ENSURE_SUCCESS(rv, rv); 103 104 fd = _wfopen(path.get(), READ_BINARYMODE); 105 #else 106 nsCAutoString path; 107 rv = aFile->GetNativePath(path); 108 109 fd = fopen(path.get(), READ_BINARYMODE); 110 #endif Note that in the XP_WIN case, we *do* check rv with NS_ENSURE_SUCCESS. But in the "#else" case (e.g. on Linux), we don't check rv at all. (hence the warning) Perhaps that case needs its own NS_ENSURE_SUCCESS(rv, rv)? (Or alternately, perhaps we only need |rv| inside the XP_WIN ifdef?)
Blocks: buildwarning
Attached patch Patch v1 (obsolete) — Splinter Review
I am getting intuition that NS_ENSURE_SUCCESS must be called for other platforms also.
Assignee: nobody → atulagrwl
Status: NEW → ASSIGNED
Attachment #557021 - Flags: review?(benjamin)
Comment on attachment 557021 [details] [diff] [review] Patch v1 GetNativePath cannot fail on non-Windows, so you can remove rv entirely.
Attachment #557021 - Flags: review?(benjamin) → review-
Attached patch Patch v2Splinter Review
Attachment #557021 - Attachment is obsolete: true
Attachment #557334 - Flags: review?(benjamin)
Attachment #557334 - Flags: review?(benjamin) → review+
Whiteboard: [build_warning] → [build_warning][inbound]
Target Milestone: --- → mozilla9
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [build_warning][inbound] → [build_warning]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: