On Mon, 15 Dec 2025 10:40:16 -0800
Alexei Starovoitov <[email protected]> wrote:
> > But I think instead of Makefile changes we should fix the root cause
> > here. And that seems to be just wrong __printf annotations for
> > seq_bprintf and bstr_printf. They are not printf-like, they should not
> > be marked as such, and then the compiler won't be wrongly suggesting
> > bpf_stream_vprintk_impl (and others that make use of either
> > bstr_printf or seq_bprintf) to be marked with __printf.
>
> yeah. commit 7bf819aa992f ("vsnprintf: Mark binary printing functions
> with __printf() attribute")
> should be reverted,
> but that somebody else problem and the revert would need to silence
> that incorrect warning in lib/vsprintf.c too.
From what I understand, the __printf(X, 0) simply quiets the warning, which
is why those two are:
__printf(3, 0) int vbin_printf(u32 *bin_buf, size_t size, const char *fmt,
va_list args);
__printf(3, 0) int bstr_printf(char *buf, size_t size, const char *fmt, const
u32 *bin_buf);
Hence, it's not a big deal to have that. Actually, it does document that
the printf format is different than a normal printf, and that the arguments
are not the same as a normal printf.
I complained about this at first too (and never gave an acked-by), but
because it does quiet a warning, I also didn't nack it.
-- Steve