Closed Bug 1068491 Opened 10 years ago Closed 10 years ago

webidl union code generation issue

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: fabrice, Unassigned)

References

Details

The failing case I encounter is: enum Enum12345 { "value1", "value2" }; dictionary Dict12345 { (Enum12345 or sequence<Enum12345>) prop; }; That works fine if I use DOMString instead of Enum12345 in the union. The compilation error is: In file included from ../../dist/include/mozilla/ArrayUtils.h:21:0, from ../../dist/include/mozilla/PodOperations.h:19, from ../../dist/include/jspubtd.h:17, from ../../dist/include/js/RootingAPI.h:17, from ../../dist/include/nsCycleCollectionParticipant.h:13, from ../../dist/include/mozilla/DOMEventTargetHelper.h:11, from ../../dist/include/mozilla/dom/DataStore.h:8, from /home/fabrice/dev/b2g-inbound/dom/datastore/DataStore.cpp:5: ../../dist/include/mozilla/Alignment.h: In instantiation of ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’: ../../dist/include/mozilla/Alignment.h:131:5: required from ‘struct mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/Maybe.h:89:22: required from ‘class mozilla::Maybe<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/BindingDeclarations.h:176:23: required from ‘class mozilla::dom::Optional_base<mozilla::dom::OwningEnum12345OrEnum12345Sequence, mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/BindingDeclarations.h:180:7: required from ‘class mozilla::dom::Optional<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/AppsBinding.h:219:48: required from here ../../dist/include/mozilla/Alignment.h:129:23: error: invalid application of ‘sizeof’ to incomplete type ‘mozilla::dom::OwningEnum12345OrEnum12345Sequence’ char mBytes[sizeof(T)]; ^ ../../dist/include/mozilla/Alignment.h: In instantiation of ‘T* mozilla::AlignedStorage2<T>::addr() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’: ../../dist/include/mozilla/Maybe.h:265:12: required from ‘T& mozilla::Maybe<T>::ref() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/Maybe.h:416:11: required from ‘void mozilla::Maybe<T>::reset() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/Maybe.h:95:20: required from ‘mozilla::Maybe<T>::~Maybe() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/dom/BindingDeclarations.h:101:7: required from here ../../dist/include/mozilla/Alignment.h:134:66: error: ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’ has no member named ‘mBytes’ T* addr() { return static_cast<T*>(static_cast<void*>(u.mBytes)); } ^ make[5]: *** [DataStore.o] Error 1 make[5]: Leaving directory `/home/fabrice/dev/builds/obj-b2g-desktop-b2g-inbound/dom/datastore' make[4]: *** [dom/datastore/target] Error 2 make[4]: *** Waiting for unfinished jobs.... In file included from ../../../dist/include/nsTArray.h:11:0, from ../../../dist/include/MediaCache.h:10, from ../../../dist/include/MediaResource.h:16, from ../../../dist/include/MediaDecoder.h:185, from ../../../dist/include/MediaDecoderStateMachine.h:87, from /home/fabrice/dev/b2g-inbound/content/media/wave/WaveDecoder.cpp:6, from /home/fabrice/dev/builds/obj-b2g-desktop-b2g-inbound/content/media/wave/Unified_cpp_content_media_wave0.cpp:2: ../../../dist/include/mozilla/Alignment.h: In instantiation of ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’: ../../../dist/include/mozilla/Alignment.h:131:5: required from ‘struct mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../../dist/include/mozilla/Maybe.h:89:22: required from ‘class mozilla::Maybe<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../../dist/include/mozilla/dom/BindingDeclarations.h:176:23: required from ‘class mozilla::dom::Optional_base<mozilla::dom::OwningEnum12345OrEnum12345Sequence, mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../../dist/include/mozilla/dom/BindingDeclarations.h:180:7: required from ‘class mozilla::dom::Optional<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../../dist/include/mozilla/dom/AppsBinding.h:219:48: required from here ../../../dist/include/mozilla/Alignment.h:129:23: error: invalid application of ‘sizeof’ to incomplete type ‘mozilla::dom::OwningEnum12345OrEnum12345Sequence’ char mBytes[sizeof(T)]; ^ ../../../dist/include/mozilla/Alignment.h: In instantiation of ‘T* mozilla::AlignedStorage2<T>::addr() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’: ../../../dist/include/mozilla/Maybe.h:265:12: required from ‘T& mozilla::Maybe<T>::ref() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../../dist/include/mozilla/Maybe.h:416:11: required from ‘void mozilla::Maybe<T>::reset() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../../dist/include/mozilla/Maybe.h:95:20: required from ‘mozilla::Maybe<T>::~Maybe() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../../dist/include/mozilla/dom/BindingDeclarations.h:101:7: required from here ../../../dist/include/mozilla/Alignment.h:134:66: error: ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’ has no member named ‘mBytes’ T* addr() { return static_cast<T*>(static_cast<void*>(u.mBytes)); } ^ make[5]: *** [Unified_cpp_content_media_wave0.o] Error 1 make[5]: Leaving directory `/home/fabrice/dev/builds/obj-b2g-desktop-b2g-inbound/content/media/wave' make[4]: *** [content/media/wave/target] Error 2 In file included from ../../dist/include/mozilla/ArrayUtils.h:21:0, from ../../dist/include/mozilla/PodOperations.h:19, from ../../dist/include/jspubtd.h:17, from ../../dist/include/js/RootingAPI.h:17, from ../../dist/include/nsCycleCollectionParticipant.h:13, from /home/fabrice/dev/b2g-inbound/dom/base/nsWrapperCache.h:9, from ../../dist/include/mozilla/dom/DOMError.h:11, from /home/fabrice/dev/b2g-inbound/dom/mobilemessage/DOMMobileMessageError.h:10, from /home/fabrice/dev/b2g-inbound/dom/mobilemessage/DOMMobileMessageError.cpp:7, from /home/fabrice/dev/builds/obj-b2g-desktop-b2g-inbound/dom/mobilemessage/Unified_cpp_dom_mobilemessage0.cpp:15: ../../dist/include/mozilla/Alignment.h: In instantiation of ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’: ../../dist/include/mozilla/Alignment.h:131:5: required from ‘struct mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/Maybe.h:89:22: required from ‘class mozilla::Maybe<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/BindingDeclarations.h:176:23: required from ‘class mozilla::dom::Optional_base<mozilla::dom::OwningEnum12345OrEnum12345Sequence, mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/BindingDeclarations.h:180:7: required from ‘class mozilla::dom::Optional<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/AppsBinding.h:219:48: required from here ../../dist/include/mozilla/Alignment.h:129:23: error: invalid application of ‘sizeof’ to incomplete type ‘mozilla::dom::OwningEnum12345OrEnum12345Sequence’ char mBytes[sizeof(T)]; ^ ../../dist/include/mozilla/Alignment.h: In instantiation of ‘T* mozilla::AlignedStorage2<T>::addr() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’: ../../dist/include/mozilla/Maybe.h:265:12: required from ‘T& mozilla::Maybe<T>::ref() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/Maybe.h:416:11: required from ‘void mozilla::Maybe<T>::reset() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/Maybe.h:95:20: required from ‘mozilla::Maybe<T>::~Maybe() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/dom/BindingDeclarations.h:101:7: required from here ../../dist/include/mozilla/Alignment.h:134:66: error: ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’ has no member named ‘mBytes’ T* addr() { return static_cast<T*>(static_cast<void*>(u.mBytes)); } ^ make[5]: *** [Unified_cpp_dom_mobilemessage0.o] Error 1 make[5]: Leaving directory `/home/fabrice/dev/builds/obj-b2g-desktop-b2g-inbound/dom/mobilemessage' make[4]: *** [dom/mobilemessage/target] Error 2 In file included from ../../dist/include/mozilla/ArrayUtils.h:21:0, from ../../dist/include/mozilla/PodOperations.h:19, from ../../dist/include/nsTHashtable.h:17, from ../../dist/include/gfxFontFeatures.h:10, from ../../dist/include/gfxFontEntry.h:11, from ../../dist/include/gfxFont.h:10, from ../../dist/include/gfxTextRun.h:12, from /home/fabrice/dev/b2g-inbound/layout/generic/nsTextRunTransformations.h:11, from /home/fabrice/dev/b2g-inbound/layout/generic/nsTextRunTransformations.cpp:6, from /home/fabrice/dev/builds/obj-b2g-desktop-b2g-inbound/layout/generic/Unified_cpp_layout_generic3.cpp:2: ../../dist/include/mozilla/Alignment.h: In instantiation of ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’: ../../dist/include/mozilla/Alignment.h:131:5: required from ‘struct mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/Maybe.h:89:22: required from ‘class mozilla::Maybe<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/BindingDeclarations.h:176:23: required from ‘class mozilla::dom::Optional_base<mozilla::dom::OwningEnum12345OrEnum12345Sequence, mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/BindingDeclarations.h:180:7: required from ‘class mozilla::dom::Optional<mozilla::dom::OwningEnum12345OrEnum12345Sequence>’ ../../dist/include/mozilla/dom/AppsBinding.h:219:48: required from here ../../dist/include/mozilla/Alignment.h:129:23: error: invalid application of ‘sizeof’ to incomplete type ‘mozilla::dom::OwningEnum12345OrEnum12345Sequence’ char mBytes[sizeof(T)]; ^ ../../dist/include/mozilla/Alignment.h: In instantiation of ‘T* mozilla::AlignedStorage2<T>::addr() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’: ../../dist/include/mozilla/Maybe.h:265:12: required from ‘T& mozilla::Maybe<T>::ref() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/Maybe.h:416:11: required from ‘void mozilla::Maybe<T>::reset() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/Maybe.h:95:20: required from ‘mozilla::Maybe<T>::~Maybe() [with T = mozilla::dom::OwningEnum12345OrEnum12345Sequence]’ ../../dist/include/mozilla/dom/BindingDeclarations.h:101:7: required from here ../../dist/include/mozilla/Alignment.h:134:66: error: ‘union mozilla::AlignedStorage2<mozilla::dom::OwningEnum12345OrEnum12345Sequence>::U’ has no member named ‘mBytes’ T* addr() { return static_cast<T*>(static_cast<void*>(u.mBytes)); }
Blocks: 1053033
Are your enum and dictionary in the same .webidl file? See bug 767924 comment 28.
(In reply to Boris Zbarsky [:bz] from comment #1) > Are your enum and dictionary in the same .webidl file? See bug 767924 > comment 28. Ha right. Closing this one then, moving all my enums to their own files works for me.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
OK. We're going to try to figure out a sane way to make this not suck, but we're not there yet.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.