make(1): migrate Lst_ForEach to Lst_ForEachS
Most lists are always valid. Only the "targets" variable may be null in some cases, probably.
This commit is contained in:
parent
f199d14109
commit
6c196ebe9c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat.c,v 1.129 2020/08/23 19:00:19 rillig Exp $ */
|
||||
/* $NetBSD: compat.c,v 1.130 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -70,14 +70,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: compat.c,v 1.129 2020/08/23 19:00:19 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: compat.c,v 1.130 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: compat.c,v 1.129 2020/08/23 19:00:19 rillig Exp $");
|
||||
__RCSID("$NetBSD: compat.c,v 1.130 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -532,7 +532,7 @@ Compat_Make(void *gnp, void *pgnp)
|
|||
gn->made = BEINGMADE;
|
||||
if ((gn->type & OP_MADE) == 0)
|
||||
Suff_FindDeps(gn);
|
||||
Lst_ForEach(gn->children, Compat_Make, gn);
|
||||
Lst_ForEachS(gn->children, Compat_Make, gn);
|
||||
if ((gn->flags & REMAKE) == 0) {
|
||||
gn->made = ABORTED;
|
||||
pgn->flags &= ~(unsigned)REMAKE;
|
||||
|
@ -602,7 +602,7 @@ Compat_Make(void *gnp, void *pgnp)
|
|||
meta_job_start(NULL, gn);
|
||||
}
|
||||
#endif
|
||||
Lst_ForEach(gn->commands, CompatRunCommand, gn);
|
||||
Lst_ForEachS(gn->commands, CompatRunCommand, gn);
|
||||
curTarg = NULL;
|
||||
} else {
|
||||
Job_Touch(gn, gn->type & OP_SILENT);
|
||||
|
@ -671,7 +671,7 @@ Compat_Make(void *gnp, void *pgnp)
|
|||
}
|
||||
|
||||
cohorts:
|
||||
Lst_ForEach(gn->cohorts, Compat_Make, pgnp);
|
||||
Lst_ForEachS(gn->cohorts, Compat_Make, pgnp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.112 2020/08/27 06:28:44 rillig Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.113 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -70,14 +70,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.112 2020/08/27 06:28:44 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.113 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.112 2020/08/27 06:28:44 rillig Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.113 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -924,7 +924,7 @@ Dir_Expand(const char *word, Lst path, Lst expansions)
|
|||
}
|
||||
}
|
||||
if (DEBUG(DIR)) {
|
||||
Lst_ForEach(expansions, DirPrintWord, NULL);
|
||||
Lst_ForEachS(expansions, DirPrintWord, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -1811,5 +1811,5 @@ DirPrintDir(void *p, void *dummy MAKE_ATTR_UNUSED)
|
|||
void
|
||||
Dir_PrintPath(Lst path)
|
||||
{
|
||||
Lst_ForEach(path, DirPrintDir, NULL);
|
||||
Lst_ForEachS(path, DirPrintDir, NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: job.c,v 1.216 2020/08/27 06:31:46 rillig Exp $ */
|
||||
/* $NetBSD: job.c,v 1.217 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -70,14 +70,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.216 2020/08/27 06:31:46 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.217 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: job.c,v 1.216 2020/08/27 06:31:46 rillig Exp $");
|
||||
__RCSID("$NetBSD: job.c,v 1.217 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -1655,7 +1655,7 @@ JobStart(GNode *gn, int flags)
|
|||
* We can do all the commands at once. hooray for sanity
|
||||
*/
|
||||
numCommands = 0;
|
||||
Lst_ForEach(gn->commands, JobPrintCommand, job);
|
||||
Lst_ForEachS(gn->commands, JobPrintCommand, job);
|
||||
|
||||
/*
|
||||
* If we didn't print out any commands to the shell script,
|
||||
|
@ -1682,7 +1682,7 @@ JobStart(GNode *gn, int flags)
|
|||
* doesn't do any harm in this case and may do some good.
|
||||
*/
|
||||
if (cmdsOK) {
|
||||
Lst_ForEach(gn->commands, JobPrintCommand, job);
|
||||
Lst_ForEachS(gn->commands, JobPrintCommand, job);
|
||||
}
|
||||
/*
|
||||
* Don't execute the shell, thank you.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.c,v 1.43 2020/08/27 06:28:44 rillig Exp $ */
|
||||
/* $NetBSD: lst.c,v 1.44 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -37,11 +37,11 @@
|
|||
#include "make.h"
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: lst.c,v 1.43 2020/08/27 06:28:44 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: lst.c,v 1.44 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: lst.c,v 1.43 2020/08/27 06:28:44 rillig Exp $");
|
||||
__RCSID("$NetBSD: lst.c,v 1.44 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
||||
|
@ -498,15 +498,6 @@ Lst_MemberS(Lst list, void *datum)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Apply the given function to each element of the given list. The function
|
||||
* should return 0 if traversal should continue and non-zero if it should
|
||||
* abort. */
|
||||
int
|
||||
Lst_ForEach(Lst list, LstActionProc proc, void *procData)
|
||||
{
|
||||
return Lst_ForEachFrom(list, Lst_First(list), proc, procData);
|
||||
}
|
||||
|
||||
/* Apply the given function to each element of the given list. The function
|
||||
* should return 0 if traversal should continue and non-zero if it should
|
||||
* abort. */
|
||||
|
@ -518,20 +509,6 @@ Lst_ForEachS(Lst list, LstActionProc proc, void *procData)
|
|||
return Lst_ForEachFromS(list, Lst_First(list), proc, procData);
|
||||
}
|
||||
|
||||
/* Apply the given function to each element of the given list, starting from
|
||||
* the given node. The function should return 0 if traversal should continue,
|
||||
* and non-zero if it should abort. */
|
||||
int
|
||||
Lst_ForEachFrom(Lst list, LstNode node,
|
||||
LstActionProc proc, void *procData)
|
||||
{
|
||||
if (!LstIsValid(list) || LstIsEmpty(list)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Lst_ForEachFromS(list, node, proc, procData);
|
||||
}
|
||||
|
||||
/* Apply the given function to each element of the given list, starting from
|
||||
* the given node. The function should return 0 if traversal should continue,
|
||||
* and non-zero if it should abort. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.h,v 1.46 2020/08/27 06:28:44 rillig Exp $ */
|
||||
/* $NetBSD: lst.h,v 1.47 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -160,10 +160,8 @@ LstNode Lst_FindFromS(Lst, LstNode, LstFindProc, const void *);
|
|||
*/
|
||||
LstNode Lst_MemberS(Lst, void *);
|
||||
/* Apply a function to all elements of a lst */
|
||||
int Lst_ForEach(Lst, LstActionProc, void *);
|
||||
int Lst_ForEachS(Lst, LstActionProc, void *);
|
||||
/* Apply a function to all elements of a lst starting from a certain point. */
|
||||
int Lst_ForEachFrom(Lst, LstNode, LstActionProc, void *);
|
||||
int Lst_ForEachFromS(Lst, LstNode, LstActionProc, void *);
|
||||
/*
|
||||
* these functions are for dealing with a list as a table, of sorts.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.314 2020/08/26 22:55:46 rillig Exp $ */
|
||||
/* $NetBSD: main.c,v 1.315 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,7 +69,7 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.314 2020/08/26 22:55:46 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.315 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
|
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.314 2020/08/26 22:55:46 rillig Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.315 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -2041,7 +2041,7 @@ PrintOnError(GNode *gn, const char *s)
|
|||
*/
|
||||
Var_Set(".ERROR_TARGET", gn->name, VAR_GLOBAL);
|
||||
Var_Delete(".ERROR_CMD", VAR_GLOBAL);
|
||||
Lst_ForEach(gn->commands, addErrorCMD, gn);
|
||||
Lst_ForEachS(gn->commands, addErrorCMD, gn);
|
||||
}
|
||||
expr = "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}";
|
||||
cp = Var_Subst(expr, VAR_GLOBAL, VARE_WANTRES);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: make.c,v 1.125 2020/08/27 06:31:46 rillig Exp $ */
|
||||
/* $NetBSD: make.c,v 1.126 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: make.c,v 1.125 2020/08/27 06:31:46 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: make.c,v 1.126 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)make.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: make.c,v 1.125 2020/08/27 06:31:46 rillig Exp $");
|
||||
__RCSID("$NetBSD: make.c,v 1.126 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -146,7 +146,7 @@ make_abort(GNode *gn, int line)
|
|||
|
||||
fprintf(debug_file, "make_abort from line %d\n", line);
|
||||
Targ_PrintNode(gn, &two);
|
||||
Lst_ForEach(toBeMade, Targ_PrintNode, &two);
|
||||
Lst_ForEachS(toBeMade, Targ_PrintNode, &two);
|
||||
Targ_PrintGraph(3);
|
||||
abort();
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ Make_OODate(GNode *gn)
|
|||
* thinking they're out-of-date.
|
||||
*/
|
||||
if (!oodate) {
|
||||
Lst_ForEach(gn->parents, MakeTimeStamp, gn);
|
||||
Lst_ForEachS(gn->parents, MakeTimeStamp, gn);
|
||||
}
|
||||
|
||||
return oodate;
|
||||
|
@ -735,7 +735,7 @@ Make_Update(GNode *cgn)
|
|||
parents = centurion->parents;
|
||||
|
||||
/* If this was a .ORDER node, schedule the RHS */
|
||||
Lst_ForEach(centurion->order_succ, MakeBuildParent, Lst_First(toBeMade));
|
||||
Lst_ForEachS(centurion->order_succ, MakeBuildParent, Lst_First(toBeMade));
|
||||
|
||||
/* Now mark all the parents as having one less unmade child */
|
||||
Lst_OpenS(parents);
|
||||
|
@ -816,8 +816,8 @@ Make_Update(GNode *cgn)
|
|||
fprintf(debug_file, "- not deferred\n");
|
||||
continue;
|
||||
}
|
||||
if (pgn->order_pred
|
||||
&& Lst_ForEach(pgn->order_pred, MakeCheckOrder, 0)) {
|
||||
assert(pgn->order_pred != NULL);
|
||||
if (Lst_ForEachS(pgn->order_pred, MakeCheckOrder, 0)) {
|
||||
/* A .ORDER rule stops us building this */
|
||||
continue;
|
||||
}
|
||||
|
@ -977,8 +977,8 @@ Make_DoAllVar(GNode *gn)
|
|||
if (gn->flags & DONE_ALLSRC)
|
||||
return;
|
||||
|
||||
Lst_ForEach(gn->children, MakeUnmark, gn);
|
||||
Lst_ForEach(gn->children, MakeAddAllSrc, gn);
|
||||
Lst_ForEachS(gn->children, MakeUnmark, gn);
|
||||
Lst_ForEachS(gn->children, MakeAddAllSrc, gn);
|
||||
|
||||
if (!Var_Exists (OODATE, gn)) {
|
||||
Var_Set(OODATE, "", gn);
|
||||
|
@ -1037,7 +1037,8 @@ MakeBuildChild(void *v_cn, void *toBeMade_next)
|
|||
return 0;
|
||||
|
||||
/* If this node is on the RHS of a .ORDER, check LHSs. */
|
||||
if (cn->order_pred && Lst_ForEach(cn->order_pred, MakeCheckOrder, 0)) {
|
||||
assert(cn->order_pred);
|
||||
if (Lst_ForEachS(cn->order_pred, MakeCheckOrder, 0)) {
|
||||
/* Can't build this (or anything else in this child list) yet */
|
||||
cn->made = DEFERRED;
|
||||
return 0; /* but keep looking */
|
||||
|
@ -1054,7 +1055,7 @@ MakeBuildChild(void *v_cn, void *toBeMade_next)
|
|||
Lst_InsertBeforeS(toBeMade, toBeMade_next, cn);
|
||||
|
||||
if (cn->unmade_cohorts != 0)
|
||||
Lst_ForEach(cn->cohorts, MakeBuildChild, toBeMade_next);
|
||||
Lst_ForEachS(cn->cohorts, MakeBuildChild, toBeMade_next);
|
||||
|
||||
/*
|
||||
* If this node is a .WAIT node with unmade chlidren
|
||||
|
@ -1120,7 +1121,7 @@ MakeStartJobs(void)
|
|||
* just before the current first element.
|
||||
*/
|
||||
gn->made = DEFERRED;
|
||||
Lst_ForEach(gn->children, MakeBuildChild, Lst_First(toBeMade));
|
||||
Lst_ForEachS(gn->children, MakeBuildChild, Lst_First(toBeMade));
|
||||
/* and drop this node on the floor */
|
||||
if (DEBUG(MAKE))
|
||||
fprintf(debug_file, "dropped %s%s\n", gn->name, gn->cohort_num);
|
||||
|
@ -1236,7 +1237,7 @@ MakePrintStatus(void *gnp, void *v_errors)
|
|||
GNode_FprintDetails(debug_file, " (", gn, ")!\n");
|
||||
}
|
||||
/* Most likely problem is actually caused by .ORDER */
|
||||
Lst_ForEach(gn->order_pred, MakePrintStatusOrder, gn);
|
||||
Lst_ForEachS(gn->order_pred, MakePrintStatusOrder, gn);
|
||||
break;
|
||||
default:
|
||||
/* Errors - already counted */
|
||||
|
@ -1260,7 +1261,7 @@ MakePrintStatus(void *gnp, void *v_errors)
|
|||
if (!(gn->flags & CYCLE)) {
|
||||
/* Fist time we've seen this node, check all children */
|
||||
gn->flags |= CYCLE;
|
||||
Lst_ForEach(gn->children, MakePrintStatus, errors);
|
||||
Lst_ForEachS(gn->children, MakePrintStatus, errors);
|
||||
/* Mark that this node needn't be processed again */
|
||||
gn->flags |= DONECYCLE;
|
||||
return 0;
|
||||
|
@ -1274,7 +1275,7 @@ MakePrintStatus(void *gnp, void *v_errors)
|
|||
return 1;
|
||||
|
||||
/* Reporting for our children will give the rest of the loop */
|
||||
Lst_ForEach(gn->children, MakePrintStatus, errors);
|
||||
Lst_ForEachS(gn->children, MakePrintStatus, errors);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1342,21 +1343,21 @@ Make_ExpandUse(Lst targs)
|
|||
|
||||
(void)Dir_MTime(gn, 0);
|
||||
Var_Set(TARGET, gn->path ? gn->path : gn->name, gn);
|
||||
Lst_ForEach(gn->children, MakeUnmark, gn);
|
||||
Lst_ForEach(gn->children, MakeHandleUse, gn);
|
||||
Lst_ForEachS(gn->children, MakeUnmark, gn);
|
||||
Lst_ForEachS(gn->children, MakeHandleUse, gn);
|
||||
|
||||
if ((gn->type & OP_MADE) == 0)
|
||||
Suff_FindDeps(gn);
|
||||
else {
|
||||
/* Pretend we made all this node's children */
|
||||
Lst_ForEach(gn->children, MakeFindChild, gn);
|
||||
Lst_ForEachS(gn->children, MakeFindChild, gn);
|
||||
if (gn->unmade != 0)
|
||||
printf("Warning: %s%s still has %d unmade children\n",
|
||||
gn->name, gn->cohort_num, gn->unmade);
|
||||
}
|
||||
|
||||
if (gn->unmade != 0)
|
||||
Lst_ForEach(gn->children, MakeAddChild, examine);
|
||||
Lst_ForEachS(gn->children, MakeAddChild, examine);
|
||||
}
|
||||
|
||||
Lst_FreeS(examine);
|
||||
|
@ -1429,7 +1430,7 @@ Make_ProcessWait(Lst targs)
|
|||
/* Get it displayed in the diag dumps */
|
||||
Lst_PrependS(Targ_List(), pgn);
|
||||
|
||||
Lst_ForEach(targs, link_parent, pgn);
|
||||
Lst_ForEachS(targs, link_parent, pgn);
|
||||
|
||||
/* Start building with the 'dummy' .MAIN' node */
|
||||
MakeBuildChild(pgn, NULL);
|
||||
|
@ -1549,7 +1550,7 @@ Make_Run(Lst targs)
|
|||
if (DEBUG(MAKE))
|
||||
fprintf(debug_file, "done: errors %d\n", errors);
|
||||
if (errors == 0) {
|
||||
Lst_ForEach(targs, MakePrintStatus, &errors);
|
||||
Lst_ForEachS(targs, MakePrintStatus, &errors);
|
||||
if (DEBUG(MAKE)) {
|
||||
fprintf(debug_file, "done: errors %d\n", errors);
|
||||
if (errors)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: meta.c,v 1.100 2020/08/26 22:55:46 rillig Exp $ */
|
||||
/* $NetBSD: meta.c,v 1.101 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Implement 'meta' mode.
|
||||
|
@ -424,7 +424,7 @@ meta_needed(GNode *gn, const char *dname, const char *tname,
|
|||
}
|
||||
if ((gn->type & (OP_META|OP_SUBMAKE)) == OP_SUBMAKE) {
|
||||
/* OP_SUBMAKE is a bit too aggressive */
|
||||
if (Lst_ForEach(gn->commands, is_submake, gn)) {
|
||||
if (Lst_ForEachS(gn->commands, is_submake, gn)) {
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "Skipping meta for %s: .SUBMAKE\n",
|
||||
gn->name);
|
||||
|
@ -517,7 +517,7 @@ meta_create(BuildMon *pbm, GNode *gn)
|
|||
|
||||
mf.gn = gn;
|
||||
|
||||
Lst_ForEach(gn->commands, printCMD, &mf);
|
||||
Lst_ForEachS(gn->commands, printCMD, &mf);
|
||||
|
||||
fprintf(mf.fp, "CWD %s\n", getcwd(buf, sizeof(buf)));
|
||||
fprintf(mf.fp, "TARGET %s\n", tname);
|
||||
|
@ -1001,7 +1001,7 @@ meta_ignore(GNode *gn, const char *p)
|
|||
|
||||
if (*p == '/') {
|
||||
cached_realpath(p, fname); /* clean it up */
|
||||
if (Lst_ForEach(metaIgnorePaths, prefix_match, fname)) {
|
||||
if (Lst_ForEachS(metaIgnorePaths, prefix_match, fname)) {
|
||||
#ifdef DEBUG_META_MODE
|
||||
if (DEBUG(META))
|
||||
fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
|
||||
|
@ -1397,7 +1397,7 @@ meta_oodate(GNode *gn, Boolean oodate)
|
|||
if (strncmp(p, cwd, cwdlen) == 0)
|
||||
break;
|
||||
|
||||
if (!Lst_ForEach(metaBailiwick, prefix_match, p))
|
||||
if (!Lst_ForEachS(metaBailiwick, prefix_match, p))
|
||||
break;
|
||||
|
||||
/* tmpdir might be within */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.c,v 1.264 2020/08/27 06:13:53 rillig Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.265 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.264 2020/08/27 06:13:53 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.265 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.264 2020/08/27 06:13:53 rillig Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.265 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -981,7 +981,8 @@ ParseDoSrc(int tOp, const char *src)
|
|||
if (keywd != -1) {
|
||||
int op = parseKeywords[keywd].op;
|
||||
if (op != 0) {
|
||||
Lst_ForEach(targets, ParseDoOp, &op);
|
||||
if (targets != NULL)
|
||||
Lst_ForEachS(targets, ParseDoOp, &op);
|
||||
return;
|
||||
}
|
||||
if (parseKeywords[keywd].spec == Wait) {
|
||||
|
@ -999,7 +1000,8 @@ ParseDoSrc(int tOp, const char *src)
|
|||
if (doing_depend)
|
||||
ParseMark(gn);
|
||||
gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN;
|
||||
Lst_ForEach(targets, ParseLinkSrc, gn);
|
||||
if (targets != NULL)
|
||||
Lst_ForEachS(targets, ParseLinkSrc, gn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1067,7 +1069,8 @@ ParseDoSrc(int tOp, const char *src)
|
|||
if (tOp) {
|
||||
gn->type |= tOp;
|
||||
} else {
|
||||
Lst_ForEach(targets, ParseLinkSrc, gn);
|
||||
if (targets != NULL)
|
||||
Lst_ForEachS(targets, ParseLinkSrc, gn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1547,7 +1550,8 @@ ParseDoDependency(char *line)
|
|||
* operator a target was defined with. It fails if the operator
|
||||
* used isn't consistent across all references.
|
||||
*/
|
||||
Lst_ForEach(targets, ParseDoOp, &op);
|
||||
if (targets != NULL)
|
||||
Lst_ForEachS(targets, ParseDoOp, &op);
|
||||
|
||||
/*
|
||||
* Onward to the sources.
|
||||
|
@ -1584,7 +1588,8 @@ ParseDoDependency(char *line)
|
|||
beSilent = TRUE;
|
||||
break;
|
||||
case ExPath:
|
||||
Lst_ForEach(paths, ParseClearPath, NULL);
|
||||
if (paths != NULL)
|
||||
Lst_ForEachS(paths, ParseClearPath, NULL);
|
||||
Dir_SetPATH();
|
||||
break;
|
||||
#ifdef POSIX
|
||||
|
@ -1659,7 +1664,8 @@ ParseDoDependency(char *line)
|
|||
Suff_AddSuffix(line, &mainNode);
|
||||
break;
|
||||
case ExPath:
|
||||
Lst_ForEach(paths, ParseAddDir, line);
|
||||
if (paths != NULL)
|
||||
Lst_ForEachS(paths, ParseAddDir, line);
|
||||
break;
|
||||
case Includes:
|
||||
Suff_AddInclude(line);
|
||||
|
@ -1740,14 +1746,14 @@ ParseDoDependency(char *line)
|
|||
}
|
||||
}
|
||||
|
||||
if (mainNode == NULL) {
|
||||
if (mainNode == NULL && targets != NULL) {
|
||||
/*
|
||||
* If we have yet to decide on a main target to make, in the
|
||||
* absence of any user input, we want the first target on
|
||||
* the first dependency line that is actually a real target
|
||||
* (i.e. isn't a .USE or .EXEC rule) to be made.
|
||||
*/
|
||||
Lst_ForEach(targets, ParseFindMain, NULL);
|
||||
Lst_ForEachS(targets, ParseFindMain, NULL);
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -3019,7 +3025,7 @@ ParseFinishLine(void)
|
|||
{
|
||||
if (inLine) {
|
||||
if (targets != NULL) {
|
||||
Lst_ForEach(targets, Suff_EndTransform, NULL);
|
||||
Lst_ForEachS(targets, Suff_EndTransform, NULL);
|
||||
Lst_DestroyS(targets, ParseHasCommands);
|
||||
}
|
||||
targets = NULL;
|
||||
|
@ -3133,7 +3139,7 @@ Parse_File(const char *name, int fd)
|
|||
*/
|
||||
if (targets) {
|
||||
cp = bmake_strdup(cp);
|
||||
Lst_ForEach(targets, ParseAddCmd, cp);
|
||||
Lst_ForEachS(targets, ParseAddCmd, cp);
|
||||
#ifdef CLEANUP
|
||||
Lst_AppendS(targCmds, cp);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: suff.c,v 1.117 2020/08/26 23:08:26 rillig Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.118 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.117 2020/08/26 23:08:26 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.118 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: suff.c,v 1.117 2020/08/26 23:08:26 rillig Exp $");
|
||||
__RCSID("$NetBSD: suff.c,v 1.118 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -1000,12 +1000,12 @@ Suff_AddSuffix(char *str, GNode **gn)
|
|||
gs.gn = gn;
|
||||
gs.s = s;
|
||||
gs.r = FALSE;
|
||||
Lst_ForEach(Targ_List(), SuffScanTargets, &gs);
|
||||
Lst_ForEachS(Targ_List(), SuffScanTargets, &gs);
|
||||
/*
|
||||
* Look for any existing transformations from or to this suffix.
|
||||
* XXX: Only do this after a Suff_ClearSuffixes?
|
||||
*/
|
||||
Lst_ForEach(transforms, SuffRebuildGraph, s);
|
||||
Lst_ForEachS(transforms, SuffRebuildGraph, s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ SuffAddSrc(void *sp, void *lsp)
|
|||
s2->cp = Lst_Init();
|
||||
Lst_AppendS(targ->cp, s2);
|
||||
fprintf(debug_file, "1 add %p %p to %p:", targ, s2, ls->l);
|
||||
Lst_ForEach(ls->l, PrintAddr, NULL);
|
||||
Lst_ForEachS(ls->l, PrintAddr, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
#endif
|
||||
}
|
||||
|
@ -1230,7 +1230,7 @@ SuffAddSrc(void *sp, void *lsp)
|
|||
s2->cp = Lst_Init();
|
||||
Lst_AppendS(targ->cp, s2);
|
||||
fprintf(debug_file, "2 add %p %p to %p:", targ, s2, ls->l);
|
||||
Lst_ForEach(ls->l, PrintAddr, NULL);
|
||||
Lst_ForEachS(ls->l, PrintAddr, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
#endif
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ SuffAddLevel(Lst l, Src *targ)
|
|||
ls.s = targ;
|
||||
ls.l = l;
|
||||
|
||||
Lst_ForEach(targ->suff->children, SuffAddSrc, &ls);
|
||||
Lst_ForEachS(targ->suff->children, SuffAddSrc, &ls);
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -1287,7 +1287,7 @@ SuffRemoveSrc(Lst l)
|
|||
|
||||
#ifdef DEBUG_SRC
|
||||
fprintf(debug_file, "cleaning %lx: ", (unsigned long) l);
|
||||
Lst_ForEach(l, PrintAddr, NULL);
|
||||
Lst_ForEachS(l, PrintAddr, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
#endif
|
||||
|
||||
|
@ -1319,7 +1319,7 @@ SuffRemoveSrc(Lst l)
|
|||
#ifdef DEBUG_SRC
|
||||
else {
|
||||
fprintf(debug_file, "keep: [l=%p] p=%p %d: ", l, s, s->children);
|
||||
Lst_ForEach(s->cp, PrintAddr, NULL);
|
||||
Lst_ForEachS(s->cp, PrintAddr, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
}
|
||||
#endif
|
||||
|
@ -2649,7 +2649,7 @@ SuffPrintTrans(void *tp, void *dummy MAKE_ATTR_UNUSED)
|
|||
fprintf(debug_file, "%-16s: ", t->name);
|
||||
Targ_PrintType(t->type);
|
||||
fputc('\n', debug_file);
|
||||
Lst_ForEach(t->commands, Targ_PrintCmd, NULL);
|
||||
Lst_ForEachS(t->commands, Targ_PrintCmd, NULL);
|
||||
fputc('\n', debug_file);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2658,8 +2658,8 @@ void
|
|||
Suff_PrintAll(void)
|
||||
{
|
||||
fprintf(debug_file, "#*** Suffixes:\n");
|
||||
Lst_ForEach(sufflist, SuffPrintSuff, NULL);
|
||||
Lst_ForEachS(sufflist, SuffPrintSuff, NULL);
|
||||
|
||||
fprintf(debug_file, "#*** Transformations:\n");
|
||||
Lst_ForEach(transforms, SuffPrintTrans, NULL);
|
||||
Lst_ForEachS(transforms, SuffPrintTrans, NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: targ.c,v 1.73 2020/08/26 22:55:46 rillig Exp $ */
|
||||
/* $NetBSD: targ.c,v 1.74 2020/08/27 06:53:57 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -69,14 +69,14 @@
|
|||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: targ.c,v 1.73 2020/08/26 22:55:46 rillig Exp $";
|
||||
static char rcsid[] = "$NetBSD: targ.c,v 1.74 2020/08/27 06:53:57 rillig Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: targ.c,v 1.73 2020/08/26 22:55:46 rillig Exp $");
|
||||
__RCSID("$NetBSD: targ.c,v 1.74 2020/08/27 06:53:57 rillig Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
|
@ -662,7 +662,7 @@ Targ_PrintNode(void *gnp, void *passp)
|
|||
}
|
||||
if (!Lst_IsEmpty (gn->iParents)) {
|
||||
fprintf(debug_file, "# implicit parents: ");
|
||||
Lst_ForEach(gn->iParents, TargPrintName, NULL);
|
||||
Lst_ForEachS(gn->iParents, TargPrintName, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
}
|
||||
} else {
|
||||
|
@ -671,17 +671,17 @@ Targ_PrintNode(void *gnp, void *passp)
|
|||
}
|
||||
if (!Lst_IsEmpty (gn->parents)) {
|
||||
fprintf(debug_file, "# parents: ");
|
||||
Lst_ForEach(gn->parents, TargPrintName, NULL);
|
||||
Lst_ForEachS(gn->parents, TargPrintName, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
}
|
||||
if (!Lst_IsEmpty (gn->order_pred)) {
|
||||
fprintf(debug_file, "# order_pred: ");
|
||||
Lst_ForEach(gn->order_pred, TargPrintName, NULL);
|
||||
Lst_ForEachS(gn->order_pred, TargPrintName, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
}
|
||||
if (!Lst_IsEmpty (gn->order_succ)) {
|
||||
fprintf(debug_file, "# order_succ: ");
|
||||
Lst_ForEach(gn->order_succ, TargPrintName, NULL);
|
||||
Lst_ForEachS(gn->order_succ, TargPrintName, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
}
|
||||
|
||||
|
@ -695,12 +695,12 @@ Targ_PrintNode(void *gnp, void *passp)
|
|||
fprintf(debug_file, ":: "); break;
|
||||
}
|
||||
Targ_PrintType(gn->type);
|
||||
Lst_ForEach(gn->children, TargPrintName, NULL);
|
||||
Lst_ForEachS(gn->children, TargPrintName, NULL);
|
||||
fprintf(debug_file, "\n");
|
||||
Lst_ForEach(gn->commands, Targ_PrintCmd, NULL);
|
||||
Lst_ForEachS(gn->commands, Targ_PrintCmd, NULL);
|
||||
fprintf(debug_file, "\n\n");
|
||||
if (gn->type & OP_DOUBLEDEP) {
|
||||
Lst_ForEach(gn->cohorts, Targ_PrintNode, &pass);
|
||||
Lst_ForEachS(gn->cohorts, Targ_PrintNode, &pass);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -754,10 +754,10 @@ void
|
|||
Targ_PrintGraph(int pass)
|
||||
{
|
||||
fprintf(debug_file, "#*** Input graph:\n");
|
||||
Lst_ForEach(allTargets, Targ_PrintNode, &pass);
|
||||
Lst_ForEachS(allTargets, Targ_PrintNode, &pass);
|
||||
fprintf(debug_file, "\n\n");
|
||||
fprintf(debug_file, "#\n# Files that are only sources:\n");
|
||||
Lst_ForEach(allTargets, TargPrintOnlySrc, NULL);
|
||||
Lst_ForEachS(allTargets, TargPrintOnlySrc, NULL);
|
||||
fprintf(debug_file, "#*** Global Variables:\n");
|
||||
Var_Dump(VAR_GLOBAL);
|
||||
fprintf(debug_file, "#*** Command-line Variables:\n");
|
||||
|
@ -798,7 +798,7 @@ TargPropagateNode(void *gnp, void *junk MAKE_ATTR_UNUSED)
|
|||
GNode *gn = (GNode *)gnp;
|
||||
|
||||
if (gn->type & OP_DOUBLEDEP)
|
||||
Lst_ForEach(gn->cohorts, TargPropagateCohort, gnp);
|
||||
Lst_ForEachS(gn->cohorts, TargPropagateCohort, gnp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -847,5 +847,5 @@ TargPropagateCohort(void *cgnp, void *pgnp)
|
|||
void
|
||||
Targ_Propagate(void)
|
||||
{
|
||||
Lst_ForEach(allTargets, TargPropagateNode, NULL);
|
||||
Lst_ForEachS(allTargets, TargPropagateNode, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue