[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190307164647.GC25101@redhat.com>
Date: Thu, 7 Mar 2019 17:46:48 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-arch <linux-arch@...r.kernel.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Paul Burton <paul.burton@...s.com>,
James Hogan <jhogan@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Deepa Dinamani <deepa.kernel@...il.com>,
Christian Brauner <christian@...uner.io>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
linux-mips@...r.kernel.org
Subject: Re: [PATCH] signal: fix building with clang
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))
Powered by blists - more mailing lists