Received: by 10.223.164.202 with SMTP id h10csp3372239wrb; Tue, 28 Nov 2017 10:12:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMax3qipueevUadMgQfYjS/UyqM/pFmvaxs+rxkf+YEWuNSsRhUlbcY10GxBMPBKecP/V8EQ X-Received: by 10.159.234.138 with SMTP id d10mr33344plr.280.1511892775693; Tue, 28 Nov 2017 10:12:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511892775; cv=none; d=google.com; s=arc-20160816; b=MJa3JKzDudR2Cb3xsjmIdWxWEuJQMc2oatXQr+UNnQcNNAmiaGSyC492kglIiXmqto Hc0+C+FjQUUVDj93Q/tSUdRwxyKU/RCwnt0jnLYGDouPb3GkMX6rAva0AwGKPOgRFRwu onFpzUIsqhN1RRc8h1rgL0wzFpjUjvZ26tlvEBNmgcG8uW6wYDb8JY2l0gFpo3Ueeexo vVuTBxCYJv2B6VhcalWbFgdNy/iBC1OsyL8KItak7jKBH6PzUGNTsX8dl40Doy6MELz1 wUBM2Mwv2wdvfGkdgDhH3EQKF8T/YQYNbevi99hy2T7+CrVvHHpyc1E1yGrXjWyEGnSf teQg== 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=RQMBtXG4IKm7UhjuNPXARe37u9minBMorE2z1mrYg8c=; b=MwAwuDkJYRrUQA0EUohxf0nA05Z9Hnyr/8oQBNb787mxny5rIAs/FaEAOcrVKpqxfA Mh5f8Cu7Lwe1Rx/+lar6M2BhVOvgZaHIUdBsmaDL7d9Gm3zGxk4Hwk0nEU0Q+vvt4XNB GAQGXMUbTja7FilRxzmVYgX32uzXCliAMFba7oKmK6N9WzJmgAxPjFwq/vUKL4YHUUtb Tya0s+AJsN9RDA/+9WTMeUl+vtoZBKB+1qvu0e6OCgqzEmJIs2IPHxeYTEpxwclQRpqo rDN60SVXHV3aNh+Bjtu6pxbv8uRI80P+hGdttLB54NkcLzNQDVYpMEvMMZ2sv+WCaqqP hFZw== 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 a2si24167988plp.204.2017.11.28.10.12.42; Tue, 28 Nov 2017 10:12: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 S1752280AbdK1SK0 (ORCPT + 78 others); Tue, 28 Nov 2017 13:10:26 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:34979 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbdK1SKZ (ORCPT ); Tue, 28 Nov 2017 13:10:25 -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 1eJkJX-0004rs-LJ; Tue, 28 Nov 2017 19:08:59 +0100 Date: Tue, 28 Nov 2017 19:10:07 +0100 (CET) From: Thomas Gleixner To: "Gustavo A. R. Silva" cc: Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Kees Cook Subject: Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs In-Reply-To: <20171128120512.Horde.1mz61Up1PsNtyHbrjWmK8L7@gator4166.hostgator.com> Message-ID: References: <20171127235253.GA20384@embeddedor.com> <20171128120512.Horde.1mz61Up1PsNtyHbrjWmK8L7@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, Gustavo A. R. Silva wrote: > Quoting Thomas Gleixner : > > > On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote: > > > > > In preparation to enabling -Wimplicit-fallthrough, mark switch cases > > > where we are expecting to fall through. > > > > > case 0: > > > if (!n--) break; > > > *args++ = regs->bx; > > > + /* fall through */ > > > > And these gazillions of pointless comments help enabling of > > -Wimplicit-fallthrough in which way? > > > > The -Wimplicit-fallthrough option was added to GCC 7. We want to add that > option to the top-level Makefile so we can have the compiler help us not make > mistakes as missing "break"s or "continue"s. This also documents the intention > for humans and provides a way for analyzers to report issues or ignore False > Positives. > > So prior to adding such option to the Makefile, we have to properly add a code > comment wherever the code is intended to fall through. > > During the process of placing these comments I have identified actual bugs > (missing "break"s/"continue"s) in a variety of components in the kernel, so I > think this effort is valuable. Lastly, such a simple comment in the code can > save a person plenty of time during a code review. 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. Thanks, tglx From 1585334143643478720@xxx Tue Nov 28 18:07:35 +0000 2017 X-GM-THRID: 1585265423856272058 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread