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

[libvirt] [libvirt-glib 2/3] glib: Add G_GNUC_PRINTF where appropriate



This is used to tell the compiler about printf-like format strings
used by some functions. Without this marking, gcc 4.8 is outputs
warnings to recommend using it.
---
 libvirt-glib/libvirt-glib-error.c |  3 +++
 libvirt-glib/libvirt-glib-error.h | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libvirt-glib/libvirt-glib-error.c b/libvirt-glib/libvirt-glib-error.c
index 6598948..889fceb 100644
--- a/libvirt-glib/libvirt-glib-error.c
+++ b/libvirt-glib/libvirt-glib-error.c
@@ -259,6 +259,9 @@ void gvir_set_error_valist(GError **error,
 }
 
 static void
+gvir_log_valist(GLogLevelFlags level, const gchar *format, va_list args) G_GNUC_PRINTF(2, 0);
+
+static void
 gvir_log_valist(GLogLevelFlags level, const gchar *format, va_list args)
 {
     gchar *message;
diff --git a/libvirt-glib/libvirt-glib-error.h b/libvirt-glib/libvirt-glib-error.h
index 88d8d29..2a7e35d 100644
--- a/libvirt-glib/libvirt-glib-error.h
+++ b/libvirt-glib/libvirt-glib-error.h
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
 GError *gvir_error_new(GQuark domain,
                        gint code,
                        const gchar *format,
-                       ...);
+                       ...) G_GNUC_PRINTF(3, 4);
 
 GError *gvir_error_new_literal(GQuark domain,
                                gint code,
@@ -40,13 +40,13 @@ GError *gvir_error_new_literal(GQuark domain,
 GError *gvir_error_new_valist(GQuark domain,
                               gint code,
                               const gchar *format,
-                              va_list args);
+                              va_list args) G_GNUC_PRINTF(3, 0);
 
 void gvir_set_error(GError **error,
                     GQuark domain,
                     gint code,
                     const gchar *format,
-                    ...);
+                    ...) G_GNUC_PRINTF(4, 5);
 
 void gvir_set_error_literal(GError **error,
                             GQuark domain,
@@ -57,10 +57,10 @@ void gvir_set_error_valist(GError **error,
                            GQuark domain,
                            gint code,
                            const gchar *format,
-                           va_list args);
+                           va_list args) G_GNUC_PRINTF(4, 0);
 
-void gvir_critical(const gchar *format, ...);
-void gvir_warning(const gchar *format, ...);
+void gvir_critical(const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void gvir_warning(const gchar *format, ...) G_GNUC_PRINTF(1, 2);
 
 G_END_DECLS
 
-- 
1.8.2.1


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