Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Revert all make changes except the unit tests t...



details:   https://anonhg.NetBSD.org/src/rev/893a51d75495
branches:  trunk
changeset: 802263:893a51d75495
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Sep 07 20:55:34 2014 +0000

description:
Revert all make changes except the unit tests to the state of three
weeks ago. Individual changes can be reapplied after review.

diffstat:

 usr.bin/make/compat.c            |    20 +-
 usr.bin/make/lst.h               |    21 +-
 usr.bin/make/lst.lib/lstInt.h    |     8 +-
 usr.bin/make/lst.lib/lstRemove.c |   146 +-
 usr.bin/make/main.c              |    44 +-
 usr.bin/make/make.c              |   104 +-
 usr.bin/make/make.h              |    44 +-
 usr.bin/make/nonints.h           |    10 +-
 usr.bin/make/parse.c             |   289 +--
 usr.bin/make/suff.c              |  3042 +++++++++++++++++--------------------
 usr.bin/make/targ.c              |    12 +-
 usr.bin/make/var.c               |    66 +-
 12 files changed, 1614 insertions(+), 2192 deletions(-)

diffs (truncated from 5153 to 300 lines):

diff -r 26a0dfa84c0f -r 893a51d75495 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sun Sep 07 20:17:57 2014 +0000
+++ b/usr.bin/make/compat.c     Sun Sep 07 20:55:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.95 2014/08/23 15:05:40 christos Exp $     */
+/*     $NetBSD: compat.c,v 1.96 2014/09/07 20:55:34 joerg 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.95 2014/08/23 15:05:40 christos Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.96 2014/09/07 20:55:34 joerg 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.95 2014/08/23 15:05:40 christos Exp $");
+__RCSID("$NetBSD: compat.c,v 1.96 2014/09/07 20:55:34 joerg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -531,7 +531,12 @@
            goto cohorts;
        }
 
-       Make_SetImpsrcLocalVar(gn, pgn);
+       if (Lst_Member(gn->iParents, pgn) != NULL) {
+           char *p1;
+           Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
+           if (p1)
+               free(p1);
+       }
 
        /*
         * All the children were made ok. Now cmgn->mtime contains the
@@ -630,7 +635,12 @@
         */
        pgn->flags &= ~REMAKE;
     } else {
-       Make_SetImpsrcLocalVar(gn, pgn);
+       if (Lst_Member(gn->iParents, pgn) != NULL) {
+           char *p1;
+           Var_Set(IMPSRC, Var_Value(TARGET, gn, &p1), pgn, 0);
+           if (p1)
+               free(p1);
+       }
        switch(gn->made) {
            case BEINGMADE:
                Error("Graph cycles through %s", gn->name);
diff -r 26a0dfa84c0f -r 893a51d75495 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h        Sun Sep 07 20:17:57 2014 +0000
+++ b/usr.bin/make/lst.h        Sun Sep 07 20:55:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lst.h,v 1.19 2014/08/23 15:05:40 christos Exp $        */
+/*     $NetBSD: lst.h,v 1.20 2014/09/07 20:55:34 joerg Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -94,7 +94,6 @@
 
 typedef void           *DuplicateProc(void *);
 typedef void           FreeProc(void *);
-typedef void           FreeProc2(void *, void *);
 
 #define LST_CONCNEW    0   /* create new LstNode's when using Lst_Concat */
 #define LST_CONCLINK   1   /* relink LstNode's when using Lst_Concat */
@@ -114,7 +113,6 @@
 /*
  * Functions to modify a list
  */
-/* NB!  SUCCESS is 0, FAILURE is 1! */
 /* Insert an element before another */
 ReturnStatus   Lst_InsertBefore(Lst, LstNode, void *);
 /* Insert an element after another */
@@ -125,10 +123,6 @@
 ReturnStatus   Lst_AtEnd(Lst, void *);
 /* Remove an element */
 ReturnStatus   Lst_Remove(Lst, LstNode);
-#if 0
-/* Remove multiple successive elements. */
-ReturnStatus   Lst_RemoveSlice(Lst, LstNode, LstNode, FreeProc2 *, void *);
-#endif
 /* Replace a node with a new value */
 ReturnStatus   Lst_Replace(LstNode, void *);
 /* Concatenate two lists */
@@ -151,10 +145,6 @@
 /*
  * Functions for entire lists
  */
-/*
- * NB!  The predicate function logic is inverted!  You have to return 0
- * if the item you're looking for has been found, and non-zero if it hasn't.
- */
 /* Find an element in a list */
 LstNode                Lst_Find(Lst, const void *, int (*)(const void *, const void *));
 /* Find an element starting from somewhere */
@@ -178,19 +168,12 @@
  * these functions are for dealing with a list as a table, of sorts.
  * An idea of the "current element" is kept and used by all the functions
  * between Lst_Open() and Lst_Close().
- * Usage:
- *     LstNode ln;
- *     Lst_Open(lst);
- *     while (ln = Lst_Next(lst) && !Lst_IsAtEnd(lst)) {
- *             ...
- *     }
- *     Lst_Close(lst);
  */
 /* Open the list */
 ReturnStatus   Lst_Open(Lst);
 /* Next element please */
 LstNode                Lst_Next(Lst);
-/* Done yet, i.e. is the result of the latest Lst_Next() a valid node? */
+/* Done yet? */
 Boolean                Lst_IsAtEnd(Lst);
 /* Finish table access */
 void           Lst_Close(Lst);
diff -r 26a0dfa84c0f -r 893a51d75495 usr.bin/make/lst.lib/lstInt.h
--- a/usr.bin/make/lst.lib/lstInt.h     Sun Sep 07 20:17:57 2014 +0000
+++ b/usr.bin/make/lst.lib/lstInt.h     Sun Sep 07 20:55:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lstInt.h,v 1.21 2014/08/23 15:05:40 christos Exp $     */
+/*     $NetBSD: lstInt.h,v 1.22 2014/09/07 20:55:34 joerg Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -59,11 +59,7 @@
 #define LN_DELETED     0x0001      /* List node should be removed when done */
 
 typedef enum {
-    Head,      /* list is just opened and its empty */
-    Middle,    /* not empty and not at end */
-    Tail,      /* end has been reached, the result of previous Lst_Next()
-                * is bogus */
-    Unknown    /* list is just opened and its not empty */
+    Head, Middle, Tail, Unknown
 } Where;
 
 typedef struct List {
diff -r 26a0dfa84c0f -r 893a51d75495 usr.bin/make/lst.lib/lstRemove.c
--- a/usr.bin/make/lst.lib/lstRemove.c  Sun Sep 07 20:17:57 2014 +0000
+++ b/usr.bin/make/lst.lib/lstRemove.c  Sun Sep 07 20:55:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lstRemove.c,v 1.15 2014/08/23 15:05:40 christos Exp $  */
+/*     $NetBSD: lstRemove.c,v 1.16 2014/09/07 20:55:34 joerg Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstRemove.c,v 1.15 2014/08/23 15:05:40 christos Exp $";
+static char rcsid[] = "$NetBSD: lstRemove.c,v 1.16 2014/09/07 20:55:34 joerg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)lstRemove.c        8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: lstRemove.c,v 1.15 2014/08/23 15:05:40 christos Exp $");
+__RCSID("$NetBSD: lstRemove.c,v 1.16 2014/09/07 20:55:34 joerg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -64,8 +64,6 @@
  *     The list's firstPtr will be set to NULL if ln is the last
  *     node on the list. firsPtr and lastPtr will be altered if ln is
  *     either the first or last node, respectively, on the list.
- *     If the list is open for sequential access and the removed node
- *     is the current one, the current node is reset to the previous one.
  *
  *-----------------------------------------------------------------------
  */
@@ -104,33 +102,23 @@
     /*
      * Sequential access stuff. If the node we're removing is the current
      * node in the list, reset the current node to the previous one. If the
-     * previous one is non-existent, the removed item is the first item of
-     * a non-circular list and we have to adjust atEnd while keeping in
-     * mind that it might have also been the only item.
+     * previous one was non-existent (prevPtr == NULL), we set the
+     * end to be Unknown, since it is.
      */
-    if (list->isOpen && list->curPtr == lNode) {
-       if (list->curPtr->prevPtr == NULL) {
-           if (list->curPtr->nextPtr == NULL)
-               list->atEnd = Head;     /* only item */
-           else
-               list->atEnd = Unknown;
+    if (list->isOpen && (list->curPtr == lNode)) {
+       list->curPtr = list->prevPtr;
+       if (list->curPtr == NULL) {
+           list->atEnd = Unknown;
        }
-
-       list->curPtr = list->curPtr->prevPtr;
     }
 
     /*
-     * The only way firstPtr can still point to ln is if ln was the last
-     * node of a circular list and thus lNode->nextptr == lNode.  Therefore,
-     * the list has now become empty and is marked as such.
+     * the only way firstPtr can still point to ln is if ln is the last
+     * node on the list (the list is circular, so lNode->nextptr == lNode in
+     * this case). The list is, therefore, empty and is marked as such
      */
     if (list->firstPtr == lNode) {
        list->firstPtr = NULL;
-       if (list->isOpen) {
-           /* stop sequential access too */
-           list->curPtr = NULL;
-           list->atEnd = Head;
-       }
     }
 
     /*
@@ -146,113 +134,3 @@
     return (SUCCESS);
 }
 
-#if 0
-/*
- * This was implemented, but turned out to be unnecessary.  Put it into
- * version control, remove later and leave a note, so the effort is not
- * wasted and it can be revived later if needed.
- */
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_RemoveSlice -- remove the given interval from the given list.
- *
- * Remove all items between s and e, inclusive.  If s == e, only one
- * item is removed.  freeProc is invoked on all removed items, if it is
- * provided.
- *
- * If the first item of the list falls into the removed range,
- * the start is moved to the first item after the removed range.
- * If the last item of the list or the current sequential access
- * position falls into the removed range, the it is moved to
- * the first item before the removed range.
- *
- * If the list becomes totally empty, the special locations are
- * also set properly.
- *
- * Pre-condition:
- *     In a non-circular list, the s must not be after e.
- *
- * Input:
- *     l       list to remove the items from
- *     s       first item to remove
- *     e       last item to remove
- *     freeProc        when non-NULL, invoked for each removed item as
- *                     (*freeProc)(Lst_Datum(item), data)
- *      data   extra parameters for freeProc
- *
- * Results:
- *      FAILURE if any parameter is invalid, SUCCESS otherwise.
- *-----------------------------------------------------------------------
- */
-ReturnStatus
-Lst_RemoveSlice(Lst l, LstNode s, LstNode e, FreeProc2 *freeProc, void *data)
-{
-    List       list;           /* list being processerd */
-    ListNode   end, start;     /* endpoints of range to remove */
-    ListNode   predecessor, successor; /* start->prevPtr and end->nextPtr */
-    ListNode   i, iNext;       /* iterators into the range */
-
-    /* flags to recognize when special nodes are removed */
-    Boolean    firstRemoved, lastRemoved, curRemoved;
-
-    if (!LstValid (l) || !LstNodeValid (s, l) || !LstNodeValid(e, l))
-       return FAILURE;
-
-    list = l;
-    start = s;
-    end = e;
-    predecessor = start->prevPtr;
-    successor = end->nextPtr;
-
-    /* Remove the slice from the list. */
-    if (predecessor != NULL)
-       predecessor->nextPtr = successor;
-    if (successor != NULL)
-       successor->prevPtr = predecessor;
-
-    /*
-     * Destroy the removed items.  While removing items, take
-     * note if any of the special nodes get removed so we can fix
-     * the situation afterwards.
-     */
-    iNext = start;
-    do {
-       i = iNext;
-



Home | Main Index | Thread Index | Old Index