From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>
Cc: "Tyler Retzlaff" <roretzla@linux.microsoft.com>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
<dev@dpdk.org>
Subject: RE: static_assert, sfc, and clang issues
Date: Wed, 17 Jan 2024 10:37:21 +0100 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F16C@smartserver.smartshare.dk> (raw)
In-Reply-To: <20240116144952.3614593f@hermes.local>
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, 16 January 2024 23.50
>
> On Tue, 16 Jan 2024 23:14:36 +0100
> Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > > +1 for #2 just make it a block.
> >
> > I prefer that you implement the workaround in the RTE_BUILD_BUG_ON()
> macro, by surrounding it by "do { } while (0)", like this:
> >
> > #define RTE_BUILD_BUG_ON(condition) do { static_assert(!(condition),
> #condition); } while (0)
> >
> > And please mention the workaround reason, with the reference to the
> clang bug, in the source code comment describing the function.
> >
> > The godbolt link in the clang issue seems happy with this workaround.
>
> In the patch series sent, already did that. Didn't need to do { }
> while(0) hack to make it work.
It works in the problematic file, but not generally.
Without the do/while, "RTE_BUILD_BUG_ON(condition);" will expand to two lines:
{ static_assert(...); }
;
... which may be problematic when used with if/else without curly braces.
However, I do admit that this problem is probably purely theoretical.
> Reference is in commit message.
Yes, but if someone only looks at the source code, the workaround looks strange and unnecessary.
Personally, I prefer not having to dig into commit logs when reviewing code. Maybe it's just me. I'll leave the decision to you.
prev parent reply other threads:[~2024-01-17 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 17:03 static_assert, sfc, and clang issues Stephen Hemminger
2024-01-16 21:50 ` Tyler Retzlaff
2024-01-16 22:14 ` Morten Brørup
2024-01-16 22:18 ` Morten Brørup
2024-01-16 22:49 ` Stephen Hemminger
2024-01-17 8:07 ` Andrew Rybchenko
2024-01-17 9:37 ` Morten Brørup [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=98CBD80474FA8B44BF855DF32C47DC35E9F16C@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=roretzla@linux.microsoft.com \
--cc=stephen@networkplumber.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 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.