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 659690 - Possible build warning in code generated by gdbus-codegen
Possible build warning in code generated by gdbus-codegen
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-09-21 10:55 UTC by Xavier Claessens
Modified: 2011-09-21 12:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdbus-codegen: prepend arg_ to method/signal arg names (9.04 KB, patch)
2011-09-21 11:43 UTC, Xavier Claessens
committed Details | Review

Description Xavier Claessens 2011-09-21 10:55:46 UTC
Telepathy spec has a signal with an arg called "time". This generates this function:

void
tp_gdbus_debug_emit_new_debug_message (
    TpGDBusDebug *object,
    gdouble time,
    const gchar *domain,
    guint level,
    const gchar *message)
{
  g_signal_emit_by_name (object, "new-debug-message", time, domain, level, message);
}

Which makes build error:

_gen/tp-gdbus.c: In function 'tp_gdbus_debug_emit_new_debug_message':
_gen/tp-gdbus.c:72126:13: error: declaration of 'time' shadows a global declaration [-Werror=shadow]

The current telepathy generator workaround this by prepending "arg_" to all function arg names.
Comment 1 Xavier Claessens 2011-09-21 11:06:03 UTC
Guess I could --annotate it, or change in the spec, if you consider it's not worth prefixing names in gdbus-codegen.
Comment 2 David Zeuthen (not reading bugmail) 2011-09-21 11:19:12 UTC
Good point. I guess it's fine to prepend - we already prepend OUT arguments with out_. Suggest we keep out_ for OUT arguments and prepend non-OUT arguments with arg_.
Comment 3 Xavier Claessens 2011-09-21 11:43:33 UTC
Created attachment 197147 [details] [review]
gdbus-codegen: prepend arg_ to method/signal arg names

This is to avoid shadow declaration warning in the case an arg name
is "time" for example.
Comment 4 David Zeuthen (not reading bugmail) 2011-09-21 11:54:06 UTC
Looks good to me, passes the test suite and the various gdbus-codegen(1)-using projects of mine. I'm pushing it to master and also glib-2-30 since it's not something we want to miss (why I added Ryan to the Cc). Thanks!
Comment 5 Xavier Claessens 2011-09-21 12:19:41 UTC
Closing, thanks.