Warn when method/signal uses type 'h' but lacks GDBus.C.UnixFD annotation
Consider this D-Bus introspection XML:
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<interface name='org.example.Foo'>
<method name="MungeFD">
<arg type='h' name='fd_in' direction='in'/>
<arg type='h' name='fd_out' direction='out'/>
</method>
</interface>
</node>
gdbus-codegen
generates the following prototype for calling this method:
gboolean org_example_foo_call_munge_fd_sync (
OrgExampleFoo *proxy,
GVariant *arg_fd_in,
GVariant **out_fd_out,
GCancellable *cancellable,
GError **error);
Note the conspicuous lack of GUnixFDList *
/GUnixFDList **
parameters. This generated code is useless.
Adding an annotation causes useful code to be generated:
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
gboolean org_example_foo_call_munge_fd_sync (
OrgExampleFoo *proxy,
GVariant *arg_fd_in,
GUnixFDList *fd_list,
GVariant **out_fd_out,
GUnixFDList **out_fd_list,
GCancellable *cancellable,
GError **error);
It's sad that we have to add this annotation for something which the generator can work out for itself based on the h
type appearing in the method signature. (Of course, if the h
was a value in an a{sv}
this would not be possible so the annotation would always be needed in some cases).
We can't now change the generated code for the un-annotated XML without breaking existing code, but it would be nice to issue a warning if an un-annotated method/signal contains h
, suggesting that the developer may want to add this annotation.