All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzu-Ching Yang <shingekinocore@gmail.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Eric Biggers <ebiggers@kernel.org>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	"Jose E. Marchesi" <jose.marchesi@oracle.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Simon Horman <horms@kernel.org>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] unroll: Make unrolled, unrolled_full and unrolled_none function-like
Date: Thu, 22 Oct 2026 07:16:32 +0800	[thread overview]
Message-ID: <20261021231632.687227-1-shingekinocore@gmail.com> (raw)
In-Reply-To: <0a38e0b0-2508-41c1-bd99-d15c27579307@intel.com>

On Wed, Oct 21, 2026 at 05:02:30PM +0200, Alexander Lobakin wrote:
> We have either plain-named attributes like `notrace` (BTW what if you
> name your variable as `notrace`?) or underscored like `__always_inline`.
> If you really need to name your variables `unrolled`, then I'd expect
> changing these macros to `__unrolled` etc, not to `unrolled()`.
> Although I'm not sure we really need it, there's tons of such macros in
> the kernel -- try naming your variable `current`.

A variable named notrace or current fails to build, and so does one
named unrolled_full. The one that worries me is unrolled: on GCC it
expands to an empty _Pragma(), so a function parameter of that name
compiles with only -Wunknown-pragmas warnings (not errors without
CONFIG_WERROR) and silently loses its name:

	int add(int unrolled, int x) { return unrolled + x; }

builds as "return x;" with GCC 11 to 16 (Clang rejects it). Nothing in
the tree does that today; this is about not leaving the trap for the
next file that includes <linux/unroll.h>.

I see three ways to close it:

1. This patch: make the three macros function-like, as unrolled_count()
   and UNROLL() already are. Variables, members and parameters with
   these names are then left alone. Cost: an attribute that looks like
   a call.

2. Your suggestion: rename them to __unrolled, __unrolled_full and
   __unrolled_none, like __always_inline. The attribute syntax stays,
   and nobody names a variable that way. Cost: inconsistent names,
   unless unrolled_count() is renamed as well.

3. Drop unrolled and unrolled_none, which have no users. This removes
   the silent case and touches only unroll.h; a variable named
   unrolled_full still fails to build, but with an error, not silently.

Which would you prefer? I can send v2 for 2 or 3, or leave 1 as posted.

Thanks,
Tzu-Ching

  reply	other threads:[~2026-10-21 23:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  2:56 [PATCH] unroll: Make unrolled, unrolled_full and unrolled_none function-like Tzu-Ching Yang
2026-10-20 15:54 ` Eric Biggers
2026-10-21 15:02 ` Alexander Lobakin
2026-10-21 23:16   ` Tzu-Ching Yang [this message]
2026-10-22  9:01   ` David Laight
2026-10-22 11:09     ` Tzu-Ching Yang
2026-10-23 13:42       ` Alexander Lobakin
2026-10-23 16:38         ` David Laight
2026-10-26 15:53           ` Alexander Lobakin

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=20261021231632.687227-1-shingekinocore@gmail.com \
    --to=shingekinocore@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=ardb@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=horms@kernel.org \
    --cc=jose.marchesi@oracle.com \
    --cc=kuba@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.