[Spice-devel] [spice-common 4/8] build: Add missing G_GNUC_PRINTF annotations

Christophe Fergeau cfergeau at redhat.com
Thu Mar 28 17:35:06 UTC 2019


They were suggested by gcc when using -Wsuggest-attribute=format

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 common/log.c         | 13 +++++++------
 tests/test-logging.c |  1 +
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/common/log.c b/common/log.c
index b73da71..7cb3e36 100644
--- a/common/log.c
+++ b/common/log.c
@@ -33,12 +33,13 @@ SPICE_CONSTRUCTOR_FUNC(spice_log_init)
     recorder_dump_on_common_signals(0, 0);
 }
 
-static void spice_logv(const char *log_domain,
-                       GLogLevelFlags log_level,
-                       const char *strloc,
-                       const char *function,
-                       const char *format,
-                       va_list args)
+static G_GNUC_PRINTF(5, 0)
+void spice_logv(const char *log_domain,
+                GLogLevelFlags log_level,
+                const char *strloc,
+                const char *function,
+                const char *format,
+                va_list args)
 {
     GString *log_msg;
 
diff --git a/tests/test-logging.c b/tests/test-logging.c
index 6a79ca9..32b0c33 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -27,6 +27,7 @@
 
 #define OTHER_LOG_DOMAIN "Other"
 #define LOG_OTHER_HELPER(suffix, level)                                          \
+    G_GNUC_PRINTF(1, 2)                                                          \
     static void G_PASTE(other_, suffix)(const gchar *format, ...)                \
     {                                                                            \
         va_list args;                                                            \
-- 
2.21.0



More information about the Spice-devel mailing list