Closed Bug 845868 Opened 12 years ago Closed 12 years ago

jscntxt.h:572:7: warning: type attributes ignored after type is already defined [-Wattributes]

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Unfortunately, while the patch for bug 845277 fixed a clang build error, it introduced a GCC build warning: { In file included from js/src/jsarray.h:12:0, from js/src/shell/js.cpp:37: js/src/jscntxt.h:572:7: warning: type attributes ignored after type is already defined [-Wattributes] } I can trigger more instances of the warning by adding more copies of the JS_FRIEND_API(AutoEnterPolicy) forward-declaration to js.cpp after its include of jswrapper.h (which is what provides the AutoEnterPolicy definition, via its own include of jsproxy.h). So basically, it looks like GCC doesn't like forward-declarations-that-come-after-the-actual-definition to use JS_FRIEND_API, whereas clang mandates it (?) This kind of sucks, but fortunately we can silence the warning by moving jswrapper.h down in the #include list, so that the forward-declaration in jsarray.h ends up being an actual forward-declaration rather than a declaration-after-the-compiler-has-already-seen-the-class-definition.
Attached patch fix v1: reorder #include list (deleted) — Splinter Review
As described at the end of prev. comment, we can fix this by making the forward decl (via jsarray.h) a "true" forward decl, by moving the header that gets us the class definition to the end. Conveniently, that gets us marginally-better alphabetical order, so this isn't *just* a hack -- it's cosmetically better, too :)
Assignee: general → dholbert
Status: NEW → ASSIGNED
Attachment #719047 - Flags: review?(jwalden+bmo)
Comment on attachment 719047 [details] [diff] [review] fix v1: reorder #include list Review of attachment 719047 [details] [diff] [review]: ----------------------------------------------------------------- Ugh, so wrong. I guess we should figure out some way to put a single definition in a header and avoid forward-declaring this, in the long run, but if this works for now, and plays well with the #include ordering we aspire to (and sometimes hit), I guess r=me on this for now.
Attachment #719047 - Flags: review?(jwalden+bmo) → review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: