Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): inline MakeAddChild into ExamineLater
details: https://anonhg.NetBSD.org/src/rev/fa9fa81315ef
branches: trunk
changeset: 945849:fa9fa81315ef
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 08 11:05:58 2020 +0000
description:
make(1): inline MakeAddChild into ExamineLater
This gets rid of a few void pointers and unspecific variable names like
"l" for the list that should have rather been called "examine" all the
time.
Add quotes around placeholders in debug messages. Especially for targets
like "all" the message had been syntactically misleading.
diffstat:
usr.bin/make/make.c | 40 +++++++++++++++-------------
usr.bin/make/unit-tests/depsrc-optional.exp | 6 ++--
2 files changed, 25 insertions(+), 21 deletions(-)
diffs (90 lines):
diff -r 2a87a2050af0 -r fa9fa81315ef usr.bin/make/make.c
--- a/usr.bin/make/make.c Sun Nov 08 10:50:50 2020 +0000
+++ b/usr.bin/make/make.c Sun Nov 08 11:05:58 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $ */
+/* $NetBSD: make.c,v 1.200 2020/11/08 11:05:58 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -108,7 +108,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.199 2020/11/08 10:50:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.200 2020/11/08 11:05:58 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked = 1;
@@ -341,21 +341,6 @@
return oodate;
}
-/* Add the node to the list if it needs to be examined. */
-static int
-MakeAddChild(void *gnp, void *lp)
-{
- GNode *gn = gnp;
- GNodeList *l = lp;
-
- if (!(gn->flags & REMAKE) && !(gn->type & (OP_USE|OP_USEBEFORE))) {
- DEBUG2(MAKE, "MakeAddChild: need to examine %s%s\n",
- gn->name, gn->cohort_num);
- Lst_Enqueue(l, gn);
- }
- return 0;
-}
-
static void
PretendAllChildrenAreMade(GNode *pgn)
{
@@ -1101,6 +1086,25 @@
break;
}
+static void
+ExamineLater(GNodeList *examine, GNodeList *toBeExamined)
+{
+ ListNode *ln;
+
+ for (ln = toBeExamined->first; ln != NULL; ln = ln->next) {
+ GNode *gn = ln->datum;
+
+ if (gn->flags & REMAKE)
+ continue;
+ if (gn->type & (OP_USE | OP_USEBEFORE))
+ continue;
+
+ DEBUG2(MAKE, "ExamineLater: need to examine \"%s%s\"\n",
+ gn->name, gn->cohort_num);
+ Lst_Enqueue(examine, gn);
+ }
+}
+
/* Expand .USE nodes and create a new targets list.
*
* Input:
@@ -1177,7 +1181,7 @@
}
if (gn->unmade != 0)
- Lst_ForEachUntil(gn->children, MakeAddChild, examine);
+ ExamineLater(examine, gn->children);
}
Lst_Free(examine);
diff -r 2a87a2050af0 -r fa9fa81315ef usr.bin/make/unit-tests/depsrc-optional.exp
--- a/usr.bin/make/unit-tests/depsrc-optional.exp Sun Nov 08 10:50:50 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-optional.exp Sun Nov 08 11:05:58 2020 +0000
@@ -1,8 +1,8 @@
Make_ExpandUse: examine all
-MakeAddChild: need to examine important
+ExamineLater: need to examine "important"
Make_ExpandUse: examine important
-MakeAddChild: need to examine optional
-MakeAddChild: need to examine optional-cohort
+ExamineLater: need to examine "optional"
+ExamineLater: need to examine "optional-cohort"
Make_ExpandUse: examine optional
Make_ExpandUse: examine optional-cohort
Examining optional...non-existent...up-to-date.
Home |
Main Index |
Thread Index |
Old Index