From c67bd6cc541105ddc811dabb689d1e5bbdf5ae2e Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Tue, 19 Jul 2016 11:34:54 +0200 Subject: [PATCH] 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gmessages.h b/glib/gmessages.h index 7675735d3..0b62cb4a7 100644 --- a/glib/gmessages.h +++ b/glib/gmessages.h @@ -191,7 +191,7 @@ GLIB_AVAILABLE_IN_2_50 void g_log_structured (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, - ...) G_GNUC_PRINTF (3, 4) + ...) G_GNUC_PRINTF (3, 0) G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_2_50