Closed Bug 939464 Opened 11 years ago Closed 11 years ago

warning: ‘*((void*)(& c)+16).js::CompartmentsInZoneIter::it’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: Benjamin, Assigned: Benjamin)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Attached patch uiv-zone.patch (deleted) — Splinter Review
Every since 442211bce621 from bug 928050, GCC has been spewing crap like In file included from ../jscompartment.h:13:0, from /home/benjamin/dev/mozilla/inbound/js/src/gc/Iteration.cpp:7: ../gc/Zone.h: In function ‘void JS_IterateCompartments(JSRuntime*, void*, JSIterateCompartmentCallback)’: ../gc/Zone.h:421:9: warning: ‘*((void*)(& c)+16).js::CompartmentsInZoneIter::end’ may be used uninitialized in this function [-Wmaybe-uninitialized] /home/benjamin/dev/mozilla/inbound/js/src/gc/Iteration.cpp:137:27: note: ‘*((void*)(& c)+16).js::CompartmentsInZoneIter::end’ was declared here In file included from ../jscompartment.h:13:0, from /home/benjamin/dev/mozilla/inbound/js/src/gc/Iteration.cpp:7: ../gc/Zone.h:380:13: warning: ‘*((void*)(& c)+16).js::CompartmentsInZoneIter::it’ may be used uninitialized in this function [-Wmaybe-uninitialized] /home/benjamin/dev/mozilla/inbound/js/src/gc/Iteration.cpp:137:27: note: ‘*((void*)(& c)+16).js::CompartmentsInZoneIter::it’ was declared here Here is a patch, which rewrites CompartmentsIterT to not use Maybe. It's not exactly pretty, since I have to introduce the concept of a empty CompartmentsInZoneIter.
Attachment #833374 - Flags: review?(wmccloskey)
Comment on attachment 833374 [details] [diff] [review] uiv-zone.patch Review of attachment 833374 [details] [diff] [review]: ----------------------------------------------------------------- Thanks. I suspect we could eliminate the placement new by keeping the friended nullptr constructor you added and calling it in the CompartmentsIterT constructor if zone.done() is true. Then we'd always be initializing and we could continue to use Maybe<T>. However, it's up to you what to do. I'm not sure using Maybe<T> is any cleaner than directly doing placement new.
Attachment #833374 - Flags: review?(wmccloskey) → review+
I retained the use of Maybe. It's still a bit awkward, especially Maybe now has to be friended. https://hg.mozilla.org/integration/mozilla-inbound/rev/b4c82e9838d5
Assignee: nobody → benjamin
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Comment on attachment 833374 [details] [diff] [review] uiv-zone.patch Review of attachment 833374 [details] [diff] [review]: ----------------------------------------------------------------- Somehow bugzilla seems to have lost my previous review.
Attachment #833374 - Flags: review?(wmccloskey) → review+
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: