Re: [PATCH] checkpatch: if_changed: check for multiple calls in targets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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'

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux