From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 11/12] sched: use for_each_if in topology.h Date: Mon, 9 Jul 2018 18:03:42 +0200 Message-ID: <20180709160342.GA2476@hirez.programming.kicks-ass.net> References: <20180709083650.23549-1-daniel.vetter@ffwll.ch> <20180709083650.23549-11-daniel.vetter@ffwll.ch> <20180709103656.GH2476@hirez.programming.kicks-ass.net> <20180709151258.GV2476@hirez.programming.kicks-ass.net> <20180709155204.GD3008@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180709155204.GD3008@phenom.ffwll.local> Sender: linux-kernel-owner@vger.kernel.org To: LKML , DRI Development , Intel Graphics Development , Daniel Vetter , Andrew Morton List-Id: intel-gfx@lists.freedesktop.org On Mon, Jul 09, 2018 at 05:52:04PM +0200, Daniel Vetter wrote: > for_each_something(foo) > if (foo->bla) > call_bla(foo); > else > call_default(foo); > > Totally contrived, but this complains. Liberally sprinkling {} also shuts > up the compiler, but it's a bit confusing given that a plain for {;;} is > totally fine. And it's confusing since at first glance the compiler > complaining about nested if and ambigous else doesn't make sense since > clearly there's only 1 if there. Ah, so the pattern the compiler tries to warn about is: if (foo) if (bar) /* stmts1 */ else /* stmts2 * Because it might not be immediately obvious with which if the else goes. Which is fair enough I suppose. OK, ACK.