Received: by 10.223.164.202 with SMTP id h10csp3415504wrb; Tue, 28 Nov 2017 10:55:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMau5wcKz5d0845bKC5v1rBR3dJV9gTgx2tWEYCTaWxEOIgB4Sz1QYs5uTLdd5k1CFiz9Buq X-Received: by 10.99.124.16 with SMTP id x16mr148215pgc.124.1511895339207; Tue, 28 Nov 2017 10:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511895339; cv=none; d=google.com; s=arc-20160816; b=fkhGtsoU//c+wd2LcBTNu7aoABiw63yXNUkUtMcskc0Ims5nVb6J9lgqKIIlV3B4RB PHhQ/n5Vl48UMbygx+0WKUOOW5/zq5S1z7V8snGwObPLXTgYU6ICwh2HP0J80OLMS91u cykiVJDNFNo1Ix9VQ+Do7gRs1nQu+22fP3gAUwQev21wSMRF7GX4Lp82/VPZg7MEBEsH FvxBV97pC8Sy5sYlXskxFLwyyyvNyF21tkRw9NjOLZpu1uQMUKQmcqjSn1NslpvYicwc TXLD0/O5/AjhxqjJbdqKVsox6dSeeF1CUA9L3PcER8aGW2a2KGesO3sfgGhKU0BBw9n3 GO1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :user-agent:in-reply-to:references:subject:cc:to:from:message-id :date:arc-authentication-results; bh=uduSNywt29jKFBqbTnNzrIVz8CyAmAk80PQ1UV+tvqc=; b=UNzQi3UbG9e3547kDx1UvScP1XztJWJLevTeKC99/AaQCGLuToiNxwSC5utlCzluGl zVFzkGN1qRV0VrvQpVaQBbPtS4DqMEr+CEKafDoKNs0vPdQ4/dZetLmA9UqcLvtDhcOT u+uOHl681dUNdCsZD6jbxM/ryfE7A65KxMLdw7Q/1P3X2gqntlpQxI+eTQK5E2tkowzs j+2EA5+wVYJbzkMvfq9wWuTMsoM992Yg4fL3yl3l6XcKG1EuJ5Reyzg/xknwcBQ9rPOA K7WYR8NIAfOPTSKsBgqdYAlNxBVUWfSSNzSOu73tSgdQwzfLQBPCh4qFK9gFtCdJloO6 T/Cw== 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 a67si24711838pgc.233.2017.11.28.10.55.28; Tue, 28 Nov 2017 10:55:39 -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 S1752461AbdK1Sxd (ORCPT + 72 others); Tue, 28 Nov 2017 13:53:33 -0500 Received: from gateway22.websitewelcome.com ([192.185.47.48]:48365 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751675AbdK1Sxc (ORCPT ); Tue, 28 Nov 2017 13:53:32 -0500 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway22.websitewelcome.com (Postfix) with ESMTP id EE4D910BC for ; Tue, 28 Nov 2017 12:53:31 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id Jl0deTLvA5b6TJl0dedfva; Tue, 28 Nov 2017 12:53:31 -0600 Received: from gator4166.hostgator.com ([108.167.133.22]:27015) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1eJl0d-002tiu-Gu; Tue, 28 Nov 2017 12:53:31 -0600 Received: from 189.175.122.225 ([189.175.122.225]) by gator4166.hostgator.com (Horde Framework) with HTTPS; Tue, 28 Nov 2017 12:53:31 -0600 Date: Tue, 28 Nov 2017 12:53:31 -0600 Message-ID: <20171128125331.Horde.XUXRWEiZ7FMJv6yoDylZxN8@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Thomas Gleixner Cc: Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, LKML , Kees Cook , Linus Torvalds Subject: Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs References: <20171127235253.GA20384@embeddedor.com> <20171128120512.Horde.1mz61Up1PsNtyHbrjWmK8L7@gator4166.hostgator.com> <20171128122235.Horde.vFP-9ZfAP0f9BFNePB8Z8xi@gator4166.hostgator.com> In-Reply-To: User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Source-L: Yes X-Exim-ID: 1eJl0d-002tiu-Gu X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:27015 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 15 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Thomas Gleixner : > On Tue, 28 Nov 2017, Thomas Gleixner wrote: > > +CC Linus. > >> 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... " >> This is what we want to add: # Warn about missing switch break or fall-through comment. KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough) >> 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 get why someone would want to do that to himself. :/ >> I don't care what other people prefer. The code base I'm responsible for >> gets either proper annotations or nothing. > > And in fact we want ONE solution for the whole kernel. And comments are > obviously the wrong one. > OK. I'll discuss this and see how we can come up with the best solution. Thank you for your feedback -- Gustavo A. R. Silva From 1585336670880278820@xxx Tue Nov 28 18:47:45 +0000 2017 X-GM-THRID: 1585265423856272058 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread