From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Randy Dunlap <rdunlap@infradead.org>, Tom Rix <trix@redhat.com>,
Matthew Wilcox <willy@infradead.org>
Cc: jlayton@kernel.org, bfields@fieldses.org,
viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] locks: remove trailing semicolon in macro definition
Date: Sun, 29 Nov 2020 10:15:32 -0800 [thread overview]
Message-ID: <ec43cf0faa4bfeaa4495b4e1f1c61e617d468591.camel@HansenPartnership.com> (raw)
In-Reply-To: <d65cd737-61a5-4b31-7f25-e72f0a7f4ec2@infradead.org>
On Sun, 2020-11-29 at 09:52 -0800, Randy Dunlap wrote:
> On 11/29/20 9:47 AM, Tom Rix wrote:
> > On 11/27/20 11:53 AM, Matthew Wilcox wrote:
> > > On Fri, Nov 27, 2020 at 11:07:07AM -0800, trix@redhat.com wrote:
> > > > +++ b/fs/fcntl.c
> > > > @@ -526,7 +526,7 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd,
> > > > unsigned int, cmd,
> > > > (dst)->l_whence = (src)->l_whence; \
> > > > (dst)->l_start = (src)->l_start; \
> > > > (dst)->l_len = (src)->l_len; \
> > > > - (dst)->l_pid = (src)->l_pid;
> > > > + (dst)->l_pid = (src)->l_pid
> > > This should be wrapped in a do { } while (0).
> > >
> > > Look, this warning is clearly great at finding smelly code, but
> > > the
> > > fixes being generated to shut up the warning are low quality.
> > >
> > Multiline macros not following the do {} while (0) pattern are
> > likely a larger problem.
> >
> > I'll take a look.
>
> Could it become a static inline function instead?
> or that might expand its scope too much?
I think nowadays we should always use static inlines for argument
checking unless we're capturing debug information like __FILE__ or
__LINE__ or something that a static inline can't. Even in the latter
case the pattern should probably be single line #define that captures
the information and passes it to a static inline.
There was a time when we had problems with compiler expansion of static
inlines, so we shouldn't go back and churn the code base to change it
because there's thousands of these and possibly some old compiler used
for an obscure architecture that still needs the define.
James
next prev parent reply other threads:[~2020-11-29 18:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-27 19:07 trix
2020-11-27 19:53 ` Matthew Wilcox
2020-11-29 17:47 ` Tom Rix
2020-11-29 17:52 ` Randy Dunlap
2020-11-29 18:15 ` James Bottomley [this message]
2020-11-29 22:31 ` Joe Perches
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=ec43cf0faa4bfeaa4495b4e1f1c61e617d468591.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=bfields@fieldses.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=trix@redhat.com \
--cc=viro@zeniv.linux.org.uk \
--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
all inboxes | Powered by JetHome®