After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 669355 - gdbus-codegen output contains stray semicolons at file scope (forbidden in C99)
gdbus-codegen output contains stray semicolons at file scope (forbidden in C99)
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
2.30.x
Other Linux
: Normal minor
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-02-04 04:56 UTC by John Lindgren
Modified: 2017-04-10 09:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
drop trailing semi-colon from G_DEFINE_ macro (47.37 KB, patch)
2014-10-28 12:26 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description John Lindgren 2012-02-04 04:56:14 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]
Comment 1 David Zeuthen (not reading bugmail) 2012-02-05 17:12:25 UTC
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).
Comment 2 David Zeuthen (not reading bugmail) 2012-02-05 17:13:15 UTC
(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')
Comment 3 John Lindgren 2012-02-05 19:53:53 UTC
(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.
Comment 4 Jussi Pakkanen 2014-10-28 12:23:19 UTC
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.
Comment 5 Emmanuele Bassi (:ebassi) 2014-10-28 12:26:19 UTC
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.
Comment 6 Colin Walters 2016-11-22 19:48:10 UTC
Review of attachment 289517 [details] [review]:

This almost certainly needs a rebase, but fine by me.
Comment 7 Matthias Clasen 2017-04-08 05:07:00 UTC
needs a rebase, indeed
Comment 8 Philip Withnall 2017-04-10 09:50:43 UTC
Rebased and pushed.