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

[libvirt] [PATCH 3/6] Enable -Wmissing-format-attribute warning



Add a couple of missing ATTRIBUTE_FMT_PRINTF annotations

* tools/virsh.c, tests/testutils.c: Add printf format attribute
* m4/virt-compile-warnings.m4: Enable -Wmissing-format-attribute
---
 m4/virt-compile-warnings.m4 |    1 -
 tests/testutils.c           |    2 +-
 tools/virsh.c               |    3 ++-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index f8ee474..51e21a9 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -49,7 +49,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
         dontwarn="$dontwarn -Wpacked"
         dontwarn="$dontwarn -Wunused-macros"
         dontwarn="$dontwarn -Woverlength-strings"
-        dontwarn="$dontwarn -Wmissing-format-attribute"
         dontwarn="$dontwarn -Wstack-protector"
 
         # Get all possible GCC warnings
diff --git a/tests/testutils.c b/tests/testutils.c
index 3110457..0ce3c7b 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -67,7 +67,7 @@ virtTestCountAverage(double *items, int nitems)
     return (double) (sum / nitems);
 }
 
-
+ATTRIBUTE_FMT_PRINTF(3,4)
 void virtTestResult(const char *name, int ret, const char *msg, ...)
 {
     va_list vargs;
diff --git a/tools/virsh.c b/tools/virsh.c
index 19e3449..4765f5c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -243,7 +243,8 @@ static int vshInit(vshControl *ctl);
 static int vshDeinit(vshControl *ctl);
 static void vshUsage(void);
 static void vshOpenLogFile(vshControl *ctl);
-static void vshOutputLogFile(vshControl *ctl, int log_level, const char *format, va_list ap);
+static void vshOutputLogFile(vshControl *ctl, int log_level, const char *format, va_list ap)
+    ATTRIBUTE_FMT_PRINTF(3, 0);
 static void vshCloseLogFile(vshControl *ctl);
 
 static int vshParseArgv(vshControl *ctl, int argc, char **argv);
-- 
1.7.4


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