From: Petr Mladek <pmladek@suse.com>
To: Tamir Duberstein <tamird@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org, oe-kbuild-all@lists.linux.dev,
llvm@lists.linux.dev, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v2] printf: convert test_hashed into macro
Date: Wed, 21 Jan 2026 17:07:12 +0100 [thread overview]
Message-ID: <aXD5sNXwhnU5ycam@pathway> (raw)
In-Reply-To: <CAJ-ks9kOpAVq=-b2AXp02F2gJEAmJZxKE=UAGa5ypsVE_an3pQ@mail.gmail.com>
On Tue 2026-01-20 10:50:09, Tamir Duberstein wrote:
> On Mon, Jan 19, 2026 at 3:21 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Fri, Jan 16, 2026 at 11:27:03AM -0500, Tamir Duberstein wrote:
> > > This allows the compiler to check the arguments against the __printf
> >
> > __printf() since it takes parameters, OTOH it's an attribute at the end,
> > so I have no strong opinion on how to spell it.
> >
> > > attribute on __test. This produces better diagnostics when incorrect
> >
> > __test()
> >
> > *This is reference to a function.
> >
> > > inputs are passed.
> >
> > ...
> >
> > > +/*
> > > + * This is a macro so that the compiler can compare its arguments to the
> > > + * __printf attribute on __test. This cannot be a function with a __printf
> > > + * attribute because GCC requires __printf functions to be variadic.
> >
> > As per commit message remarks.
> >
> > > + */
> > > +#define test_hashed(kunittest, fmt, p) \
> > > + do { \
> > > + char buf[PLAIN_BUF_SIZE]; \
> > > + plain_hash_to_buffer(kunittest, p, buf, PLAIN_BUF_SIZE); \
> > > + test(buf, fmt, p); \
> > > + } while (0)
> >
> > Make sure you used tabs to indent the \:s.
> >
> > ...
> >
> > The downside of a macro is a killing of compile-time type checks.
>
> This macro still bottoms out in __test() which is a function, so I
> believe it preserves (and enhances, per the commit message)
> compile-time checks.
>
> I'll send v3 with the changes you requested above.
JFYI, I am fine with this approach.
Best Regards,
Petr
prev parent reply other threads:[~2026-01-21 16:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 16:27 [PATCH v2] printf: convert test_hashed into macro Tamir Duberstein
2026-01-19 8:21 ` Andy Shevchenko
2026-01-20 15:50 ` Tamir Duberstein
2026-01-21 16:07 ` Petr Mladek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aXD5sNXwhnU5ycam@pathway \
--to=pmladek@suse.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tamird@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox