From: Johannes Berg <johannes@sipsolutions.net>
To: Alexander Lobakin <alexandr.lobakin@intel.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] bitfield: add FIELD_PREP_CONST()
Date: Wed, 18 Jan 2023 17:22:30 +0100 [thread overview]
Message-ID: <3fe52061d5d9e3701f598add5c64f8b3583c31df.camel@sipsolutions.net> (raw)
In-Reply-To: <92209c00-7fcf-1592-e97c-f49e7734fdfc@intel.com>
On Wed, 2023-01-18 at 17:10 +0100, Alexander Lobakin wrote:
>
> Have you tried combining it with FIELD_PREP() using
> __builtin_choose_expr() + __builtin_is_constexpr() (or
> __builtin_constant_p() depending on which will satisfy the compiler)?
> I'm not saying it's 100% possible, but worth trying.
>
I haven't tried it that way, but I tried rewriting FIELD_PREP() itself
to be constant-compatible, and as soon as the compiler saw
__builtin_constant_p() in the initializer it already complained that it
was non-constant...
I didn't think of __builtin_choose_expr, but it doesn't work either
because it only promises that the unused expression is not *evaluated*,
not that it's not "looked at", so it still complains both ways (in the
constant case that you can't have ({ }) braced groups, and in the non-
constant case that the _CONST version is bad...
johannes
next prev parent reply other threads:[~2023-01-18 16:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 13:26 [PATCH] bitfield: add FIELD_PREP_CONST() Johannes Berg
2023-01-18 16:10 ` Alexander Lobakin
2023-01-18 16:22 ` Johannes Berg [this message]
2023-01-18 16:49 ` Alexander Lobakin
2023-01-18 18:03 ` Johannes Berg
2023-01-18 18:21 ` Alexander Lobakin
2023-01-18 19:41 ` Johannes Berg
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=3fe52061d5d9e3701f598add5c64f8b3583c31df.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=alexandr.lobakin@intel.com \
--cc=linux-wireless@vger.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