]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 62278] Only expand the first pattern during secondary expansion
authorDmitry Goncharov <dgoncharov@users.sf.net>
Sun, 24 Apr 2022 00:21:31 +0000 (20:21 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 24 Apr 2022 14:39:32 +0000 (10:39 -0400)
commitbb21dd4d2dea63e65146567b60dad720f395e3e3
treeea5f3acc1529d544bf03acd3ab7e888d5f40b6b0
parent93fd0c0c9a6016592b15adc9ebd83ab787f35bdf
[SV 62278] Only expand the first pattern during secondary expansion

During normal pattern rule expansion only the first pattern (%) is
expanded; however during secondary expansion all patterns were
expanded.  Modify secondary expansion to match the behavior of normal
expansion.

Implementation tweaked by Paul Smith <psmith@gnu.org>

* src/file.c (expand_deps): Don't use subst_expand() which replaces
all % with $*: instead replace only the first one, by hand.
Fix a memory leak where the dep structure was not always freed.
* tests/scripts/features/statipattrules: Use .RECIPEPREFIX not TAB.
Add a series of tests verifying that static pattern rules with and
without secondary expansion both return the same results.
src/file.c
tests/scripts/features/statipattrules