Re: [PATCH v1 3/6] tracing: Mark binary printing functions with __printf() attribute

From: Andy Shevchenko
Date: Mon Mar 24 2025 - 12:12:20 EST


On Mon, Mar 24, 2025 at 6:02 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Thu, 20 Mar 2025 20:04:24 +0200
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> > -static inline void
> > +static inline __printf(2, 0)
> > +void
> > trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
> > {
> > }
>
> Do we need to split the line after the __printf()? Can't the above be:
>
> static inline __printf(2, 0) void
> trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
>
> Or even:
>
> __printf(2, 0)
> static inline void
> trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)

I really tried hard to be consistent with something. tracing code is
most inconsistent in the regard to attributes and other things (at
least in this patch series).

> I rather not split the prefix elements of a function over two lines. I
> rather not even split them from the function itself, but tend to do that if
> space is needed.

I also looked at the approaches that are used in include/linux and
tried to follow that when in doubt. And I think the way to leave
static inline leading the stub is most used, followed by attribute.
Then for the declaration is all the same, leading attribute followed
by the returning type and so on...



--
With Best Regards,
Andy Shevchenko