Closed Bug 867636 Opened 7 years ago Closed 6 years ago

js/src/jscntxt.h:615:46: warning: type attributes ignored after type is already defined [-Wattributes]

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dholbert, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

New GCC build warning (with gcc 4.8):
{
In file included from js/src/jsproxy.cpp:12:0:
js/src/jscntxt.h:615:46: warning: type attributes ignored after type is already defined [-Wattributes]
}
...and similarly, a few lines later:
{
In file included from js/src/jswrapper.cpp:10:0:
js/src/jscntxt.h:615:46: warning: type attributes ignored after type is already defined [-Wattributes]
}

The thing being warned about at line 615 is:
> class JS_FRIEND_API(AutoEnterPolicy);

This seems to be basically a new instance of bug 845868.
From a bit of hg bisecting, it looks like this was introduced by:
{
changeset:   130017:9ab1119d4596
user:        Nicholas Nethercote <nnethercote@mozilla.com>
date:        Tue Apr 23 23:44:36 2013 -0700
summary:     Bug 634839 (part 1) - Remove unnecessary headers (as found by include-what-you-use) from js/src/jsfoo.cpp files.  r=luke.
}
https://hg.mozilla.org/mozilla-central/rev/9ab1119d4596
Blocks: 634839
This happens because AutoEnterPolicy is defined in jsproxy.h, and both of these .cpp files #include jsproxy.h before jscntxt.h.  (in the case of jswrapper, its own .h file has the #include for jsproxy.h)
Attached patch fix v1Splinter Review
One way to fix this is just to #include jscntxt.h in jsproxy.h, so that we'll be guaranteed to see the forward-declaration before the definition.

There may be a better solution, though.
(It looks like this type of warning was reported as a bug to GCC in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39159 , FWIW... though that was in 2009 and there's been no action on that bug since it was filed.)
I'm pretty sure this isn't present any more.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.