[glib] gmessages: Fix G_GNUC_PRINTF mark for g_log_structured



commit c67bd6cc541105ddc811dabb689d1e5bbdf5ae2e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jul 19 11:34:54 2016 +0200

    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 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmessages.h b/glib/gmessages.h
index 7675735..0b62cb4 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]