Possible Unnecessary Code in expand.c

Jon Forrest <[email protected]> Mon, 3 Jan 2022 20:06:21 -0800
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
In expand.c starting at line 340 there's code to put a '%'
character at the beginning of pattern and replace. So far,
so good.

Then, at line 354 to 370 there's code to look for '%' in these
variables. Different actions are taken depending on whether '%' is
found.

But, since you just stuck the '%' in these variables, how
could this code ever fail to find a '%'?

What could happen is that there could be more than one '%',
such as in

	bar := $(foo:%.o=%.c)

(taken from the Gmake manual). Internally search would expand to

	"%%.o"

and replace to

	"%%.c:

But, this is a different situation. I don't see why the code
in lines 354 to 370 is necessary.

What am I missing?

Thanks,
Jon