On Tue, Dec 19, 2023 at 6:16 PM Stephen Hemminger
<step...@networkplumber.org> wrote:
>
> On Tue, 19 Dec 2023 16:45:19 +0100
> Thomas Monjalon <tho...@monjalon.net> 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'), \
> > > +           "This log format string contains a \\n")
> > > +#else
> > > +#define RTE_LOG_CHECK_NO_NEWLINE(...)
> > > +#endif
> >
> > No support in clang?
>
> clang has static assert, but probably not builtin_strchr

clang seems to have support for __builtin_strchr (which was not
obvious to me when I first looked at it).
Testing with clang ("thanks" to net/mlx4), I realised that this check
relies on some gnu extension (constant folding) which breaks
compilation with -pedantic.

An additional check on PEDANTIC is needed, and I can then add support for clang.


-- 
David Marchand

Reply via email to