Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3735288imm; Mon, 8 Oct 2018 08:42:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ItSDEAvEGbgGxkR5iDyEg12ilnoSllYmnWPYBdDa5IZVenSERygjxcEjflKo6OBmXJaOq X-Received: by 2002:a63:ec11:: with SMTP id j17-v6mr21498726pgh.388.1539013347546; Mon, 08 Oct 2018 08:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539013347; cv=none; d=google.com; s=arc-20160816; b=ZEC+lsf0RINZHfx7B1X+OaAK26gL401Oslt9/jgEjKsSNJ5vI9+ULz7OaG/Z9PoSvC TkOehrj8dLqhNswv0PN79ICDZw6h0c3YPbO6gzwAd9ksVmaUdnXI6EmA4CS5xzAXMWJS lkJYRw7ZJnOjOxXbrcyTO8VKUTI+5+23jLs172eNKaetbTdkLCw7A9e4JABu2POQ87+c sKy5e5fFcN9cFtzdXMezge0b7wAvJ3XEvbidpetuuOmPBU9zQLORUG8kuBDL/clJk3Iw 0giip1qaLHGOWIk8jPrHpnUGCfyZOhv0F6WG7I0zLLiI83OUsXNOMF2Vw96KUnLg48Z/ payw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=nmWa3OYa9VIe7a4fGulGTNs3FefaKYbu9XQSLPBHCfA=; b=VOFX7Wams9xUEvyGEWuxVO3/KdBtUx4PFHnILQNkm10expKT98gxACZlMhvcFcVI9C dcHIZ7YuDc2gasVupmON4qQZdqO3BmNjR8KdJkeBOEK9ERGpst/5mhFivKgIHalAsmcJ qtPQ7MV4vc8OBhu55k7kK3i/kqn70ldTTbTc+tIi856w58W1+QFuBGg5Ky3PFQQzdQEY lNnnZrr122mJqzDlW5VNJnRJR3JmmehXrjvnKSLfxcxHtC5R+midb4341Ug257LZK7qH MPw/HvwflNzZaP83+uXm1xwN0zBS3PM5NHxnfzXiBRsocBZ3XSYnZ5E7gMmE9OdwWMAL AZgw== 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 x15-v6si18182368pln.425.2018.10.08.08.42.11; Mon, 08 Oct 2018 08:42:27 -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 S1726607AbeJHWxM (ORCPT + 99 others); Mon, 8 Oct 2018 18:53:12 -0400 Received: from smtprelay0057.hostedemail.com ([216.40.44.57]:36248 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726367AbeJHWxL (ORCPT ); Mon, 8 Oct 2018 18:53:11 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 789768368EE1; Mon, 8 Oct 2018 15:40:51 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2691:2828:2895:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4043:4250:4321:4605:5007:7901:7903:8660:8957:9010:9012:10004:10400:10848:11026:11232:11658:11914:12438:12555:12740:12760:12895:13019:13069:13148:13230:13311:13357:13439:14181:14659:14721:21080:21324:21451:21627:21740:30029:30034:30054:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: voice63_24766164a462c X-Filterd-Recvd-Size: 2707 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA; Mon, 8 Oct 2018 15:40:50 +0000 (UTC) Message-ID: <3cbaf145ee577f017cf7aea953c9dd1eb88ed4b4.camel@perches.com> Subject: Re: list iterator spacing: clang-format vs checkpatch From: Joe Perches To: Miguel Ojeda , Jason@zx2c4.com Cc: Andrew Lunn , linux-kernel Date: Mon, 08 Oct 2018 08:40:49 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-10-08 at 09:31 +0200, Miguel Ojeda wrote: > On Mon, Oct 8, 2018 at 4:01 AM Jason A. Donenfeld wrote: > > The shiny new .clang-format file lists a number of nice iterators in > > the ForEachMacros category, the consequence being that there is a > > space between the iterator name and the opening parenthesis. This > > strikes me as the right thing to do. It does not strike me as the right thing to do. Keeping an exhaustive list current is a continuing burden and the list generally goes stale over time. > > However, checkpatch.pl complains about it: > > > > WARNING: space prohibited between function name and open parenthesis '(' > > #65: FILE: ratelimiter.c:65: > > + hlist_for_each_entry_safe (entry, temp, &table_v4[i], hash) { > > > > It would seem that .clang-format is right and checkpatch.pl is wrong? > > Checking quickly, it would seem most of the kernel does not put a > space there (a minority does), e.g.: > > git grep 'list_for_each[a-zA-Z0-9_]* (' | wc -l # 67 > git grep 'list_for_each[a-zA-Z0-9_]*(' | wc -l # 13892 > > So in that sense, checkpatch.pl is right (even if it is not a function call). As a general rule, I believe any dominant coding style is correct. These things are just a convention. .clang-format is a work in progress and should be updated where possible to reflect the kernel dominant styles. > We would probably need to implement SpaceBeforeForEachMacros (or a new > option for SpaceBeforeParens). I haven't had the time to look into > adding the missing support for the few things that the kernel style > requires, sadly, but it is in my TODO list. Good luck and as you are the .clang_format maintainer, I hope you find the time.