Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Instead of keeping around the mtime of the youn...



details:   https://anonhg.NetBSD.org/src/rev/beb8a31b9598
branches:  trunk
changeset: 759041:beb8a31b9598
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 25 21:31:08 2010 +0000

description:
Instead of keeping around the mtime of the youngest child, keep a pointer
to it, so that we can print it when we do the out of date determination.

diffstat:

 usr.bin/make/arch.c   |  14 +++++++-------
 usr.bin/make/compat.c |  14 +++++++-------
 usr.bin/make/make.c   |  39 ++++++++++++++++++++-------------------
 usr.bin/make/make.h   |   5 ++---
 usr.bin/make/targ.c   |  11 ++++++-----
 5 files changed, 42 insertions(+), 41 deletions(-)

diffs (292 lines):

diff -r 0fcf5d7ef743 -r beb8a31b9598 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Thu Nov 25 20:53:23 2010 +0000
+++ b/usr.bin/make/arch.c       Thu Nov 25 21:31:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.59 2009/01/23 21:58:27 dsl Exp $    */
+/*     $NetBSD: arch.c,v 1.60 2010/11/25 21:31:08 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.59 2009/01/23 21:58:27 dsl Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.60 2010/11/25 21:31:08 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.59 2009/01/23 21:58:27 dsl Exp $");
+__RCSID("$NetBSD: arch.c,v 1.60 2010/11/25 21:31:08 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1212,7 +1212,7 @@
  *     A library will be considered out-of-date for any of these reasons,
  *     given that it is a target on a dependency line somewhere:
  *         Its modification time is less than that of one of its
- *               sources (gn->mtime < gn->cmtime).
+ *               sources (gn->mtime < gn->cmgn->mtime).
  *         Its modification time is greater than the time at which the
  *               make began (i.e. it's been modified in the course
  *               of the make, probably by archiving).
@@ -1245,8 +1245,8 @@
        oodate = TRUE;
     } else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) {
        oodate = FALSE;
-    } else if ((!Lst_IsEmpty(gn->children) && gn->cmtime == 0) ||
-              (gn->mtime > now) || (gn->mtime < gn->cmtime)) {
+    } else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) ||
+              (gn->mtime > now) || (gn->mtime < gn->cmgn->mtime)) {
        oodate = TRUE;
     } else {
 #ifdef RANLIBMAG
@@ -1261,7 +1261,7 @@
            if (DEBUG(ARCH) || DEBUG(MAKE)) {
                fprintf(debug_file, "%s modified %s...", RANLIBMAG, Targ_FmtTime(modTimeTOC));
            }
-           oodate = (gn->cmtime > modTimeTOC);
+           oodate = (gn->cmgn == NULL || gn->gngm->mtime > modTimeTOC);
        } else {
            /*
             * A library w/o a table of contents is out-of-date
diff -r 0fcf5d7ef743 -r beb8a31b9598 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Thu Nov 25 20:53:23 2010 +0000
+++ b/usr.bin/make/compat.c     Thu Nov 25 21:31:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.81 2010/09/13 15:36:57 sjg Exp $  */
+/*     $NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos 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.81 2010/09/13 15:36:57 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos 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.81 2010/09/13 15:36:57 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -527,10 +527,10 @@
        }
 
        /*
-        * All the children were made ok. Now cmtime contains the modification
-        * time of the newest child, we need to find out if we exist and when
-        * we were modified last. The criteria for datedness are defined by the
-        * Make_OODate function.
+        * All the children were made ok. Now cmgn->mtime contains the
+        * modification time of the newest child, we need to find out if we
+        * exist and when we were modified last. The criteria for datedness
+        * are defined by the Make_OODate function.
         */
        if (DEBUG(MAKE)) {
            fprintf(debug_file, "Examining %s...", gn->name);
diff -r 0fcf5d7ef743 -r beb8a31b9598 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Thu Nov 25 20:53:23 2010 +0000
+++ b/usr.bin/make/make.c       Thu Nov 25 21:31:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.82 2010/09/13 15:36:57 sjg Exp $    */
+/*     $NetBSD: make.c,v 1.83 2010/11/25 21:31:09 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.82 2010/09/13 15:36:57 sjg Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.83 2010/11/25 21:31:09 christos 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.82 2010/09/13 15:36:57 sjg Exp $");
+__RCSID("$NetBSD: make.c,v 1.83 2010/11/25 21:31:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -94,12 +94,12 @@
  *
  *     Make_Update             Update all parents of a given child. Performs
  *                             various bookkeeping chores like the updating
- *                             of the cmtime field of the parent, filling
+ *                             of the cmgn field of the parent, filling
  *                             of the IMPSRC context variable, etc. It will
  *                             place the parent on the toBeMade queue if it
  *                             should be.
  *
- *     Make_TimeStamp          Function to set the parent's cmtime field
+ *     Make_TimeStamp          Function to set the parent's cmgn field
  *                             based on a child's modification time.
  *
  *     Make_DoAllVar           Set up the various local variables for a
@@ -154,7 +154,7 @@
 /*-
  *-----------------------------------------------------------------------
  * Make_TimeStamp --
- *     Set the cmtime field of a parent node based on the mtime stamp in its
+ *     Set the cmgn field of a parent node based on the mtime stamp in its
  *     child. Called from MakeOODate via Lst_ForEach.
  *
  * Input:
@@ -165,15 +165,15 @@
  *     Always returns 0.
  *
  * Side Effects:
- *     The cmtime of the parent node will be changed if the mtime
+ *     The cmgn of the parent node will be changed if the mtime
  *     field of the child is greater than it.
  *-----------------------------------------------------------------------
  */
 int
 Make_TimeStamp(GNode *pgn, GNode *cgn)
 {
-    if (cgn->mtime > pgn->cmtime) {
-       pgn->cmtime = cgn->mtime;
+    if (pgn->cmgn == NULL || cgn->mtime > pgn->cmgn->mtime) {
+       pgn->cmgn = cgn;
     }
     return (0);
 }
@@ -207,7 +207,7 @@
  *     TRUE if the node is out of date. FALSE otherwise.
  *
  * Side Effects:
- *     The mtime field of the node and the cmtime field of its parents
+ *     The mtime field of the node and the cmgn field of its parents
  *     will/may be changed.
  *-----------------------------------------------------------------------
  */
@@ -265,7 +265,7 @@
         * or non-existent.
         */
        oodate = (gn->mtime == 0 || Arch_LibOODate(gn) || 
-                 (gn->cmtime == 0 && (gn->type & OP_DOUBLEDEP)));
+                 (gn->cmgn == NULL && (gn->type & OP_DOUBLEDEP)));
     } else if (gn->type & OP_JOIN) {
        /*
         * A target with the .JOIN attribute is only considered
@@ -293,21 +293,22 @@
            }
        }
        oodate = TRUE;
-    } else if (gn->mtime < gn->cmtime ||
-              (gn->cmtime == 0 &&
+    } else if ((gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) ||
+              (gn->cmgn == NULL &&
                ((gn->mtime == 0 && !(gn->type & OP_OPTIONAL))
                  || gn->type & OP_DOUBLEDEP)))
     {
        /*
         * A node whose modification time is less than that of its
-        * youngest child or that has no children (cmtime == 0) and
+        * youngest child or that has no children (cmgn == NULL) and
         * either doesn't exist (mtime == 0) and it isn't optional
         * or was the object of a * :: operator is out-of-date.
         * Why? Because that's the way Make does it.
         */
        if (DEBUG(MAKE)) {
-           if (gn->mtime < gn->cmtime) {
-               fprintf(debug_file, "modified before source...");
+           if (gn->cmgn != NULL && gn->mtime < gn->cmgn->mtime) {
+               fprintf(debug_file, "modified before source %s...",
+                   gn->cmgn->path);
            } else if (gn->mtime == 0) {
                fprintf(debug_file, "non-existent and no sources...");
            } else {
@@ -395,7 +396,7 @@
  *     Always returns 0
  *
  * Side Effects:
- *     The path and mtime of the node and the cmtime of the parent are
+ *     The path and mtime of the node and the cmgn of the parent are
  *     updated; the unmade children count of the parent is decremented.
  *-----------------------------------------------------------------------
  */
@@ -663,12 +664,12 @@
  *     the toBeMade queue if this field becomes 0.
  *
  *     If the child was made, the parent's flag CHILDMADE field will be
- *     set true and its cmtime set to now.
+ *     set true.
  *
  *     If the child is not up-to-date and still does not exist,
  *     set the FORCE flag on the parents.
  *
- *     If the child wasn't made, the cmtime field of the parent will be
+ *     If the child wasn't made, the cmgn field of the parent will be
  *     altered if the child's mtime is big enough.
  *
  *     Finally, if the child is the implied source for the parent, the
diff -r 0fcf5d7ef743 -r beb8a31b9598 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Thu Nov 25 20:53:23 2010 +0000
+++ b/usr.bin/make/make.h       Thu Nov 25 21:31:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.83 2010/09/13 15:36:57 sjg Exp $    */
+/*     $NetBSD: make.h,v 1.84 2010/11/25 21:31:09 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -187,8 +187,7 @@
     int             unmade;            /* The number of unmade children */
 
     time_t          mtime;             /* Its modification time */
-    time_t                 cmtime;     /* The modification time of its youngest
-                                * child */
+    struct GNode    *cmgn;     /* The youngest child */
 
     Lst            iParents;   /* Links to parents for which this is an
                                 * implied source, if any */
diff -r 0fcf5d7ef743 -r beb8a31b9598 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Thu Nov 25 20:53:23 2010 +0000
+++ b/usr.bin/make/targ.c       Thu Nov 25 21:31:08 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.55 2009/01/23 21:26:30 dsl Exp $    */
+/*     $NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.55 2009/01/23 21:26:30 dsl Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos 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.55 2009/01/23 21:26:30 dsl Exp $");
+__RCSID("$NetBSD: targ.c,v 1.56 2010/11/25 21:31:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -248,8 +248,9 @@
     gn->centurion =            NULL;
     gn->made =                 UNMADE;
     gn->flags =        0;
-    gn->checked = 0;
-    gn->mtime = gn->cmtime = 0;
+    gn->checked =      0;
+    gn->mtime =                0;
+    gn->cmgn =         NULL;
     gn->iParents =     Lst_Init(FALSE);
     gn->cohorts =      Lst_Init(FALSE);
     gn->parents =      Lst_Init(FALSE);



Home | Main Index | Thread Index | Old Index