Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2463280imm; Mon, 16 Jul 2018 08:25:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpesidYyU2X73SA2KoOZ8MDINJbOuf9WYTDosFhzWEAA4rLn8kFRsqC5oXpjDoS9VhpBXDbW X-Received: by 2002:a17:902:8645:: with SMTP id y5-v6mr17075987plt.334.1531754729199; Mon, 16 Jul 2018 08:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531754729; cv=none; d=google.com; s=arc-20160816; b=sEcIj2iHRqgoXJhquAMTR4kVPVPlKqiOyffoy7bBOnW2lXd96tkk3RwChAifMMUitr vzeDUC/wotYZtzeywZlldvdvA/laQiBLdLK+woOlRsncNOASKOJ4tzvwVk5d/JXCvh8f xTsDPyyOsOJRYrHhn8NfRmsKwNot7I0U+7REqYdWFgjXzU0TFgl8VUlRsX5iwAh1B6xY oSRHNsncfcmXKoWdlnY3ntZXFRImYjN7GfcqJljpcp4gfM6RuDUSm0NCv288NkFRRefD oIkptQRZHUZO2Q2OL9cvN+vowleZXP80ggQ3T21Cao28viq3p59owYZVC3BiIz3RLLFj KoNg== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=r3NYreR14iqYrjU7cT9g62hNoXC+uMViuycOmWesirs=; b=O9w3fzg9ZlnrKvANS+c3Piu1mTVbM0MOOE3pCN0B5HsYTrflyN+yBdQ3Qu9rfjuEbU 5pdowSRtzUT/xbc8SuRagXOPJtEjYd/SERZEmN0ek00rN38aqzzFZ3UTo7drBuSw+qNb JqEE/pXwnYewCtglFER1M8YzLuYy8VyT7GS9vdbXj68mrXvpOW+i4fGXdb7t0mXvDNqU sB04ijAMVvDDlMChmiz5ibgVW8mgVDX8thpKpo18nB3PFYzAO4JIAZS+cmbVWs67mUKc cN29P2qyYrsfGFDpGZ03pG5NNX6NY1Zw4BETBstU6Ei+KNCC1JIrIruTgA/sh6u6KjcQ blvw== 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 k9-v6si29678329pga.539.2018.07.16.08.25.14; Mon, 16 Jul 2018 08:25:29 -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 S1729791AbeGPPv6 (ORCPT + 99 others); Mon, 16 Jul 2018 11:51:58 -0400 Received: from smtprelay0153.hostedemail.com ([216.40.44.153]:33881 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727610AbeGPPv5 (ORCPT ); Mon, 16 Jul 2018 11:51:57 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 656EE182244F3; Mon, 16 Jul 2018 15:24:02 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:305:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3653:3865:3866:3867:3868:3870:3871:3874:4321:4605:4823:5007:6119:8660:10004:10400:10848:11026:11232:11473:11658:11914:12296:12663:12740:12760:12895:13069:13071:13148:13161:13229:13230:13311:13357:13439:14180:14181:14659:14721:21060:21080:21212:21451:21627:30054:30070:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.14.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:26,LUA_SUMMARY:none X-HE-Tag: screw63_5d44301b3da11 X-Filterd-Recvd-Size: 2560 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Mon, 16 Jul 2018 15:24:00 +0000 (UTC) Message-ID: <1d36bef932de0612746088388df793de99d7c129.camel@perches.com> Subject: Re: [PATCH] checkpatch: if_changed: check for multiple calls in targets From: Joe Perches To: Dirk Gouders , Andy Whitcroft Cc: Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 16 Jul 2018 08:23:59 -0700 In-Reply-To: <20180716123902.5337-1-dirk@gouders.net> References: <20180716123902.5337-1-dirk@gouders.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 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-07-16 at 14:39 +0200, Dirk Gouders wrote: > Because the kbuild function if_changed writes the command line to a > .cmd file for later tests, multiple calls of that function within a > target would result in overwrites of previous values and effectively > render the command line test meaningless, resulting in flip-flop > behaviour. > > Produce an error for targets with multiple calls to if_changed. Hi. Some questions: How is the existing use in arch/microblaze/boot/Makefile incorrect? $(obj)/simpleImage.%: vmlinux FORCE $(call if_changed,cp,.unstrip) $(call if_changed,objcopy) $(call if_changed,uimage) $(call if_changed,strip,.strip) @echo 'Kernel: $(UIMAGE_OUT) is ready' ' (#'`cat .version`')' > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -2911,6 +2911,14 @@ sub process { > "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag}); > } > i > + # Check for multiple calls of if_changed within a target in Makefiles > + if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) && Why is any Kbuild file check useful? > + ($prevline =~ /^[ +]\t\$\(call if_changed,/) && > + ($line =~ /^[ +]\t\$\(call if_changed,/)) { What about if_changed_dep and if_changed_rule? > + ERROR("MULTIPLE_IF_CHANGED", > + "Multiple calls of if_changed within a target.\n" . $herecurr); > + } And some more style things: There are instances with multiple tabs so probably these should use '\t*' or '\s*' and not '\t'. This should probably not require a single space after if_changed so likely: 'call\s+if_changed'