Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Introduce an OP_MARK bit, and use it to suppres...
details: https://anonhg.NetBSD.org/src/rev/fe1e46984c3b
branches: trunk
changeset: 487659:fe1e46984c3b
user: mycroft <mycroft%NetBSD.org@localhost>
date: Sat Jun 10 21:44:08 2000 +0000
description:
Introduce an OP_MARK bit, and use it to suppress duplicates during .ALLSRC
and .USE expansion. Also, remove some more Lst_Member() checks that are now
redundant.
diffstat:
usr.bin/make/make.c | 37 +++++++++++++++++++++++++++++--------
usr.bin/make/make.h | 3 ++-
usr.bin/make/parse.c | 20 +++++++-------------
usr.bin/make/suff.c | 29 ++++++++++++-----------------
4 files changed, 50 insertions(+), 39 deletions(-)
diffs (236 lines):
diff -r c605f3fce50f -r fe1e46984c3b usr.bin/make/make.c
--- a/usr.bin/make/make.c Sat Jun 10 20:51:43 2000 +0000
+++ b/usr.bin/make/make.c Sat Jun 10 21:44:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.27 2000/02/29 22:00:02 sjg Exp $ */
+/* $NetBSD: make.c,v 1.28 2000/06/10 21:44:08 mycroft Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -39,14 +39,14 @@
*/
#ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: make.c,v 1.27 2000/02/29 22:00:02 sjg Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.28 2000/06/10 21:44:08 mycroft 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.27 2000/02/29 22:00:02 sjg Exp $");
+__RCSID("$NetBSD: make.c,v 1.28 2000/06/10 21:44:08 mycroft Exp $");
#endif
#endif /* not lint */
#endif
@@ -102,6 +102,7 @@
static int MakeAddChild __P((ClientData, ClientData));
static int MakeFindChild __P((ClientData, ClientData));
+static int MakeUnmark __P((ClientData, ClientData));
static int MakeAddAllSrc __P((ClientData, ClientData));
static int MakeTimeStamp __P((ClientData, ClientData));
static int MakeHandleUse __P((ClientData, ClientData));
@@ -377,6 +378,10 @@
{
register LstNode ln; /* An element in the children list */
+ if (cgn->type & OP_MARK)
+ return (0);
+ cgn->type |= OP_MARK;
+
if (cgn->type & (OP_USE|OP_TRANSFORM)) {
if ((cgn->type & OP_USE) || Lst_IsEmpty(pgn->commands)) {
/*
@@ -410,11 +415,9 @@
gn = tgn;
}
- if (Lst_Member (pgn->children, gn) == NILLNODE) {
- (void) Lst_AtEnd (pgn->children, gn);
- (void) Lst_AtEnd (gn->parents, pgn);
- pgn->unmade += 1;
- }
+ (void) Lst_AtEnd (pgn->children, gn);
+ (void) Lst_AtEnd (gn->parents, pgn);
+ pgn->unmade += 1;
}
Lst_Close (cgn->children);
}
@@ -669,6 +672,17 @@
*-----------------------------------------------------------------------
*/
static int
+MakeUnmark (cgnp, pgnp)
+ ClientData cgnp;
+ ClientData pgnp;
+{
+ GNode *cgn = (GNode *) cgnp;
+
+ cgn->type &= ~OP_MARK;
+ return (0);
+}
+
+static int
MakeAddAllSrc (cgnp, pgnp)
ClientData cgnp; /* The child to add */
ClientData pgnp; /* The parent to whose ALLSRC variable it should be */
@@ -676,6 +690,11 @@
{
GNode *cgn = (GNode *) cgnp;
GNode *pgn = (GNode *) pgnp;
+
+ if (cgn->type & OP_MARK)
+ return (0);
+ cgn->type |= OP_MARK;
+
if ((cgn->type & (OP_EXEC|OP_USE|OP_INVISIBLE)) == 0) {
char *child;
char *p1 = NULL;
@@ -742,6 +761,7 @@
Make_DoAllVar (gn)
GNode *gn;
{
+ Lst_ForEach (gn->children, MakeUnmark, (ClientData) gn);
Lst_ForEach (gn->children, MakeAddAllSrc, (ClientData) gn);
if (!Var_Exists (OODATE, gn)) {
@@ -968,6 +988,7 @@
(void)Dir_MTime(gn);
Var_Set (TARGET, gn->path ? gn->path : gn->name, gn);
+ Lst_ForEach (gn->children, MakeUnmark, (ClientData)gn);
Lst_ForEach (gn->children, MakeHandleUse, (ClientData)gn);
Suff_FindDeps (gn);
diff -r c605f3fce50f -r fe1e46984c3b usr.bin/make/make.h
--- a/usr.bin/make/make.h Sat Jun 10 20:51:43 2000 +0000
+++ b/usr.bin/make/make.h Sat Jun 10 21:44:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.26 2000/06/01 04:16:39 mycroft Exp $ */
+/* $NetBSD: make.h,v 1.27 2000/06/10 21:44:08 mycroft Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -230,6 +230,7 @@
* commands for a target */
#define OP_SAVE_CMDS 0x04000000 /* Saving commands on .END (Compat) */
#define OP_DEPS_FOUND 0x02000000 /* Already processed by Suff_FindDeps */
+#define OP_MARK 0x01000000 /* Node found while expanding .ALLSRC */
/*
* OP_NOP will return TRUE if the node with the given type was not the
diff -r c605f3fce50f -r fe1e46984c3b usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sat Jun 10 20:51:43 2000 +0000
+++ b/usr.bin/make/parse.c Sat Jun 10 21:44:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.49 2000/06/10 13:48:48 mycroft Exp $ */
+/* $NetBSD: parse.c,v 1.50 2000/06/10 21:44:08 mycroft Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -39,14 +39,14 @@
*/
#ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: parse.c,v 1.49 2000/06/10 13:48:48 mycroft Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.50 2000/06/10 21:44:08 mycroft 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.49 2000/06/10 13:48:48 mycroft Exp $");
+__RCSID("$NetBSD: parse.c,v 1.50 2000/06/10 21:44:08 mycroft Exp $");
#endif
#endif /* not lint */
#endif
@@ -443,19 +443,13 @@
{
GNode *pgn = (GNode *) pgnp;
GNode *cgn = (GNode *) cgnp;
+
if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (pgn->cohorts))
pgn = (GNode *) Lst_Datum (Lst_Last (pgn->cohorts));
-#if 0
- if (Lst_Member (pgn->children, (ClientData)cgn) == NILLNODE) {
-#else
- if (1) {
-#endif
- (void)Lst_AtEnd (pgn->children, (ClientData)cgn);
- if (specType == Not) {
+ (void)Lst_AtEnd (pgn->children, (ClientData)cgn);
+ if (specType == Not)
(void)Lst_AtEnd (cgn->parents, (ClientData)pgn);
- }
- pgn->unmade += 1;
- }
+ pgn->unmade += 1;
return (0);
}
diff -r c605f3fce50f -r fe1e46984c3b usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Sat Jun 10 20:51:43 2000 +0000
+++ b/usr.bin/make/suff.c Sat Jun 10 21:44:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.28 2000/01/22 19:28:11 mycroft Exp $ */
+/* $NetBSD: suff.c,v 1.29 2000/06/10 21:44:09 mycroft Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -39,14 +39,14 @@
*/
#ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: suff.c,v 1.28 2000/01/22 19:28:11 mycroft Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.29 2000/06/10 21:44:09 mycroft 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.28 2000/01/22 19:28:11 mycroft Exp $");
+__RCSID("$NetBSD: suff.c,v 1.29 2000/06/10 21:44:09 mycroft Exp $");
#endif
#endif /* not lint */
#endif
@@ -1680,15 +1680,12 @@
char *tname; /* Name of transformation rule */
GNode *gn; /* Node for same */
- if (Lst_Member(tGn->children, (ClientData)sGn) == NILLNODE) {
- /*
- * Not already linked, so form the proper links between the
- * target and source.
- */
- (void)Lst_AtEnd(tGn->children, (ClientData)sGn);
- (void)Lst_AtEnd(sGn->parents, (ClientData)tGn);
- tGn->unmade += 1;
- }
+ /*
+ * Form the proper links between the target and source.
+ */
+ (void)Lst_AtEnd(tGn->children, (ClientData)sGn);
+ (void)Lst_AtEnd(sGn->parents, (ClientData)tGn);
+ tGn->unmade += 1;
/*
* Locate the transformation rule itself
@@ -1800,11 +1797,9 @@
/*
* Create the link between the two nodes right off
*/
- if (Lst_Member(gn->children, (ClientData)mem) == NILLNODE) {
- (void)Lst_AtEnd(gn->children, (ClientData)mem);
- (void)Lst_AtEnd(mem->parents, (ClientData)gn);
- gn->unmade += 1;
- }
+ (void)Lst_AtEnd(gn->children, (ClientData)mem);
+ (void)Lst_AtEnd(mem->parents, (ClientData)gn);
+ gn->unmade += 1;
/*
* Copy in the variables from the member node to this one.
Home |
Main Index |
Thread Index |
Old Index