Re: [PATCH] printf: add __printf attribute
From: Andy Shevchenko
Date: Sat Dec 06 2025 - 11:11:43 EST
On Sat, Dec 06, 2025 at 08:19:09AM -0500, Tamir Duberstein wrote:
> This produces better diagnostics when incorrect inputs are passed.
...
> -static void
> +static void __printf(2, 3)
3?!
I think it should be (2, 0). Yes, the both users call it with "%p..." in format
string, but the second parameter tells compiler to check the variadic
arguments, which are absent here. Changing 'const void *p' to '...' will align
it with the given __printf() attribute, but I don't know if this what we want.
> test_hashed(struct kunit *kunittest, const char *fmt, const void *p)
> {
> char buf[PLAIN_BUF_SIZE];
--
With Best Regards,
Andy Shevchenko