gmessages: Fix G_GNUC_PRINTF mark for g_log_structured
commitc67bd6cc541105ddc811dabb689d1e5bbdf5ae2e
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 19 Jul 2016 09:34:54 +0000 (19 11:34 +0200)
committerEmmanuele Bassi <ebassi@gnome.org>
Tue, 19 Jul 2016 10:10:34 +0000 (19 11:10 +0100)
treed2b7b94ea8ee94fbccb81ce946fe934116d5e846
parent07932996fa68fe11acd287bd0b3e7a7456b50ab5
gmessages: Fix G_GNUC_PRINTF mark for g_log_structured

GCC fails to build because of the trailing arguments, not part of the
format:

../../glib/gmessages.c: In function 'g_log_default_handler':
../../glib/gmessages.c:2385:21: error: too many arguments for format
[-Werror=format-extra-args]
                     NULL);
                     ^

The documentation for `__attribute__((format(...)))` in GCC

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

States that the second index must be 0 for functions that are not
available to be checked, like for vprintf-style functions. In this case
it's also appropriate because of the trailing arguments.

The sd-journal API in systemd, upon which the structured logging API is
modelled, also uses 0 as the second argument for the format attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
glib/gmessages.h