From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Date: Thu, 05 Nov 2015 22:02:53 +0000 Subject: Re: [PATCH] decnet: remove macro-local declarations Message-Id: <1446760973.21133.92.camel@perches.com> List-Id: References: <1446718696-32505-1-git-send-email-Julia.Lawall@lip6.fr> <20151105.142619.983467860147585345.davem@davemloft.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall , David Miller Cc: kernel-janitors@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lkp@intel.com, roopa@cumulusnetworks.com, rshearma@brocade.com, ebiederm@xmission.com On Thu, 2015-11-05 at 20:38 +0100, Julia Lawall wrote: > On Thu, 5 Nov 2015, David Miller wrote: > > From: Julia Lawall > > Date: Thu, 5 Nov 2015 11:18:16 +0100> > > > Move the variable declarations from the for_nexthops macro to the > > > surrounding context, so that it is clear where these variables are > > > declared. This also makes it possible to remove the endfor_nexthops macro. > > > > > > This change adds new arguments to the macro for_nexthops. They are ordered > > > such that a pointer to the referenced object comes first, the index in the > > > list comes next, and the list itself comes last, roughly in analogy with > > > the list_for_each macros. [] > > > This patch takes care of a single file, where the macros are defined > > > locally. If the basic transformation looks OK, I will change the other > > > files that either likewise define their own macros or use the macros in > > > net/mpls/internal.h. The potentially affected files are: > > ... > > > > This looks fine to me. > > > > Please resubmit this when net-next opens back up, which should be > > shortly after -rc1. > > OK, I'll do the others then too. If you do can you please parenthesize the macro arguments? #define for_nexthops(nh, nhsel, fi) \ for (nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; (nh)++, (nhsel)++) instead of for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) And perhaps a renaming might be better s/for_nexthops/for_each_nexthop/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756657AbbKEWDA (ORCPT ); Thu, 5 Nov 2015 17:03:00 -0500 Received: from smtprelay0157.hostedemail.com ([216.40.44.157]:34545 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751046AbbKEWC6 (ORCPT ); Thu, 5 Nov 2015 17:02:58 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2693:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6261:7576:7903:9010:10004:10400:10848:10967:11026:11232:11658:11914:12043:12296:12517:12519:12740:13069:13311:13357:14659:21080:30054:30064:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: size59_8de2f041eb850 X-Filterd-Recvd-Size: 2671 Message-ID: <1446760973.21133.92.camel@perches.com> Subject: Re: [PATCH] decnet: remove macro-local declarations From: Joe Perches To: Julia Lawall , David Miller Cc: kernel-janitors@vger.kernel.org, linux-decnet-user@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lkp@intel.com, roopa@cumulusnetworks.com, rshearma@brocade.com, ebiederm@xmission.com Date: Thu, 05 Nov 2015 14:02:53 -0800 In-Reply-To: References: <1446718696-32505-1-git-send-email-Julia.Lawall@lip6.fr> <20151105.142619.983467860147585345.davem@davemloft.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.16.5-1ubuntu3 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 Thu, 2015-11-05 at 20:38 +0100, Julia Lawall wrote: > On Thu, 5 Nov 2015, David Miller wrote: > > From: Julia Lawall > > Date: Thu, 5 Nov 2015 11:18:16 +0100> > > > Move the variable declarations from the for_nexthops macro to the > > > surrounding context, so that it is clear where these variables are > > > declared. This also makes it possible to remove the endfor_nexthops macro. > > > > > > This change adds new arguments to the macro for_nexthops. They are ordered > > > such that a pointer to the referenced object comes first, the index in the > > > list comes next, and the list itself comes last, roughly in analogy with > > > the list_for_each macros. [] > > > This patch takes care of a single file, where the macros are defined > > > locally. If the basic transformation looks OK, I will change the other > > > files that either likewise define their own macros or use the macros in > > > net/mpls/internal.h. The potentially affected files are: > > ... > > > > This looks fine to me. > > > > Please resubmit this when net-next opens back up, which should be > > shortly after -rc1. > > OK, I'll do the others then too. If you do can you please parenthesize the macro arguments? #define for_nexthops(nh, nhsel, fi) \ for (nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; (nh)++, (nhsel)++) instead of for(nhsel = 0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) And perhaps a renaming might be better s/for_nexthops/for_each_nexthop/