From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH] signal: fix building with clang Date: Thu, 7 Mar 2019 17:46:48 +0100 Message-ID: <20190307164647.GC25101@redhat.com> References: <20190307091218.2343836-1-arnd@arndb.de> <20190307152805.GA25101@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Arnd Bergmann Cc: Linux Kernel Mailing List , Nick Desaulniers , "Eric W . Biederman" , Alexander Viro , linux-arch , Ralf Baechle , Paul Burton , James Hogan , Andrew Morton , Deepa Dinamani , Christian Brauner , "Gustavo A. R. Silva" , linux-mips@vger.kernel.org List-Id: linux-arch.vger.kernel.org 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))