Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7156731ybi; Thu, 1 Aug 2019 04:05:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbp2ndwesIz7t7AtnzkOFlxJwWFJkltw3oYnI+JtBgIc1p9fT/jNaYGdboiEsl4KKmbybf X-Received: by 2002:a17:90a:2244:: with SMTP id c62mr8255137pje.29.1564657536652; Thu, 01 Aug 2019 04:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564657536; cv=none; d=google.com; s=arc-20160816; b=iIEdaUfXT47vaXl6AAiyo33wsARyEJfiZJizH8/zsJbPqcEET+5KFXy2RoDfhv9dBT EDm35cfRjI0YHbbtOawyyRiyVQgqVCadIdwq7n35QZT3g9aBJQaawHVmAU8Z4OTtp6PB NpB7BM7JGV4AmnoS1L2lDNNzpkyr9hy8JfCZPTUKAi/tJ6il1endZUwtmdNjHAlQzXUr DXHw0QVexzNnjme2KcAl62ZnlSYG2LUuI8yEW4tfS6t6HWUqpcbdC4NiIcGwj8Hyd4Gu GkWU7UJHWNThUIWL4wGfkUxDnazg91Rgd+Eiw3aZP9NairP9pv4yKTBgsl961iZ3OuzZ OYGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BG1MVgeMJC12+lISJQqGw8xKNFc57GtHrtIkpyx1EQQ=; b=CaU9lz8AIdvKrFagRn7DlJr1MywfnhwOWRK9+4ck73w5HGz1Lzq4Q7IUPK7rlOKBMD HpaRwYzJHSJF1oIs9V0NVHoJ0H1Fcw7tKsPsTLkw5oJfaq0MK7Xc/Ih6+UjLZquUCNi9 P5PZ11UGq+7pE7A6vR3qL4jHuiIpF9rIigELzA7c91LfBJPyE2DoW3OsIHKdfmBEN6T5 2mY9EXVWZg+7/HJDuOTMYLmohaNWcSSddPRzS/g4/NQd81d0+UQa8dRWd7eFpfcWtoJ5 Vdp2zg2CpVDOAWxs7/f2G+CvvTtoIMIWQqblNtOkqav8Pw367y1etMVlX+Hl5W6+etyy O3WQ== 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 136si5877404pgg.354.2019.08.01.04.05.20; Thu, 01 Aug 2019 04:05:36 -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; 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 S1731165AbfHAKvd (ORCPT + 99 others); Thu, 1 Aug 2019 06:51:33 -0400 Received: from charlotte.tuxdriver.com ([70.61.120.58]:50262 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727506AbfHAKvd (ORCPT ); Thu, 1 Aug 2019 06:51:33 -0400 Received: from cpe-2606-a000-111b-6140-0-0-0-162e.dyn6.twc.com ([2606:a000:111b:6140::162e] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1ht8g4-0004gS-IT; Thu, 01 Aug 2019 06:51:27 -0400 Date: Thu, 1 Aug 2019 06:50:51 -0400 From: Neil Horman To: Joe Perches Cc: Vlad Yasevich , Marcelo Ricardo Leitner , "David S. Miller" , linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: sctp: Rename fallthrough label to unhandled Message-ID: <20190801105051.GA11487@hmswarspite.think-freely.org> References: <20190731111932.GA9823@hmswarspite.think-freely.org> <20190731121646.GD9823@hmswarspite.think-freely.org> <20190731205804.GE9823@hmswarspite.think-freely.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.0 (2019-05-25) X-Spam-Score: -2.9 (--) X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 31, 2019 at 03:23:46PM -0700, Joe Perches wrote: > On Wed, 2019-07-31 at 16:58 -0400, Neil Horman wrote: > > On Wed, Jul 31, 2019 at 09:35:31AM -0700, Joe Perches wrote: > > > On Wed, 2019-07-31 at 08:16 -0400, Neil Horman wrote: > > > > On Wed, Jul 31, 2019 at 04:32:43AM -0700, Joe Perches wrote: > > > > > On Wed, 2019-07-31 at 07:19 -0400, Neil Horman wrote: > > > > > > On Tue, Jul 30, 2019 at 10:04:37PM -0700, Joe Perches wrote: > > > > > > > fallthrough may become a pseudo reserved keyword so this only use of > > > > > > > fallthrough is better renamed to allow it. > > > > > > > > > > > > > > Signed-off-by: Joe Perches > > > > > > Are you referring to the __attribute__((fallthrough)) statement that gcc > > > > > > supports? If so the compiler should by all rights be able to differentiate > > > > > > between a null statement attribute and a explicit goto and label without the > > > > > > need for renaming here. Or are you referring to something else? > > > > > > > > > > Hi. > > > > > > > > > > I sent after this a patch that adds > > > > > > > > > > # define fallthrough __attribute__((__fallthrough__)) > > > > > > > > > > https://lore.kernel.org/patchwork/patch/1108577/ > > > > > > > > > > So this rename is a prerequisite to adding this #define. > > > > > > > > > why not just define __fallthrough instead, like we do for all the other > > > > attributes we alias (i.e. __read_mostly, __protected_by, __unused, __exception, > > > > etc) > > > > > > Because it's not as intelligible when used as a statement. > > I think thats somewhat debatable. __fallthrough to me looks like an internal > > macro, whereas fallthrough looks like a comment someone forgot to /* */ > > > I'd rather see: > > switch (foo) { > case FOO: > bar |= baz; > fallthrough; > case BAR: > bar |= qux; > break; > default: > error(); > } > > than > > switch (foo) { > case FOO: > bar |= baz; > __fallthrough; > case BAR: > bar |= qux; > break; > default: > error(); > } > > or esoecially > > switch (foo) { > case FOO: > bar |= baz; > /* fallthrough > */; > case BAR: > bar |= qux; > break; > default: > error(); > } > > but , bikeshed ahoy!... You can say that if you want, but you made the point that your think the macro as you have written is more readable. You example illustrates though that /* fallthrough */ is a pretty common comment, and not prefixing it makes it look like someone didn't add a comment that they meant to. The __ prefix is standard practice for defining macros to attributes (212 instances of it by my count). I don't mind rewriting the goto labels at all, but I think consistency is valuable. Neil > > >