Revert "gdbus-codegen: emit GUnixFDLists if an arg has type 'h'"

This reverts commit 4aba03562b, preserving
the new tests but adjusting them to assert that the old behaviour is
restored.

As expected, there were a few projects which broke because of this.
Unfortunately, in one case the breakage crosses a project boundary:
sysprof ships D-Bus introspection XML, which is consumed by mutter and
passed through gdbus-codegen.

Since sysprof cannot add this annotation without breaking its existing
users, a warning is also not appropriate.

https://gitlab.gnome.org/GNOME/jhbuild/issues/41
https://gitlab.gnome.org/GNOME/sysprof/issues/17
https://gitlab.gnome.org/GNOME/glib/issues/1726
This commit is contained in:
Will Thompson 2019-10-18 10:24:42 +01:00
parent 3dec72b946
commit 43697d6b99
2 changed files with 7 additions and 13 deletions

View File

@ -284,14 +284,10 @@ class Method:
for a in self.in_args: for a in self.in_args:
a.post_process(interface_prefix, cns, cns_upper, cns_lower, arg_count) a.post_process(interface_prefix, cns, cns_upper, cns_lower, arg_count)
arg_count += 1 arg_count += 1
if 'h' in a.signature:
self.unix_fd = True
for a in self.out_args: for a in self.out_args:
a.post_process(interface_prefix, cns, cns_upper, cns_lower, arg_count) a.post_process(interface_prefix, cns, cns_upper, cns_lower, arg_count)
arg_count += 1 arg_count += 1
if 'h' in a.signature:
self.unix_fd = True
if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true': if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
self.deprecated = True self.deprecated = True

View File

@ -2602,27 +2602,24 @@ handle_hello_fd (FooiGenFDPassing *object,
static gboolean static gboolean
handle_no_annotation (FooiGenFDPassing *object, handle_no_annotation (FooiGenFDPassing *object,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GUnixFDList *fd_list,
GVariant *arg_greeting, GVariant *arg_greeting,
const gchar *arg_greeting_locale) const gchar *arg_greeting_locale)
{ {
foo_igen_fdpassing_complete_no_annotation (object, invocation, fd_list, arg_greeting, arg_greeting_locale); foo_igen_fdpassing_complete_no_annotation (object, invocation, arg_greeting, arg_greeting_locale);
return TRUE; return TRUE;
} }
static gboolean static gboolean
handle_no_annotation_nested (FooiGenFDPassing *object, handle_no_annotation_nested (FooiGenFDPassing *object,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GUnixFDList *fd_list,
GVariant *arg_files) GVariant *arg_files)
{ {
foo_igen_fdpassing_complete_no_annotation_nested (object, invocation, fd_list); foo_igen_fdpassing_complete_no_annotation_nested (object, invocation);
return TRUE; return TRUE;
} }
/* Test that generated code for methods includes GUnixFDList arguments if: /* Test that generated code for methods includes GUnixFDList arguments if and
* - the method is explicitly annotated as C.UnixFD; or * only if the method is explicitly annotated as C.UnixFD.
* - the method signature contains the type 'h'
*/ */
static void static void
test_unix_fd_list (void) test_unix_fd_list (void)
@ -2633,8 +2630,9 @@ test_unix_fd_list (void)
/* This method is explicitly annotated. */ /* This method is explicitly annotated. */
iface.handle_hello_fd = handle_hello_fd; iface.handle_hello_fd = handle_hello_fd;
/* This one is not, but it's got an in and out 'h' parameter so should
* automatically grow GUnixFDList arguments. /* This one is not annotated; even though it's got an in and out 'h' parameter, for
* backwards compatibility we cannot emit GUnixFDList arguments.
*/ */
iface.handle_no_annotation = handle_no_annotation; iface.handle_no_annotation = handle_no_annotation;
/* This method has an 'h' inside a complex type. */ /* This method has an 'h' inside a complex type. */