Received: by 10.223.164.202 with SMTP id h10csp3398587wrb; Tue, 28 Nov 2017 10:37:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMbb+Yj46tH5JvNdiXwgerwKyu5iq5gXybdtrgts0Rdgz7KXcpB2w7Z4Hbzu53JvgOXddwNB X-Received: by 10.84.129.73 with SMTP id 67mr120133plb.198.1511894275989; Tue, 28 Nov 2017 10:37:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511894275; cv=none; d=google.com; s=arc-20160816; b=idMTwZvjF46QP2w2jNtmEJe3eAmEoJorF7zw27+EUqjruONpJjTyigfKTg6+b1+YpU xhBnhPv/p6zO20QlHDdJY8z7MokH6mSPPVM5eB95ejNTFfJtKbf/NeYNmIzAPvZRGhy6 /0Lm3kthq/R3WzX5iUb+kJg1f+E3UVja+P8tdCqgn/ub1MZHw3v3aW+yfdkEVMErhk+Z MvwhBGnCeJygi1c8K9ndtbUtFOqmM+8fq6fOV2/zPBejO41UuPugRJMKJS9ffJzUf2/+ a/WWCPy/C9Z+A+0qjXp8Xg3GhL2jajZcS/REIMqQUIg7nVvPUdbpgjVZImmXMBo1zz6Q h4Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=gej00DaoyXqmjpfpXASe9Ge4//HDM4+xvN3OBu/lPJg=; b=yjzrCQpHjAmYyDReAqxrXgN7SYTWr8ez4nFT1t6y3MobcnGIJ7jTkYIx960xcRfzfS P+FU9++NrNC6maBuLoJiZFcsh9Lf9eL0HgzndCZhMidKp43RUwVV1220vetwth972LLB y5+UxK7g+tEmAdlGzJuvSUFincr+0aHy7ziFebpUsC79XN9zCS7CBh9FfRjY20UmWDBb 0L3yB2QEUbb7e7pKitd/GyiZ+XJzYM2KJHy1Y9pTlx/CBh5GTC3t71l0OZYK8XH0U1NQ Mkfx0Cj8LmeOtDvIqjSOipTyIaa24MvlPnCDNk4eEtAwpHsCgFf10RkdCc9Qx7ILpSqC xdmA== ARC-Authentication-Results: i=1; mx.google.com; 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 v61si26080503plb.248.2017.11.28.10.37.44; Tue, 28 Nov 2017 10:37:55 -0800 (PST) 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; 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 S1753472AbdK1Sgc (ORCPT + 78 others); Tue, 28 Nov 2017 13:36:32 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:35136 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753860AbdK1SgP (ORCPT ); Tue, 28 Nov 2017 13:36:15 -0500 Received: from p4fea5f09.dip0.t-ipconnect.de ([79.234.95.9] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1eJkiZ-0005CM-DR; Tue, 28 Nov 2017 19:34:51 +0100 Date: Tue, 28 Nov 2017 19:35:59 +0100 (CET) From: Thomas Gleixner To: "Gustavo A. R. Silva" cc: Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, LKML , Kees Cook Subject: Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs In-Reply-To: Message-ID: References: <20171127235253.GA20384@embeddedor.com> <20171128120512.Horde.1mz61Up1PsNtyHbrjWmK8L7@gator4166.hostgator.com> <20171128122235.Horde.vFP-9ZfAP0f9BFNePB8Z8xi@gator4166.hostgator.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Nov 2017, Thomas Gleixner wrote: > On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote: > > Quoting Thomas Gleixner : > > > > To be honest, such comments annoy me during a code review especially when > > > > the fallthrough is so obvious as in this case. There might be cases where > > > > its worth to document because it's non obvious, but documenting the > > > > obvious > > > > just for the sake of documenting it is just wrong. > > > > > > > I understand that and I agree that in this particular case it is just obvious. > > The thing is that if we want to benefit from having the compiler help us to > > spot these kind of issues before committing our code, we have to address every > > place in the whole code-base. > > > > > And _IF_ at all then you want a fixed macro for this and not a comment > > > which will be formatted as people see it fit. > > > > > > GCC supports: __attribute__ ((fallthrough)) which we can wrap into a macro, > > > e.g. falltrough() > > > > > > That'd be useful, but adding all these comments and then having to chase a > > > gazillion of warning instances to figure out whether there is a comment or > > > not is just backwards. > > > > > > > I have run into this before and people find what you suggest even uglier. > > It's not about ugly. It's about _USEFULL_. > > The comments are ugly AND completely useless for the compiler and they are > going to be malformatted so checker tools can't differentiate the false > positives. > > The macro, in which more or less ugly form written, is both documentation > and helps the compiler NOT to emit the same crap over and over. Just checked and GCC really supports analyzing the comment to some extent. But just look at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817 " It is not really possible. __attribute__((fallthrough)) has precise rules on where it can appear, while /* FALLTHRU */ comments, being comments, can appear anywhere. Especially with -Wimplicit-fallthrough=1 when all comments are considered fallthru comments... " I have no idea who came up with that brilliant idea of parsing comments in the code. It's so simple to make this parser completely fail that it's not even funny anymore. I don't care what other people prefer. The code base I'm responsible for gets either proper annotations or nothing. Thanks, tglx From 1585335433902976416@xxx Tue Nov 28 18:28:06 +0000 2017 X-GM-THRID: 1585265423856272058 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread