Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make The use of OP_MARK in the MakeHandleUse() list ...



details:   https://anonhg.NetBSD.org/src/rev/8a875730f7cb
branches:  trunk
changeset: 522380:8a875730f7cb
user:      pk <pk%NetBSD.org@localhost>
date:      Mon Feb 18 00:33:40 2002 +0000

description:
The use of OP_MARK in the MakeHandleUse() list callback function prevents
the removal of .USE nodes from a node's children list in case a given .USE
nodes appears multiple times on that list, preventing the target from ever
making it on the `to be made' queue.

Since the suffix rule processing code deals itself with removing the
transformation nodes from the parents to which it applies them, arrange
for doing the same for .USE nodes in MakeHandleUse() instead of in
Make_HandleUse(), and still use the OP_MARK stuff to avoid duplication
of commands.

Also, since Make_HandleUse() is not a list callback function and its
return value is no longer used, make its return type void.

diffstat:

 usr.bin/make/make.c |  44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diffs (88 lines):

diff -r f0f678aae739 -r 8a875730f7cb usr.bin/make/make.c
--- a/usr.bin/make/make.c       Mon Feb 18 00:10:26 2002 +0000
+++ b/usr.bin/make/make.c       Mon Feb 18 00:33:40 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.42 2002/02/07 16:48:23 pk Exp $     */
+/*     $NetBSD: make.c,v 1.43 2002/02/18 00:33:40 pk Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -39,14 +39,14 @@
  */
 
 #ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: make.c,v 1.42 2002/02/07 16:48:23 pk Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.43 2002/02/18 00:33:40 pk 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.42 2002/02/07 16:48:23 pk Exp $");
+__RCSID("$NetBSD: make.c,v 1.43 2002/02/18 00:33:40 pk Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -371,7 +371,7 @@
  *
  *-----------------------------------------------------------------------
  */
-int
+void
 Make_HandleUse (cgn, pgn)
     register GNode     *cgn;   /* The .USE node */
     register GNode     *pgn;   /* The target of the .USE node */
@@ -430,21 +430,7 @@
        }
 
        pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_USEBEFORE|OP_TRANSFORM);
-
-       /*
-        * This child node is now "made", so we decrement the count of
-        * unmade children in the parent... We also remove the child
-        * from the parent's list to accurately reflect the number of decent
-        * children the parent has. This is used by Make_Run to decide
-        * whether to queue the parent or examine its children...
-        */
-       if ((cgn->type & (OP_USE|OP_USEBEFORE)) &&
-           (ln = Lst_Member (pgn->children, (ClientData) cgn)) != NILLNODE) {
-           Lst_Remove(pgn->children, ln);
-           pgn->unmade--;
-       }
     }
-    return (0);
 }
 
 static int
@@ -454,12 +440,26 @@
 {
     GNode      *cgn = (GNode *) cgnp;
     GNode      *pgn = (GNode *) pgnp;
+    LstNode    ln;     /* An element in the children list */
 
-    if (cgn->type & OP_MARK)
-       return (0);
-    cgn->type |= OP_MARK;
+    if ((cgn->type & OP_MARK) == 0) {
+       Make_HandleUse(cgn, pgn);
+       cgn->type |= OP_MARK;
+    }
 
-    return Make_HandleUse(cgn, pgn);
+    /*
+     * This child node is now "made", so we decrement the count of
+     * unmade children in the parent... We also remove the child
+     * from the parent's list to accurately reflect the number of decent
+     * children the parent has. This is used by Make_Run to decide
+     * whether to queue the parent or examine its children...
+     */
+    if ((cgn->type & (OP_USE|OP_USEBEFORE)) &&
+           (ln = Lst_Member (pgn->children, (ClientData) cgn)) != NILLNODE) {
+       Lst_Remove(pgn->children, ln);
+       pgn->unmade--;
+    }
+    return (0);
 }
 
 



Home | Main Index | Thread Index | Old Index