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)
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: dholbert, Assigned: atulagrwl)
References
(Blocks 1 open bug)
Details
(Whiteboard: [build_warning])
Attachments
(1 file, 1 obsolete file)
|
1.05 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
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?)
Updated•14 years ago
|
Blocks: buildwarning
| Assignee | ||
Comment 1•14 years ago
|
||
I am getting intuition that NS_ENSURE_SUCCESS must be called for other platforms also.
Assignee: nobody → atulagrwl
Status: NEW → ASSIGNED
Updated•14 years ago
|
Attachment #557021 -
Flags: review?(benjamin)
Comment 2•14 years ago
|
||
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-
| Assignee | ||
Comment 3•14 years ago
|
||
Attachment #557021 -
Attachment is obsolete: true
Attachment #557334 -
Flags: review?(benjamin)
Updated•14 years ago
|
Attachment #557334 -
Flags: review?(benjamin) → review+
| Reporter | ||
Comment 4•14 years ago
|
||
Whiteboard: [build_warning] → [build_warning][inbound]
| Reporter | ||
Updated•14 years ago
|
Target Milestone: --- → mozilla9
Comment 5•14 years ago
|
||
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.
Description
•