From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbdK2BHm (ORCPT ); Tue, 28 Nov 2017 20:07:42 -0500 Received: from smtprelay0040.hostedemail.com ([216.40.44.40]:53347 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751497AbdK2BHk (ORCPT ); Tue, 28 Nov 2017 20:07:40 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4605:5007:10004:10400:10848:11232:11658:11914:12043:12740:12760:12895:13069:13160:13229:13311:13357:13439:14096:14097:14181:14659:14721:21063:21080:21212:21451:21627:30041:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: cow61_5fc9ddaf8e62a X-Filterd-Recvd-Size: 2905 Message-ID: <1511917656.19952.52.camel@perches.com> Subject: Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs From: Joe Perches To: "Gustavo A. R. Silva" , Linus Torvalds Cc: Alan Cox , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , the arch/x86 maintainers , LKML , Kees Cook Date: Tue, 28 Nov 2017 17:07:36 -0800 In-Reply-To: <20171128143714.Horde.2uPOfQfKWjP7aGfH2w0lflN@gator4166.hostgator.com> References: <20171127235253.GA20384@embeddedor.com> <20171128120512.Horde.1mz61Up1PsNtyHbrjWmK8L7@gator4166.hostgator.com> <20171128122235.Horde.vFP-9ZfAP0f9BFNePB8Z8xi@gator4166.hostgator.com> <20171128190032.2b1fa464@alans-desktop> <20171128143714.Horde.2uPOfQfKWjP7aGfH2w0lflN@gator4166.hostgator.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-11-28 at 14:37 -0600, Gustavo A. R. Silva wrote: > Quoting Linus Torvalds : > > > On Tue, Nov 28, 2017 at 11:00 AM, Alan Cox > > wrote: > > > > > > The notation in question has been standard in tools like lint since the > > > end of the 1970s > > > > Yes. > > > > That said, maybe one option would be to annotate the "case:" and > > "default:" statements if that makes people happier. > > > > IOW, we could do something like > > > > #define fallthrough __atttibute__((fallthrough)) > > > > and then write > > > > fallthrough case 1: > > ... > > > > which while absolutely not traditional, might look and read a bit more > > logical to people. I mean, it literally _is_ a "fallthrough case", so > > it makes semantic sense. > > > > This is elegant. The thing is that this makes it appear as if there is > an unconditional fall through. > > It is not uncommon to have multiple break statements in the same case > block and to fall through also. My preferred syntax would be to use __fallthrough or fallthrough in the same manner as break; switch (foo) { case bar: bar(); fallthrough; case baz: baz(); break; default; qux(); exit(1); }