=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/suff.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -r1.92 -r1.93 --- src/usr.bin/make/suff.c 2017/07/24 12:07:46 1.92 +++ src/usr.bin/make/suff.c 2018/10/06 14:00:30 1.93 @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.92 2017/07/24 12:07:46 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.93 2018/10/06 14:00:30 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -180,7 +180,7 @@ static void SuffInsert(Lst, Suff *); static void SuffAddSrc(void *, void *); -static int SuffRemoveSrc(Lst); +static bool SuffRemoveSrc(Lst); static void SuffAddLevel(Lst, Src *); static Src *SuffFindThem(Lst, Lst); static Src *SuffFindCmds(Src *, Lst); @@ -730,21 +730,16 @@ /*- *---------------------------------------------------------------------- * SuffRemoveSrc -- - * Free all src structures in list that don't have a reference count + * Free Src structure with a zero reference count in a list * - * Results: - * Ture if an src was removed - * - * Side Effects: - * The memory is free'd. + * returns true if a src was removed *---------------------------------------------------------------------- */ -static int +static bool SuffRemoveSrc(Lst l) { LstNode ln; Src *s; - int t = 0; #ifdef DEBUG_SRC printf("cleaning %lx: ", (unsigned long)l); @@ -773,7 +768,6 @@ #endif Lst_Remove(l, ln); free(s); - t |= 1; return true; } #ifdef DEBUG_SRC @@ -785,7 +779,7 @@ #endif } - return t; + return false; } /*- @@ -1385,7 +1379,9 @@ Src *src; /* General Src pointer */ char *prefix; /* Prefix to use */ Src *targ; /* General Src target pointer */ + bool phony; + phony = (gn->type & OP_PHONY) == OP_PHONY; Lst_Init(&srcs); Lst_Init(&targs); @@ -1408,9 +1404,10 @@ * Should we find one, we discard the one we found before. */ - record_possible_suffixes(gn, &srcs, &targs); + if (!phony) + record_possible_suffixes(gn, &srcs, &targs); /* Handle target of unknown suffix... */ - if (Lst_IsEmpty(&srcs)) { + if (!phony && Lst_IsEmpty(&srcs)) { if (DEBUG(SUFF)) printf("\tNo known suffix on %s. Using empty suffix\n", gn->name); @@ -1428,7 +1425,7 @@ /* Only use the default suffix rules if we don't have commands * or dependencies defined for this gnode. */ - if (Lst_IsEmpty(&gn->commands) && Lst_IsEmpty(&gn->children)) + if (Lst_IsEmpty(&gn->commands)) SuffAddLevel(&srcs, targ); else { if (DEBUG(SUFF))