public inbox for linux-sparse@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ricardo Ribalda <ribalda@chromium.org>,
	linux-sparse@vger.kernel.org, Chris Li <chriscli@google.com>,
	Hans Verkuil <hverkuil@kernel.org>
Subject: Re: Sparse not supporting kzalloc_obj() and friends
Date: Wed, 25 Feb 2026 03:51:44 +0000	[thread overview]
Message-ID: <20260225035144.GB2924820@ZenIV> (raw)
In-Reply-To: <CAHk-=whTb01surrXakL7rgyoELuPDkqvTdh_ttNrr5rtirwopQ@mail.gmail.com>

On Mon, Feb 23, 2026 at 08:35:40AM -0800, Linus Torvalds wrote:

> instead, with a dummy empty argument to make the gcc ## trick work.
> It's smaller and denser, so it's actually superior in that sense, even
> if it feels a bit less natural than the __VA_OPT__ model.
> 
> Ricardo, can you verify that that trick works for you?
> 
> Al, comments?

I'll resurrect that branch and post it - hopefully would get something
usable by the weekend.  The main stumbling point had been getting
the interplay with side effects of expansion right - both the __COUNTER__
mess (gccism, with nothing resembling a clear semantics) *and*
the possibility of failure in expansion that had been attempted for no
reason.  Example of the latter:

#define A(X) X
#define B A(
#define Z(X,...) __VA_OPT__(X)
Z(B)

Use of Z obviously has empty vararg (not just after expansion - there's
nothing to expand).  So that __VA_OPT__(X) in its body should be
expanded to an empty token list, _without_ ever expanding the token
list (X) under __VA_OPT__.

Attempt to expand it would fail - it gets to A(, i.e. to use of
a function-like macro with unterminated argument list.

C23 is pretty clear about *not* trying to expand X in that example;
clang handles it correctly, gcc fails.  Reported to gcc bugzilla,
got pretty much no response, then got sidetracked ;-/

      parent reply	other threads:[~2026-02-25  3:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 10:51 Sparse not supporting kzalloc_obj() and friends Ricardo Ribalda
2026-02-23 16:19 ` Linus Torvalds
2026-02-23 16:35   ` Linus Torvalds
2026-02-23 17:20     ` Ricardo Ribalda
2026-02-23 18:02       ` Linus Torvalds
2026-02-25  3:51     ` Al Viro [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=20260225035144.GB2924820@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=chriscli@google.com \
    --cc=hverkuil@kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=ribalda@chromium.org \
    --cc=torvalds@linux-foundation.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