From: Nick Desaulniers <ndesaulniers@google.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Eric W . Biederman" <ebiederm@xmission.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-arch <linux-arch@vger.kernel.org>,
Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Deepa Dinamani <deepa.kernel@gmail.com>,
Christian Brauner <christian@brauner.io>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-mips@vger.kernel.org
Subject: Re: [PATCH] signal: fix building with clang
Date: Thu, 7 Mar 2019 10:41:57 -0800 [thread overview]
Message-ID: <CAKwvOdkEuK04iqdrGR1CaHGc-3zCAS+tGnvfN8R0+j728TTPtQ@mail.gmail.com> (raw)
In-Reply-To: <20190307164647.GC25101@redhat.com>
On Thu, Mar 7, 2019 at 8:46 AM Oleg Nesterov <oleg@redhat.com> wrote:
>
> On 03/07, Arnd Bergmann wrote:
> >
> > We could use % everywhere,
>
> Yes.
>
> But again, why not simply use the "for (;;)" loops? Why we can't kill the
> supid switch(_NSIG_WORDS) tricks altogether?
>
> Oleg.
>
> --- x/include/linux/signal.h
> +++ x/include/linux/signal.h
> @@ -121,26 +121,9 @@
> #define _SIG_SET_BINOP(name, op) \
> static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
> { \
> - unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \
> - \
> - switch (_NSIG_WORDS) { \
> - case 4: \
> - a3 = a->sig[3]; a2 = a->sig[2]; \
> - b3 = b->sig[3]; b2 = b->sig[2]; \
> - r->sig[3] = op(a3, b3); \
> - r->sig[2] = op(a2, b2); \
> - /* fall through */ \
> - case 2: \
> - a1 = a->sig[1]; b1 = b->sig[1]; \
> - r->sig[1] = op(a1, b1); \
> - /* fall through */ \
> - case 1: \
> - a0 = a->sig[0]; b0 = b->sig[0]; \
> - r->sig[0] = op(a0, b0); \
> - break; \
> - default: \
> - BUILD_BUG(); \
> - } \
> + int i; \
> + for (i = 0; i < ARRAY_SIZE(r->sig); ++i) \
> + r->sig[i] = op(a->sig[i], b->sig[i]); \
> }
>
> #define _sig_or(x,y) ((x) | (y))
>
That looks much cleaner IMO.
--
Thanks,
~Nick Desaulniers
next prev parent reply other threads:[~2019-03-07 18:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 9:11 [PATCH] signal: fix building with clang Arnd Bergmann
2019-03-07 10:03 ` Christian Brauner
2019-03-07 15:28 ` Oleg Nesterov
2019-03-07 15:37 ` Arnd Bergmann
2019-03-07 16:46 ` Oleg Nesterov
2019-03-07 18:41 ` Nick Desaulniers [this message]
2019-03-07 21:45 ` Arnd Bergmann
2019-03-08 0:22 ` Nick Desaulniers
2019-03-08 0:27 ` Joe Perches
2019-03-08 21:09 ` Nick Desaulniers
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=CAKwvOdkEuK04iqdrGR1CaHGc-3zCAS+tGnvfN8R0+j728TTPtQ@mail.gmail.com \
--to=ndesaulniers@google.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=christian@brauner.io \
--cc=deepa.kernel@gmail.com \
--cc=ebiederm@xmission.com \
--cc=gustavo@embeddedor.com \
--cc=jhogan@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=viro@zeniv.linux.org.uk \
/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).