Patchwork [PULL,07/14] qobject: Fix compiler warning (missing gnu_printf format attribute)

login
register
mail settings
Submitter Michael Tokarev
Date Dec. 6, 2013, 7:15 p.m.
Message ID <1386357341-19147-8-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/298230/
State New
Headers show

Comments

Michael Tokarev - Dec. 6, 2013, 7:15 p.m.
From: Stefan Weil <sw@weilnetz.de>

gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):

  CC    qobject/qerror.o
qobject/qerror.c: In function ‘qerror_from_info’:
qobject/qerror.c:53:5: error:
 function might be possible candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
     qerr->err_msg = g_strdup_vprintf(fmt, *va);
     ^

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qobject/qerror.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/qobject/qerror.c b/qobject/qerror.c
index 3aee1cf..fc8331a 100644
--- a/qobject/qerror.c
+++ b/qobject/qerror.c
@@ -42,8 +42,8 @@  static QError *qerror_new(void)
  *
  * Return strong reference.
  */
-static QError *qerror_from_info(ErrorClass err_class, const char *fmt,
-                                va_list *va)
+static QError * GCC_FMT_ATTR(2, 0)
+qerror_from_info(ErrorClass err_class, const char *fmt, va_list *va)
 {
     QError *qerr;