GNOME Bugzilla – Bug 669355
gdbus-codegen output contains stray semicolons at file scope (forbidden in C99)
Last modified: 2017-04-10 09:50:48 UTC
gdbus-codegen mistakenly puts semicolons after an invocation of the G_DEFINE_INTERFACE macro. For the correct usage of G_DEFINE_INTERFACE, look at the example for G_DEFINE_INTERFACE in http://developer.gnome.org/gobject/stable/gtype-non-instantiable-classed.html and notice that there is no semicolon. Here is an example of code generated by gdbus-codegen: https://github.com/audacious-media-player/audacious-plugins/blob/master/src/mpris2/object-core.c When this file is compiled by GCC in strict C99 mode, it produces the following warnings: object-core.c:435:75: warning: ISO C does not allow extra ‘;’ outside of a function [-pedantic] object-core.c:875:113: warning: ISO C does not allow extra ‘;’ outside of a function [-pedantic] object-core.c:1538:116: warning: ISO C does not allow extra ‘;’ outside of a function [-pedantic]
Sure, we can fix this, shouldn't be very hard. BTW: you are not supposed to be storing (nor distributing in tarballs) code generated by gdbus-codegen(1).
(In reply to comment #1) > BTW: you are not supposed to be storing (nor distributing in tarballs) code > generated by gdbus-codegen(1). (And with 'storing' I of course mean 'store in a version control system')
(In reply to comment #2) > (In reply to comment #1) > > BTW: you are not supposed to be storing (nor distributing in tarballs) code > > generated by gdbus-codegen(1). > > (And with 'storing' I of course mean 'store in a version control system') Okay, though that archive contains also the .xml definition and a script with the exact command used to generate that code. I just have been too lazy/busy to integrate it into the build process properly.
This bug is still present in 2.42.0. More specifically each xml seems to provide three different instances of this problem. The first one looks like this: G_DEFINE_INTERFACE (FooBar, service_iface_foobar, G_TYPE_OBJECT); The second one looks like this: #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 G_DEFINE_TYPE_WITH_CODE (FooBarProxy, service_iface_foobar_proxy, G_TYPE_DBUS_PROXY, G_ADD_PRIVATE (ServiceIfaceComCanonicalURLDispatcherProxy) G_IMPLEMENT_INTERFACE (SERVICE_IFACE_TYPE_FOOBAR, service_iface_com_foobar_proxy_iface_init)); #else G_DEFINE_TYPE_WITH_CODE (FoobarProxy, service_iface_foobarr_proxy, G_TYPE_DBUS_PROXY, G_IMPLEMENT_INTERFACE (SERVICE_IFACE_TYPE_FOOBAR, service_iface_foobar_proxy_iface_init)); #endif and the final one looks like the second one except it deals with the skeleton instead of iface. All these have semicolons at the end and -Wpedantic will give the warning listed above.
Created attachment 289517 [details] [review] drop trailing semi-colon from G_DEFINE_ macro this goes through the whole of GLib and tries to remove the trailing semi-colon; this includes the gdbus-codegen code base.
Review of attachment 289517 [details] [review]: This almost certainly needs a rebase, but fine by me.
needs a rebase, indeed
Rebased and pushed.