Annoying compiler warning when using Spidermonkey engine.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Annoying compiler warning when using Spidermonkey engine.

Kent Williams
This warning comes up every time I compile anything that embeds the
SpiderMonkey Engine:

.../dist/include/jspubtd.h:523:74: warning: invalid access to non-static
data member ‘js::PerThreadDataFriendFields::RuntimeDummy::mainThread’  
of NULL object [-Winvalid-offsetof]
      static const size_t RuntimeMainThreadOffset =
offsetof(RuntimeDummy, mainThread);
^
.../dist/include/jspubtd.h:523:74: warning: (perhaps the ‘offsetof’
macro was used incorrectly) [-Winvalid-offsetof]

I don't think this is really an invalid blah blah blah, but I spend a
lot of effort addressing warning in my own code, so these offend my
eye.  Since this is the only warning I've run into in the public
SpiderMonkey headers, could this get bracketed with some
warning-suppression pragmas?




_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Annoying compiler warning when using Spidermonkey engine.

Ehsan Akhgari
On 2015-03-16 4:22 PM, Kent Williams wrote:

> This warning comes up every time I compile anything that embeds the
> SpiderMonkey Engine:
>
> .../dist/include/jspubtd.h:523:74: warning: invalid access to non-static
> data member ‘js::PerThreadDataFriendFields::RuntimeDummy::mainThread’ of
> NULL object [-Winvalid-offsetof]
>       static const size_t RuntimeMainThreadOffset =
> offsetof(RuntimeDummy, mainThread);
> ^
> .../dist/include/jspubtd.h:523:74: warning: (perhaps the ‘offsetof’
> macro was used incorrectly) [-Winvalid-offsetof]
>
> I don't think this is really an invalid blah blah blah, but I spend a
> lot of effort addressing warning in my own code, so these offend my
> eye.  Since this is the only warning I've run into in the public
> SpiderMonkey headers, could this get bracketed with some
> warning-suppression pragmas?

This is undefined behavior technically.  I filed
<https://bugzilla.mozilla.org/show_bug.cgi?id=1080965> about this a
while ago, but so far nobody seems to have looked at that bug.

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Fwd: Annoying compiler warning when using Spidermonkey engine.

Sean Stangl
In reply to this post by Kent Williams
Argh, I always forget to CC the list.

Sean

---------- Forwarded message ----------
From: Sean Stangl <[hidden email]>
Date: Mon, Mar 16, 2015 at 1:37 PM
Subject: Re: Annoying compiler warning when using Spidermonkey engine.
To: Kent Williams <[hidden email]>


It's invalid C++, although GCC will happily compile it: because
RuntimeDummy inherits from JS::shadow::Runtime, which has a constructor,
RuntimeDummy isn't POD and offsetof() is undefined.

Yeah, we should fix it or suppress the warning. Filed as
https://bugzilla.mozilla.org/show_bug.cgi?id=1143843

Thanks for reporting. I'll push a new 31-based release out once it's fixed,
since 38 is still a bit far away.

Sean

On Mon, Mar 16, 2015 at 1:22 PM, Kent Williams <[hidden email]>
wrote:

> This warning comes up every time I compile anything that embeds the
> SpiderMonkey Engine:
>
> .../dist/include/jspubtd.h:523:74: warning: invalid access to non-static
> data member ‘js::PerThreadDataFriendFields::RuntimeDummy::mainThread’  of
> NULL object [-Winvalid-offsetof]
>      static const size_t RuntimeMainThreadOffset = offsetof(RuntimeDummy,
> mainThread);
> ^
> .../dist/include/jspubtd.h:523:74: warning: (perhaps the ‘offsetof’ macro
> was used incorrectly) [-Winvalid-offsetof]
>
> I don't think this is really an invalid blah blah blah, but I spend a lot
> of effort addressing warning in my own code, so these offend my eye.  Since
> this is the only warning I've run into in the public SpiderMonkey headers,
> could this get bracketed with some warning-suppression pragmas?
>
>
>
>
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine