qobject: Fix compiler warning (missing gnu_printf format attribute)
PATCH 1/1 qobject: Fix compiler warning (missing gnu_printf format attribute)
gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):
CC qobject/qerror.oqobject/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);
^---
Note: checkpatch.pl wrongly reports an error.
qobject/qerror.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qobject/qerror.c +2 -2
@@ -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;
Signature · 1 line
1.7.10.4
Michael Tokarev
AppliedQuoted 8 lines · Stefan Weil
gcc 4.8.2 reports this warning when extra warnings are enabled (-Wextra):
CC
qobject/qerror.oqobject/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); ^
Thanks, applied to the trivial-patches queue. Hopefully we found and verified all invlcations of qerror_from_info() and there really are no "wrong" invocations which will lead to new warnings after this printf attribute addition... ;)
(This function is static so only this file needed to be checked).
/mjt