Closed Bug 568324 Opened 11 years ago Closed 11 years ago

mozJSSubScriptLoader.cpp:116: warning: statement has no effect

Categories

(Core :: XPConnect, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

References

()

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

Filing this bug for this warning:
{
> js/src/xpconnect/loader/mozJSSubScriptLoader.cpp:116: warning: statement has no effect
}

The chunk of code is:
> 92 NS_IMETHODIMP /* args and return value are delt with using XPConnect and JSAPI */
> 93 mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
> 94                                      /* [, JSObject *target_obj] */)
> 95 {
[...]
>112 #ifdef NS_FUNCTION_TIMER
>113     NS_TIME_FUNCTION_FMT("%s (line %d) (url: %s)", MOZ_FUNCTION_NAME,
>114                          __LINE__, NS_LossyConvertUTF16toASCII(aURL).get());
>115 #else
>116     aURL; // prevent compiler warning
>117 #endif

I'm assuming we're trying to suppress an "unused" compiler warning, but in the process, we're actually causing another compiler warning.

The correct way to suppress "unused" (at least in GCC) is:
  (void)aURL;
instead of
  aURL;
Attached patch fixSplinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #447600 - Flags: review?(ehsan)
Comment on attachment 447600 [details] [diff] [review]
fix

Your assumption is true, this was my bad.  Thanks for catching (and fixing) this!
Attachment #447600 - Flags: review?(ehsan) → review+
Landed.  Thanks for the quick review!
http://hg.mozilla.org/mozilla-central/rev/85a03643b723
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [build_warning]
You need to log in before you can comment on or make changes to this bug.