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

RESOLVED FIXED

Status

()

Core
XPConnect
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [build_warning], URL)

Attachments

(1 attachment)

(Assignee)

Description

8 years ago
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;
(Assignee)

Comment 1

8 years ago
Created attachment 447600 [details] [diff] [review]
fix
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #447600 - Flags: review?(ehsan)

Comment 2

8 years ago
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+
(Assignee)

Comment 3

8 years ago
Landed.  Thanks for the quick review!
http://hg.mozilla.org/mozilla-central/rev/85a03643b723
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Updated

8 years ago
Whiteboard: [build_warning]
You need to log in before you can comment on or make changes to this bug.