summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2001-03-08 00:55:08 +0000
committertmm <tmm@FreeBSD.org>2001-03-08 00:55:08 +0000
commitaa2af82f77a2bb5105a384b806e6ba2cf75a0ad4 (patch)
treed84984592e791aecb0bc928507b41fe9a9006998 /usr.bin/make
parent98e6d79157cc274ee510c16c0326198ccbea4795 (diff)
downloadFreeBSD-src-aa2af82f77a2bb5105a384b806e6ba2cf75a0ad4.zip
FreeBSD-src-aa2af82f77a2bb5105a384b806e6ba2cf75a0ad4.tar.gz
Fix two bugs in null suffix handling. Both occured only after the suffix
list was cleared. Rules with null suffixes would not be rebuilt when the suffixes were added again. Adding null suffix rules would fail when a rule for the same source was declared before the suffix list was cleared. PR: 23328, 24102 Reviewed by: will Approved by: rwatson
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/suff.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 81d4216..8ade95e 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -460,8 +460,16 @@ Suff_ClearSuffixes ()
{
Lst_Concat (suffClean, sufflist, LST_CONCLINK);
sufflist = Lst_Init(FALSE);
- sNum = 0;
+ sNum = 1;
suffNull = emptySuff;
+ /*
+ * Clear suffNull's children list (the other suffixes are built new, but
+ * suffNull is used as is).
+ * NOFREE is used because all suffixes are are on the suffClean list.
+ * suffNull should not have parents.
+ */
+ Lst_Destroy(suffNull->children, NOFREE);
+ suffNull->children = Lst_Init(FALSE);
}
/*-
@@ -714,20 +722,25 @@ SuffRebuildGraph(transformp, sp)
Suff *s = (Suff *) sp;
char *cp;
LstNode ln;
- Suff *s2;
+ Suff *s2 = NULL;
/*
* First see if it is a transformation from this suffix.
*/
cp = SuffStrIsPrefix(s->name, transform->name);
if (cp != (char *)NULL) {
- ln = Lst_Find(sufflist, (void *)cp, SuffSuffHasNameP);
- if (ln != NULL) {
+ if (cp[0] == '\0') /* null rule */
+ s2 = suffNull;
+ else {
+ ln = Lst_Find(sufflist, (void *)cp, SuffSuffHasNameP);
+ if (ln != NULL)
+ s2 = (Suff *)Lst_Datum(ln);
+ }
+ if (s2 != NULL) {
/*
* Found target. Link in and return, since it can't be anything
* else.
*/
- s2 = (Suff *)Lst_Datum(ln);
SuffInsert(s2->children, s);
SuffInsert(s->parents, s2);
return(0);
@@ -2359,7 +2372,7 @@ static int SuffPrintName(s, dummy)
void * s;
void * dummy;
{
- printf ("%s ", ((Suff *) s)->name);
+ printf ("`%s' ", ((Suff *) s)->name);
return (dummy ? 0 : 0);
}
OpenPOWER on IntegriCloud