Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp705497imm; Mon, 9 Jul 2018 09:08:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePzyo+KTF0nxlNdlWSJCjFZxzFAFgFU6LcBbFHOYp4s08FeyTkcRf/3M1NaAmplQ8JZNj/ X-Received: by 2002:a17:902:7891:: with SMTP id q17-v6mr21522088pll.186.1531152512896; Mon, 09 Jul 2018 09:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531152512; cv=none; d=google.com; s=arc-20160816; b=GOeV5NWHmR1hXwdWAf/F9WsN9+aUWQCKKkNnLqoCc+hGclXxk1Ta+2UY4cKMf6HtNt uk/aSiC7Z49NR++TgHbA4vmgUht6CF0fPdrXu8GfdQX5grCxaSSTLUyNwOM0vmZRzws5 RtX0cqwQlLH42SDDnD89/K8RWLOuVmSgyK5FBTEGc42PlVCkY0lj/3uOHIOeOsOVGLR4 ZZvP2JuwrSLC2vEFyTwW1/q8xE+4oLWZCEnPo4AWJyljFGaODgfE6nAmHkqovMZDcIbd +rhp2FyNCaBk3rOiy0XUSCsILgV/pwiAkxrDHMagn8HpnazeWCtNVBLxWeQezoEyJwWQ i6Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=YfwKSvpHjElU5FYvYOHeJzzHdkdEokJPgsu2WhHVVPQ=; b=hDopW/+0YKSthlwLljnQ+2aaKar9zTA42zq7SxcSTJFxyqo2NqiEcLlUM5CQe07jGt 31ghJhJqM/E/XBUXto4rSGWTrGPIQCbshYr4ZtpiqDzrIZquE+5EGGcjKd32RuYesiU+ q4aLrQGvHlrQzI5gLjSJXjE3cQl6V/at7tws2tQxkJiCfZd/Hy2KI7qTxpU+pJraGg/a rSkVwcSh28BFu+AMiUiDH83zRIgtRxgAZKQT9YvnwGNl+AVOFGc+aWG9vJ+PEAEGlF5v 6VbYJxsBYJWcJ24gwDL9uIvSkH0PzEeoyvaoKMVsqh7e3AntcwLuXS/jXD+hHdJqFIJg +zCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=fmoYoXk3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15-v6si14629887pgr.269.2018.07.09.09.08.18; Mon, 09 Jul 2018 09:08:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=fmoYoXk3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933018AbeGIQGw (ORCPT + 99 others); Mon, 9 Jul 2018 12:06:52 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:52357 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754618AbeGIQGq (ORCPT ); Mon, 9 Jul 2018 12:06:46 -0400 Received: by mail-it0-f67.google.com with SMTP id p4-v6so26131383itf.2 for ; Mon, 09 Jul 2018 09:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=YfwKSvpHjElU5FYvYOHeJzzHdkdEokJPgsu2WhHVVPQ=; b=fmoYoXk3Izn8IgCRv82EtvBrSQYFFfCtuo5s+xzE+uvJPImiV5QJ4ryA2Y10oQgC/I +iCdUyc3u95gNip/DD0/WlC2UFjPQvtnX435DWXUp02ApQuNlqlXnjaPmnDgeL/Derl6 w6hKN1/zPiogrGMfq4JBeIDcHRMvWuQXb1/6E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=YfwKSvpHjElU5FYvYOHeJzzHdkdEokJPgsu2WhHVVPQ=; b=mxGPBXKt6sw4t2CG3RRkwMgRroGLKLgtR91G4s82EVOQITawYCCT00A0o2RgeEFqTB G8leFLZtj5L0CqHTOVJI7OfXHP+M5HrG8o06QHrfdF2GTOpcTcOUTuePY+tYuoylu53p fBzR4iGXLNksqYotozRT9QQzkY0ePR8Qetl4pqSJF0fAPJLmXlKgEz2HZUy1v49RFODg 9mz0RPyw2zfjCSh93uukevqnDIRFjrzsAItiKswNLqvY6KObeUCWmETGxKJaYMq3NVm8 JpblK4MbDpC6Kl+E+/YtTbBholXcBDKIz0MnuUr0S9KIWnYrMyP5unrYd+BCMCc63XG0 paAQ== X-Gm-Message-State: APt69E0W5ua7e2rIMMnKRWpHf++y4ix/nJ524Ag1xzG797StC6p2nzOV /LuJngfQxuPOQpwxMLeEPB4orWT8bzYk3+eDNqMNew== X-Received: by 2002:a24:edce:: with SMTP id r197-v6mr9069298ith.23.1531152405849; Mon, 09 Jul 2018 09:06:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:e492:0:0:0:0:0 with HTTP; Mon, 9 Jul 2018 09:06:45 -0700 (PDT) X-Originating-IP: [2a02:168:5628:0:496f:7dc5:66d7:a057] In-Reply-To: <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> <20180709160342.GA2476@hirez.programming.kicks-ass.net> From: Daniel Vetter Date: Mon, 9 Jul 2018 18:06:45 +0200 X-Google-Sender-Auth: kXk86gJMENR2-F_xzG9zMQj4ZFU Message-ID: Subject: Re: [PATCH 11/12] sched: use for_each_if in topology.h To: Peter Zijlstra Cc: LKML , DRI Development , Intel Graphics Development , Daniel Vetter , Andrew Morton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 9, 2018 at 6:03 PM, Peter Zijlstra wrote: > 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. Yup. I'll augment the commit message of patch 1 to include this as example, and why it's confusing in context of a for_each_foo macro containing an if(). > OK, ACK. Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch