Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/usr.bin/make/targ.c,v rcsdiff: /ftp/cvs/cvsroot/src/usr.bin/make/targ.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.77 retrieving revision 1.78 diff -u -p -r1.77 -r1.78 --- src/usr.bin/make/targ.c 2020/08/28 19:14:07 1.77 +++ src/usr.bin/make/targ.c 2020/08/29 20:20:44 1.78 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.77 2020/08/28 19:14:07 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.78 2020/08/29 20:20:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: targ.c,v 1.77 2020/08/28 19:14:07 rillig Exp $"; +static char rcsid[] = "$NetBSD: targ.c,v 1.78 2020/08/29 20:20:44 rillig Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: targ.c,v 1.77 2020/08/28 19:14:07 rillig Exp $"); +__RCSID("$NetBSD: targ.c,v 1.78 2020/08/29 20:20:44 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -147,8 +147,6 @@ static int TargPrintName(void *, void *) #ifdef CLEANUP static void TargFreeGN(void *); #endif -static int TargPropagateCohort(void *, void *); -static int TargPropagateNode(void *, void *); void Targ_Init(void) @@ -577,56 +575,26 @@ Targ_PrintGraph(int pass) Suff_PrintAll(); } -/* Propagate information from a single node to related nodes if appropriate. +/* Propagate some type information to cohort nodes (those from the :: + * dependency operator). * - * Information is propagated from this node to cohort nodes. - * - * If the node was defined with "::", then TargPropagateCohort() will be - * called for each cohort node. - * - * Input: - * gnp The node that we are processing. - * - * Results: - * Always returns 0, for the benefit of Lst_ForEach(). - */ -static int -TargPropagateNode(void *gnp, void *junk MAKE_ATTR_UNUSED) + * Should be called after the makefiles are parsed but before any action is + * taken. */ +void +Targ_Propagate(void) { - GNode *gn = (GNode *)gnp; + LstNode pn, cn; - if (gn->type & OP_DOUBLEDEP) - Lst_ForEach(gn->cohorts, TargPropagateCohort, gnp); - return 0; -} + for (pn = Lst_First(allTargets); pn != NULL; pn = LstNode_Next(pn)) { + GNode *pgn = Lst_Datum(pn); -/* Propagate some bits in the type mask from a node to a related cohort node. - * cnp's type bitmask is modified to incorporate some of the bits from gnp's - * type bitmask. (XXX need a better explanation.) - * - * Input: - * cnp The node that we are processing. - * gnp Another node that has cnp as a cohort. - * - * Results: - * Always returns 0, for the benefit of Lst_ForEach(). - */ -static int -TargPropagateCohort(void *cgnp, void *pgnp) -{ - GNode *cgn = (GNode *)cgnp; - GNode *pgn = (GNode *)pgnp; + if (!(pgn->type & OP_DOUBLEDEP)) + continue; - cgn->type |= pgn->type & ~OP_OPMASK; - return 0; -} + for (cn = Lst_First(pgn->cohorts); cn != NULL; cn = LstNode_Next(cn)) { + GNode *cgn = Lst_Datum(cn); -/* Propagate information between related nodes. Should be called after the - * makefiles are parsed but before any action is taken. - * - * Information is propagated between related nodes throughout the graph. */ -void -Targ_Propagate(void) -{ - Lst_ForEach(allTargets, TargPropagateNode, NULL); + cgn->type |= pgn->type & ~OP_OPMASK; + } + } }