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 792099 - gdbus-test-codegen: Cast to void* to printf "%p"
gdbus-test-codegen: Cast to void* to printf "%p"
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2018-01-01 16:18 UTC by Daniel Boles
Modified: 2018-01-04 22:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdbus-test-codegen: Cast to void* to printf "%p" (966 bytes, patch)
2018-01-01 16:18 UTC, Daniel Boles
committed Details | Review

Description Daniel Boles 2018-01-01 16:18:10 UTC
to suppress a compiler error with stricter warnings enabled.
Comment 1 Daniel Boles 2018-01-01 16:18:13 UTC
Created attachment 366143 [details] [review]
gdbus-test-codegen: Cast to void* to printf "%p"
Comment 2 Philip Withnall 2018-01-01 20:35:11 UTC
Review of attachment 366143 [details] [review]:

OK, but which warning flags were you compiling with?
Comment 3 Daniel Boles 2018-01-01 20:42:16 UTC
I did recently add -Wpedantic, so maybe that did it, but equally I've not rebuilt GLib for quite some time. Not sure if that was after I added the -Wall and -Wextra that I already have in there.

Fwiw, this was the only thing that -Wpedenatic considers an error, not one of the billion warnings it emits! So it seemed worth submitting.

I'm aware that most of those warnings are intended since we aim to be portable, not 100% Standard-compliant, but I figured that for my own use, it can't hurt to have them scroll past, in case it helps spot an unintended case of non-compliance.
Comment 4 Daniel Boles 2018-01-01 20:43:59 UTC
This was GCC's complaint:

    gdbus-test-codegen.c: In function ‘on_handle_get_self’:
    gdbus-test-codegen.c:403:26: error: format ‘%p’ expects argument of type
     ‘void *’, but argument 2 has type ‘GThread * {aka struct _GThread *}’
     [-Werror=format=]
       s = g_strdup_printf ("%p", g_thread_self ());
Comment 5 Philip Withnall 2018-01-01 20:55:52 UTC
As the error says, that’s -Wformat. Please go ahead and push the patch to master, thanks.
Comment 6 Daniel Boles 2018-01-01 21:04:35 UTC
Thanks for the fast review!

Attachment 366143 [details] pushed as b441c21 - gdbus-test-codegen: Cast to void* to printf "%p"
Comment 7 Michael Catanzaro 2018-01-04 22:39:27 UTC
I don't normally leave useless comments in Bugzilla, but:

(In reply to Philip Withnall from comment #5)
> As the error says, that’s -Wformat. Please go ahead and push the patch to
> master, thanks.

That's terrifying, truly terrifying. RIP %p.