Re: [PATCH] kunit: Add gnu_printf specifiers
From: Brendan Higgins
Date: Tue Jun 15 2021 - 17:01:26 EST
On Thu, May 13, 2021 at 1:03 PM David Gow <davidgow@xxxxxxxxxx> wrote:
>
> Some KUnit functions use variable arguments to implement a printf-like
> format string. Use the __printf() attribute to let the compiler warn if
> invalid format strings are passed in.
>
> If the kernel is build with W=1, it complained about the lack of these
> specifiers, e.g.:
> ../lib/kunit/test.c:72:2: warning: function ‘kunit_log_append’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
>
> Signed-off-by: David Gow <davidgow@xxxxxxxxxx>
Acked-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>