GNOME Bugzilla – Bug 792099
gdbus-test-codegen: Cast to void* to printf "%p"
Last modified: 2018-01-04 22:39:27 UTC
to suppress a compiler error with stricter warnings enabled.
Created attachment 366143 [details] [review] gdbus-test-codegen: Cast to void* to printf "%p"
Review of attachment 366143 [details] [review]: OK, but which warning flags were you compiling with?
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.
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 ());
As the error says, that’s -Wformat. Please go ahead and push the patch to master, thanks.
Thanks for the fast review! Attachment 366143 [details] pushed as b441c21 - gdbus-test-codegen: Cast to void* to printf "%p"
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.