From: Jani Nikula <jani.nikula@linux.intel.com>
To: David Laight <David.Laight@ACULAB.COM>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
'Linus Torvalds' <torvalds@linux-foundation.org>,
'Netdev' <netdev@vger.kernel.org>,
"'dri-devel@lists.freedesktop.org'"
<dri-devel@lists.freedesktop.org>
Cc: 'Jens Axboe' <axboe@kernel.dk>,
"'Matthew Wilcox (Oracle)'" <willy@infradead.org>,
'Christoph Hellwig' <hch@infradead.org>,
"'linux-btrfs@vger.kernel.org'" <linux-btrfs@vger.kernel.org>,
'Andrew Morton' <akpm@linux-foundation.org>,
'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>,
"'David S . Miller'" <davem@davemloft.net>,
'Dan Carpenter' <dan.carpenter@linaro.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: RE: [PATCH next v2 02/11] minmax: Use _Static_assert() instead of static_assert()
Date: Mon, 26 Feb 2024 12:27:22 +0200 [thread overview]
Message-ID: <87sf1fo705.fsf@intel.com> (raw)
In-Reply-To: <824b0f70413d4570bcc97b39aad81a93@AcuMS.aculab.com>
On Mon, 26 Feb 2024, David Laight <David.Laight@ACULAB.COM> wrote:
> From: Jani Nikula
>> Sent: 26 February 2024 09:28
>>
>> On Sun, 25 Feb 2024, David Laight <David.Laight@ACULAB.COM> wrote:
>> > The wrapper just adds two more lines of error output when the test fails.
>>
>> There are only a handful of places in kernel code that use
>> _Static_assert() directly. Nearly 900 instances of static_assert().
>
> How many of those supply an error message?
At a glance, not many.
>> Are we now saying it's fine to use _Static_assert() directly all over
>> the place? People will copy-paste and cargo cult.
>
> Is that actually a problem?
I don't know. I'm asking.
Usually when we have compiler wrappers, they're meant to be used instead
of the thing being wrapped.
This series deviates from that, so it would seem to fair to mention it
slightly more verbosely than just stating what's being done.
> The wrapper allows the error message to be omitted and substitutes
> the text of the conditional.
> But it isn't 'free'.
> As well as slightly slowing down the compilation, the error messages
> from the compiler get more difficult to interpret.
>
> Most of the static_assert() will probably never generate an error.
> But the ones in min()/max() will so it is best to make them as
> readable as possible.
> (Don't even look as the mess clang makes....)
I'm not arguing any of this. :)
BR,
Jani.
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-02-26 10:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-25 16:46 [PATCH next v2 00/11] minmax: Optimise to reduce .i line length David Laight
2024-02-25 16:48 ` [PATCH next v2 01/11] minmax: Put all the clamp() definitions together David Laight
2024-02-25 16:49 ` [PATCH next v2 02/11] minmax: Use _Static_assert() instead of static_assert() David Laight
2024-02-26 9:28 ` Jani Nikula
2024-02-26 10:07 ` David Laight
2024-02-26 10:27 ` Jani Nikula [this message]
2024-02-25 16:49 ` [PATCH next v2 03/11] minmax: Simplify signedness check David Laight
2024-02-27 1:34 ` kernel test robot
2024-02-27 9:10 ` David Laight
2024-02-25 16:50 ` [PATCH next v2 04/11] minmax: Replace multiple __UNIQUE_ID() by directly using __COUNTER__ David Laight
2024-02-25 16:51 ` [PATCH next v2 05/11] minmax: Move the signedness check out of __cmp_once() and __clamp_once() David Laight
2024-02-25 16:52 ` [PATCH next v2 06/11] minmax: Remove 'constexpr' check from __careful_clamp() David Laight
2024-02-25 16:53 ` [PATCH next v2 07/11] minmax: minmax: Add __types_ok3() and optimise defines with 3 arguments David Laight
2024-02-25 16:53 ` [PATCH next v2 08/11] minmax: Add min_const() and max_const() David Laight
2024-02-25 17:13 ` Linus Torvalds
2024-02-25 21:09 ` David Laight
2024-02-25 21:26 ` David Laight
2024-02-26 1:11 ` Dave Airlie
2024-02-25 16:54 ` [PATCH next v2 09/11] tree-wide: minmax: Replace all the uses of max() for array sizes with max_const() David Laight
2024-02-25 16:56 ` [PATCH next v2 10/11] block: Use a boolean expression instead of max() on booleans David Laight
2024-02-25 16:56 ` [PATCH next v2 11/11] minmax: min() and max() don't need to return constant expressions David Laight
2024-02-26 9:42 ` kernel test robot
2024-02-26 10:16 ` David Laight
2024-02-26 10:56 ` kernel test robot
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=87sf1fo705.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=David.Laight@ACULAB.COM \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=axboe@kernel.dk \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=netdev@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).