Re: [PATCH v4 11/14] log: add a per line log helper

2023-12-20 Thread David Marchand
On Tue, Dec 19, 2023 at 6:16 PM Stephen Hemminger wrote: > > On Tue, 19 Dec 2023 16:45:19 +0100 > Thomas Monjalon wrote: > > > 18/12/2023 15:38, David Marchand: > > > +#ifdef RTE_TOOLCHAIN_GCC > > > +#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \ > > > + static_assert(!__builtin_strchr(fmt, '\n'), \ >

Re: [PATCH v4 11/14] log: add a per line log helper

2023-12-19 Thread Thomas Monjalon
18/12/2023 15:38, David Marchand: > +#ifdef RTE_TOOLCHAIN_GCC > +#define RTE_LOG_CHECK_NO_NEWLINE(fmt) \ > + static_assert(!__builtin_strchr(fmt, '\n'), \ > + "This log format string contains a \\n") > +#else > +#define RTE_LOG_CHECK_NO_NEWLINE(...) > +#endif No support in clang?

[PATCH v4 11/14] log: add a per line log helper

2023-12-18 Thread David Marchand
gcc builtin __builtin_strchr can be used as a static assertion to check whether passed format strings contain a \n. This can be useful to detect double \n in log messages. Signed-off-by: David Marchand Acked-by: Stephen Hemminger Acked-by: Chengwen Feng --- Changes since v3: - fixed some checkp