Closed Bug 977141 Opened 6 years ago Closed 6 years ago

Binding code does not compile when disabling unified compilation

Categories

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

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: bwc, Assigned: bzbarsky)

Details

Attachments

(3 files, 1 obsolete file)

While experimenting with bug 975076, I observed that the binding code fails to compile when unified compilation was disabled (by editing the python scripting), due to some files not including what they use. Some of it is brokenness in non-generated header files, and some of it seems to be caused by the binding generation code itself.
The state of my experimentation with the unified binding build. Compiles on my machine, does not link.
Assignee: nobody → docfaraday
Status: NEW → ASSIGNED
Here's a patch that makes the unified bindings bits respect
--disable-unified-compilation.

Apply, configure with --disable-unified-compilation, build, and you will see
things like:

In file included from ../../dist/include/mozilla/dom/BindingDeclarations.h:22:0,
                 from ../../dist/include/mozilla/dom/AttrBinding.h:9,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:3,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/nsAutoPtr.h: In instantiation of ‘nsRefPtr<T>::~nsRefPtr() [with T = nsDOMAttributeMap]’:
../../dist/include/nsIAttribute.h:18:7:   required from here
../../dist/include/nsAutoPtr.h:900:13: error: invalid use of incomplete type ‘class nsDOMAttributeMap’
In file included from ../../dist/include/nsIAttribute.h:9:0,
                 from ../../dist/include/mozilla/dom/Attr.h:14,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:6,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/nsINode.h:35:7: error: forward declaration of ‘class nsDOMAttributeMap’
In file included from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:7:0,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/BindingUtils.h: In instantiation of ‘JSObject* mozilla::dom::WrapNativeISupportsParent(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’:
../../dist/include/mozilla/dom/BindingUtils.h:1289:62:   required from ‘static JSObject* mozilla::dom::WrapNativeParentHelper<T, false>::Wrap(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1303:61:   required from ‘JSObject* mozilla::dom::WrapNativeParent(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1312:77:   required from ‘JSObject* mozilla::dom::WrapNativeParent(JSContext*, JS::Handle<JSObject*>, const T&) [with T = nsIDocument*]’
/opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:387:81:   required from here
../../dist/include/mozilla/dom/BindingUtils.h:1215:45: error: no matching function for call to ‘ToSupports(nsIDocument*&)’
../../dist/include/mozilla/dom/BindingUtils.h:1215:45: note: candidates are:
In file included from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:6:0,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/Attr.h:75:3: note: template<class T> nsISupports* mozilla::dom::ToSupports(T*, mozilla::dom::Attr::cycleCollection*)
../../dist/include/mozilla/dom/Attr.h:75:3: note:   template argument deduction/substitution failed:
In file included from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:7:0,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/BindingUtils.h:1215:45: note:   candidate expects 2 arguments, 1 provided
In file included from ../../dist/include/mozilla/dom/BindingUtils.h:16:0,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:7,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/CallbackObject.h:47:3: note: template<class T> nsISupports* mozilla::dom::ToSupports(T*, mozilla::dom::CallbackObject::cycleCollection*)
../../dist/include/mozilla/dom/CallbackObject.h:47:3: note:   template argument deduction/substitution failed:
In file included from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:7:0,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/BindingUtils.h:1215:45: note:   candidate expects 2 arguments, 1 provided
In file included from ../../dist/include/mozilla/dom/CallbackObject.h:31:0,
                 from ../../dist/include/mozilla/dom/BindingUtils.h:16,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:7,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
/home/froydnj/src/gecko-dev.git/dom/base/nsJSEnvironment.h:44:3: note: template<class T> nsISupports* ToSupports(T*, nsJSContext::cycleCollection*)
/home/froydnj/src/gecko-dev.git/dom/base/nsJSEnvironment.h:44:3: note:   template argument deduction/substitution failed:
In file included from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:7:0,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/BindingUtils.h:1215:45: note:   candidate expects 2 arguments, 1 provided
In file included from ../../dist/include/nsIAttribute.h:9:0,
                 from ../../dist/include/mozilla/dom/Attr.h:14,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:6,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/nsINode.h:1782:1: note: nsISupports* ToSupports(nsINode*)
../../dist/include/nsINode.h:1782:1: note:   no known conversion for argument 1 from ‘nsIDocument*’ to ‘nsINode*’
In file included from ../../dist/include/nsCOMPtr.h:43:0,
                 from ../../dist/include/mozilla/dom/BindingDeclarations.h:20,
                 from ../../dist/include/mozilla/dom/AttrBinding.h:9,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:3,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/nsCycleCollectionNoteChild.h:47:14: note: template<class T> nsISupports* ToSupports(T*, typename T::cycleCollection*)
../../dist/include/nsCycleCollectionNoteChild.h:47:14: note:   template argument deduction/substitution failed:
../../dist/include/nsCycleCollectionNoteChild.h: In substitution of ‘template<class T> nsISupports* ToSupports(T*, typename T::cycleCollection*) [with T = nsIDocument]’:
../../dist/include/mozilla/dom/BindingUtils.h:1215:45:   required from ‘JSObject* mozilla::dom::WrapNativeISupportsParent(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1289:62:   required from ‘static JSObject* mozilla::dom::WrapNativeParentHelper<T, false>::Wrap(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1303:61:   required from ‘JSObject* mozilla::dom::WrapNativeParent(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1312:77:   required from ‘JSObject* mozilla::dom::WrapNativeParent(JSContext*, JS::Handle<JSObject*>, const T&) [with T = nsIDocument*]’
/opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:387:81:   required from here
../../dist/include/nsCycleCollectionNoteChild.h:47:14: error: invalid use of incomplete type ‘class nsIDocument’
In file included from ../../dist/include/nsINode.h:13:0,
                 from ../../dist/include/nsIAttribute.h:9,
                 from ../../dist/include/mozilla/dom/Attr.h:14,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:6,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/nsINodeInfo.h:36:7: error: forward declaration of ‘class nsIDocument’
In file included from ../../dist/include/nsISupportsUtils.h:26:0,
                 from ../../dist/include/nsCOMPtr.h:34,
                 from ../../dist/include/mozilla/dom/BindingDeclarations.h:20,
                 from ../../dist/include/mozilla/dom/AttrBinding.h:9,
                 from /opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:3,
                 from /opt/build/froydnj/build-mc/dom/bindings/UnifiedBindings7.cpp:2:
../../dist/include/mozilla/dom/BindingUtils.h: In instantiation of ‘JSObject* mozilla::dom::WrapNativeISupportsParent(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’:
../../dist/include/mozilla/dom/BindingUtils.h:1289:62:   required from ‘static JSObject* mozilla::dom::WrapNativeParentHelper<T, false>::Wrap(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1303:61:   required from ‘JSObject* mozilla::dom::WrapNativeParent(JSContext*, JS::Handle<JSObject*>, T*, nsWrapperCache*) [with T = nsIDocument]’
../../dist/include/mozilla/dom/BindingUtils.h:1312:77:   required from ‘JSObject* mozilla::dom::WrapNativeParent(JSContext*, JS::Handle<JSObject*>, const T&) [with T = nsIDocument*]’
/opt/build/froydnj/build-mc/dom/bindings/AttrBinding.cpp:387:81:   required from here
../../dist/include/nsISupportsImpl.h:38:1: note: nsISupports* ToSupports(nsISupports*)
../../dist/include/nsISupportsImpl.h:38:1: note:   no known conversion for argument 1 from ‘nsIDocument*’ to ‘nsISupports*’
The changes are basically that everyone needs to #include whatever types they're returning from GetParentObject
(because bindings code needs to know whether those inherit nsISupports, etc) and Attr's destructor needs to
be callable by binding code as needed.
Attachment #8382290 - Flags: review?(bugs)
Assignee: docfaraday → bzbarsky
The changes are basically that everyone needs to #include whatever types they're returning from GetParentObject
(because bindings code needs to know whether those inherit nsISupports, etc), that Attr's destructor needs to
be callable by binding code as needed, and that we can't use ElementInlines stuff from bindings sanely.
Attachment #8382302 - Flags: review?(bugs)
Attachment #8382290 - Attachment is obsolete: true
Attachment #8382290 - Flags: review?(bugs)
Attachment #8382302 - Flags: review?(bugs) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/cb8e5f269356
Flags: in-testsuite-
Target Milestone: --- → mozilla30
https://hg.mozilla.org/mozilla-central/rev/cb8e5f269356
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.