From 11095a90f120545c915c92b8ebf48f04723d1837 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 24 Oct 2005 13:01:39 +0000 Subject: Make second expansion optional (partial implementation). I decided this feature was too impacting to make the permanent default behavior. This set of changes makes the default behavior of make the old behavior (no second expansion). If you want second expansion, you must define the .SECONDEXPANSION: special target before the first target that needs it. This set of changes ONLY fixes explicit and static pattern rules to work like this. Implicit rules still have second expansion enabled all the time: I'll work on that next. Note that there is still a backward-incompatibility: now to get the old SysV behavior using $$@ etc. in the prerequisites list you need to set .SECONDEXPANSION: as well. --- misc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index ac50270..6f12683 100644 --- a/misc.c +++ b/misc.c @@ -485,7 +485,7 @@ find_next_token (char **ptr, unsigned int *lengthptr) with the same contents as the old one. */ struct dep * -copy_dep_chain (struct dep *d) +copy_dep_chain (const struct dep *d) { register struct dep *c; struct dep *firstnew = 0; @@ -508,6 +508,21 @@ copy_dep_chain (struct dep *d) return firstnew; } + +/* Free a chain of 'struct dep'. */ + +void +free_dep_chain (struct dep *d) +{ + while (d != 0) + { + struct dep *df = d; + d = d->next; + + free (df->name); + free ((char *)df); + } +} /* Free a chain of `struct nameseq'. Each nameseq->name is freed as well. Can be used on `struct dep' chains.*/ -- cgit v1.2.3