diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2019-12-21 15:29:26 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2019-12-21 15:29:26 +0000 |
commit | abb2a23d8241d0bc2815f2b2f1edd4bb3377658f (patch) | |
tree | 24c8e70140e00a779d17561ac6f3adac456d6569 /usr.bin/make | |
parent | 28106492f2092147316cd16dbdd1226c626b5a94 (diff) |
rename a few variable/functions to have better names.
adjust comments to be more meaningful
reorder predecessors/successors fields in an order that
makes more sense to me.
okay millert@
Diffstat (limited to 'usr.bin/make')
-rw-r--r-- | usr.bin/make/arch.c | 4 | ||||
-rw-r--r-- | usr.bin/make/compat.c | 22 | ||||
-rw-r--r-- | usr.bin/make/cond.c | 6 | ||||
-rw-r--r-- | usr.bin/make/dump.c | 4 | ||||
-rw-r--r-- | usr.bin/make/engine.c | 17 | ||||
-rw-r--r-- | usr.bin/make/engine.h | 6 | ||||
-rw-r--r-- | usr.bin/make/gnode.h | 72 | ||||
-rw-r--r-- | usr.bin/make/make.c | 87 | ||||
-rw-r--r-- | usr.bin/make/parse.c | 15 | ||||
-rw-r--r-- | usr.bin/make/suff.c | 18 | ||||
-rw-r--r-- | usr.bin/make/targ.c | 8 | ||||
-rw-r--r-- | usr.bin/make/targequiv.c | 4 |
12 files changed, 128 insertions, 135 deletions
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index 990ef352d24..b87bd7394c7 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.89 2017/07/24 12:07:46 espie Exp $ */ +/* $OpenBSD: arch.c,v 1.90 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -883,7 +883,7 @@ Arch_MemMTime(GNode *gn) if (pgn->type & OP_ARCHV) { /* If the parent is an archive specification and is - * being made and its member's name matches the name of + * being built and its member's name matches the name of * the node we were given, record the modification time * of the parent in the child. We keep searching its * parents in case some other parent requires this diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index 3f85adc1d14..389dd064050 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat.c,v 1.87 2019/12/21 15:28:16 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.88 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -112,7 +112,7 @@ CompatMake(void *gnp, /* The node to make */ switch(gn->built_status) { case UNKNOWN: - /* First mark ourselves to be made, then apply whatever + /* First mark ourselves to be built, then apply whatever * transformations the suffix module thinks are necessary. * Once that's done, we can descend and make all our children. * If any of them has an error but the -k flag was given, @@ -139,7 +139,7 @@ CompatMake(void *gnp, /* The node to make */ return; } - /* All the children were made ok. Now youngest points to + /* All the children built ok. Now youngest points to * 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. */ @@ -163,7 +163,7 @@ CompatMake(void *gnp, /* The node to make */ */ sib = gn; do { - /* We need to be re-made. We also have to make sure + /* We need to be rebuilt. We also have to make sure * we've got a $? variable. To be nice, we also define * the $> variable using Make_DoAllVar(). */ @@ -194,7 +194,7 @@ CompatMake(void *gnp, /* The node to make */ gn->built_status = sib->built_status; if (gn->built_status != ERROR) { - /* If the node was made successfully, mark it so, + /* If the node was built successfully, mark it so, * update its modification time and timestamp all * its parents. * This is to keep its state from affecting that of @@ -231,7 +231,7 @@ CompatMake(void *gnp, /* The node to make */ printf("update time: %s\n", time_to_string(&gn->mtime)); if (!(gn->type & OP_EXEC)) { - pgn->childMade = true; + pgn->child_rebuilt = true; Make_TimeStamp(pgn, gn); } } else if (keepgoing) @@ -253,7 +253,7 @@ CompatMake(void *gnp, /* The node to make */ break; case REBUILT: if ((gn->type & OP_EXEC) == 0) { - pgn->childMade = true; + pgn->child_rebuilt = true; Make_TimeStamp(pgn, gn); } break; @@ -270,7 +270,7 @@ void Compat_Run(Lst targs) /* List of target nodes to re-create */ { GNode *gn = NULL; /* Current root target */ - int errors; /* Number of targets not remade due to errors */ + int errors; /* Number of targets not built due to errors */ /* For each entry in the list of targets to create, call CompatMake on * it to create the thing. CompatMake will leave the 'built_status' @@ -279,9 +279,9 @@ Compat_Run(Lst targs) /* List of target nodes to re-create */ * REBUILT gn was recreated successfully * ERROR An error occurred while gn was being * created - * ABORTED gn was not remade because one of its - * inferiors could not be made due to errors. - */ + * ABORTED gn was not built because one of its + * dependencies could not be built due + * to errors. */ errors = 0; while ((gn = Lst_DeQueue(targs)) != NULL) { CompatMake(gn, NULL); diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index d80ad0efe02..a78e839521f 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cond.c,v 1.53 2017/12/19 20:44:53 zhuk Exp $ */ +/* $OpenBSD: cond.c,v 1.54 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */ /* @@ -260,7 +260,9 @@ CondDoDefined(struct Name *arg) * Handle the 'make' function for conditionals. * * Results: - * true if the given target is being made. + * true if the given target is currently being built, + * either explicitly on the command line, or implicitly as the + * default target. *----------------------------------------------------------------------- */ static bool diff --git a/usr.bin/make/dump.c b/usr.bin/make/dump.c index 82779cedec8..51dc883b45a 100644 --- a/usr.bin/make/dump.c +++ b/usr.bin/make/dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.c,v 1.9 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: dump.c,v 1.10 2019/12/21 15:29:25 espie Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -116,7 +116,7 @@ TargPrintNode(GNode *gn, bool full) break; } if (full) { - printf("# %d unmade prerequisites\n", gn->unmade); + printf("# %d unmade prerequisites\n", gn->children_left); if (! (gn->type & (OP_JOIN|OP_USE|OP_EXEC))) { if (!is_out_of_date(gn->mtime)) { printf("# last modified %s: %s\n", diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c index 3c240d41f7e..cb75f1e1e4f 100644 --- a/usr.bin/make/engine.c +++ b/usr.bin/make/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.57 2019/12/21 15:28:16 espie Exp $ */ +/* $OpenBSD: engine.c,v 1.58 2019/12/21 15:29:25 espie Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -289,7 +289,6 @@ Make_HandleUse(GNode *cgn, /* The .USE node */ GNode *gn; /* A child of the .USE node */ LstNode ln; /* An element in the children list */ - assert(cgn->type & (OP_USE|OP_TRANSFORM)); if (pgn == NULL) @@ -308,7 +307,7 @@ Make_HandleUse(GNode *cgn, /* The .USE node */ if (Lst_AddNew(&pgn->children, gn)) { Lst_AtEnd(&gn->parents, pgn); - pgn->unmade++; + pgn->children_left++; } } @@ -320,14 +319,14 @@ Make_HandleUse(GNode *cgn, /* The .USE node */ pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_TRANSFORM|OP_DOUBLE); /* - * This child node is now "made", so we decrement the count of - * unmade children in the parent... We also remove the child + * This child node is now built, so we decrement the count of + * not yet built 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 + * remaining 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) - pgn->unmade--; + pgn->children_left--; } void @@ -447,7 +446,7 @@ Make_OODate(GNode *gn) } /* - * A target is remade in one of the following circumstances: + * A target is rebuilt in one of the following circumstances: * - its modification time is smaller than that of its youngest child * and it would actually be run (has commands or type OP_NOP) * - it's the object of a force operator @@ -470,7 +469,7 @@ Make_OODate(GNode *gn) */ if (DEBUG(MAKE)) printf(".JOIN node..."); - oodate = gn->childMade; + oodate = gn->child_rebuilt; } else if (gn->type & (OP_FORCE|OP_EXEC|OP_PHONY)) { /* * A node which is the object of the force (!) operator or which diff --git a/usr.bin/make/engine.h b/usr.bin/make/engine.h index a72d3665948..69572b09391 100644 --- a/usr.bin/make/engine.h +++ b/usr.bin/make/engine.h @@ -1,6 +1,6 @@ #ifndef ENGINE_H #define ENGINE_H -/* $OpenBSD: engine.h,v 1.13 2012/12/07 15:08:03 espie Exp $ */ +/* $OpenBSD: engine.h,v 1.14 2019/12/21 15:29:25 espie Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -86,7 +86,7 @@ extern int run_gnode(GNode *); * * Each job has several things associated with it: * 1) The process id of the child shell - * 2) The graph node describing the target being made by this job + * 2) The graph node describing the target of this job * 3) State associated to latest command run * 5) A word of flags which determine how the module handles errors, * echoing, etc. for the job @@ -96,7 +96,7 @@ extern int run_gnode(GNode *); * exceed the value of 'maxJobs', initialized by the Job_Init function. * * When a job is finished, the Make_Update function is called on each of the - * parents of the node which was just remade. This takes care of the upward + * parents of the node which was just rebuilt. This takes care of the upward * traversal of the dependency graph. */ struct Job_ { diff --git a/usr.bin/make/gnode.h b/usr.bin/make/gnode.h index d2cdcd5d27a..8029ad74f5b 100644 --- a/usr.bin/make/gnode.h +++ b/usr.bin/make/gnode.h @@ -1,6 +1,6 @@ #ifndef GNODE_H #define GNODE_H -/* $OpenBSD: gnode.h,v 1.30 2019/12/21 15:28:17 espie Exp $ */ +/* $OpenBSD: gnode.h,v 1.31 2019/12/21 15:29:25 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -44,11 +44,11 @@ * pieces of data associated with it. * 1) the name of the target it describes * 2) the location of the target file in the file system. - * 3) the type of operator used to define its sources (qv. parse.c) + * 3) the type of operator used to define its sources (cf parse.c) * 4) whether it is involved in this invocation of make - * 5) whether the target has been remade - * 6) whether any of its children has been remade - * 7) the number of its children that are, as yet, unmade + * 5) whether the target has been rebuilt + * 6) whether any of its children has been rebuilt + * 7) the number of its children that are, as yet, not built * 8) its modification time * 9) the modification time of its youngest child (qv. make.c) * 10) a list of nodes for which this is a source @@ -56,27 +56,16 @@ * 12) a list of nodes that depend on this, as gleaned from the * transformation rules. * 13) a list of nodes of the same name created by the :: operator - * 14) a list of nodes that must be made (if they're made) before - * this node can be, but that do no enter into the datedness of - * this node. - * 15) a list of nodes that must be made (if they're made) after - * this node is, but that do not depend on this node, in the - * normal sense. + * 14) a list of predecessors nodes, result of .ORDER: + * if considered for building, they should be built before this node. + * 15) a list of successors nodes, result of .ORDER: + * if considered for building, they should be built after this node. * 16) a Lst of ``local'' variables that are specific to this target * and this target only (qv. var.c [$@ $< $?, etc.]) * 17) a Lst of strings that are commands to be given to a shell * to create this target. */ -#define UNKNOWN 0 -#define BUILDING 1 -#define REBUILT 2 -#define UPTODATE 3 -#define ERROR 4 -#define ABORTED 5 -#define NOSUCHNODE 6 -#define HELDBACK 7 - #define SPECIAL_NONE 0U #define SPECIAL_PATH 21U #define SPECIAL_MASK 63U @@ -111,37 +100,40 @@ struct GNode_ { unsigned int special_op; /* special op to apply */ - unsigned char special;/* type of special node */ - char must_make; /* true if this target needs to be remade */ - char childMade; /* true if one of this target's children was - * made */ - char built_status; /* Set to reflect the state of processing - * on this node: - * UNKNOWN - Not examined yet - * BUILDING - Target is currently being made. - * REBUILT - Was out-of-date and has been made - * UPTODATE - Was already up-to-date - * ERROR - An error occurred while it was being - * made (used only in compat mode) - * ABORTED - The target was aborted due to - * an error making an inferior. - */ + unsigned char special; /* type of special node */ + char must_make; /* true if this target needs building */ + char child_rebuilt; /* true if at least one child was rebuilt, + * thus triggering timestamps changes */ + + char built_status; +#define UNKNOWN 0 /* Not examined yet */ +#define BUILDING 1 /* In the process of building */ +#define REBUILT 2 /* Was out of date and got rebuilt */ +#define UPTODATE 3 /* Was already up-to-date */ +#define ERROR 4 /* Error occurred while building + * (used only in compat mode) */ +#define ABORTED 5 /* Was aborted due to an error + * making an inferior */ +#define NOSUCHNODE 6 /* error from run_gnode */ +#define HELDBACK 7 /* Another target in the same group is + * currently building, avoid race conditions */ + char *path; /* The full pathname of the file */ unsigned int type; /* Its type (see the OP flags, below) */ int order; /* Its wait weight */ - int unmade; /* The number of unmade children */ + int children_left; /* The number of children left to build */ int in_cycle; /* cycle detection */ - struct timespec mtime; /* Its modification time */ - GNode *youngest; /* Its youngest child */ + struct timespec mtime; /* Node's modification time */ + GNode *youngest; /* Node's youngest child */ GNode *impliedsrc; LIST cohorts; /* Other nodes for the :: operator */ LIST parents; /* Nodes that depend on this one */ LIST children; /* Nodes on which this one depends */ - LIST successors; /* Nodes that must be made after this one */ - LIST preds; /* Nodes that must be made before this one */ + LIST predecessors; + LIST successors; SymTable context; /* The local variables */ LIST commands; /* Creation commands */ diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index ab3ac30e96e..fa3de49e062 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make.c,v 1.74 2019/12/21 15:28:17 espie Exp $ */ +/* $OpenBSD: make.c,v 1.75 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -51,7 +51,7 @@ * various bookkeeping chores like finding the * youngest child of the parent, filling * the IMPSRC context variable, etc. It will - * place the parent on the toBeMade queue if it + * place the parent on the to_build queue if it * should be. * */ @@ -89,7 +89,7 @@ static struct growableArray examine; /* The current fringe of the graph. These are nodes which await examination by * MakeOODate. It is added to by Make_Update and subtracted from by * MakeStartJobs */ -static struct growableArray toBeMade; +static struct growableArray to_build; /* Hold back on nodes where equivalent stuff is already building... */ static struct growableArray heldBack; @@ -110,7 +110,7 @@ static GNode *find_cycle(Lst, struct growableArray *); static bool try_to_make_node(GNode *); static void add_targets_to_make(Lst); -static bool has_unmade_predecessor(GNode *); +static bool has_predecessor_left_to_build(GNode *); static void requeue_successors(GNode *); static void random_setup(void); @@ -120,7 +120,7 @@ long random_delay = 0; bool no_jobs_left() { - return Array_IsEmpty(&toBeMade); + return Array_IsEmpty(&to_build); } static void @@ -157,15 +157,15 @@ randomize_garray(struct growableArray *g) } static bool -has_unmade_predecessor(GNode *gn) +has_predecessor_left_to_build(GNode *gn) { LstNode ln; - if (Lst_IsEmpty(&gn->preds)) + if (Lst_IsEmpty(&gn->predecessors)) return false; - for (ln = Lst_First(&gn->preds); ln != NULL; ln = Lst_Adv(ln)) { + for (ln = Lst_First(&gn->predecessors); ln != NULL; ln = Lst_Adv(ln)) { GNode *pgn = Lst_Datum(ln); if (pgn->must_make && pgn->built_status == UNKNOWN) { @@ -183,15 +183,15 @@ requeue_successors(GNode *gn) { LstNode ln; /* Deal with successor nodes. If any is marked for making and has an - * unmade count of 0, has not been made and isn't in the examination - * queue, it means we need to place it in the queue as it restrained - * itself before. */ + * children_left count of 0, has not been made and isn't in the + * examination queue, it means we need to place it in the queue as + * it restrained itself before. */ for (ln = Lst_First(&gn->successors); ln != NULL; ln = Lst_Adv(ln)) { GNode *succ = Lst_Datum(ln); - if (succ->must_make && succ->unmade == 0 + if (succ->must_make && succ->children_left == 0 && succ->built_status == UNKNOWN) - Array_PushNew(&toBeMade, succ); + Array_PushNew(&to_build, succ); } } @@ -208,7 +208,7 @@ requeue(GNode *gn) if (DEBUG(HELDJOBS)) printf("%s finished, releasing: %s\n", gn->name, heldBack.a[i]->name); - Array_Push(&toBeMade, heldBack.a[i]); + Array_Push(&to_build, heldBack.a[i]); continue; } heldBack.a[j] = heldBack.a[i]; @@ -227,10 +227,10 @@ requeue(GNode *gn) * Always returns 0 * * Side Effects: - * The unmade field of pgn is decremented and pgn may be placed on - * the toBeMade queue if this field becomes 0. + * The children_left field of pgn is decremented and pgn may be placed on + * the to_build queue if this field becomes 0. * - * If the child was made, the parent's childMade field will be set to + * If the child got built, the parent's child_rebuilt field will be set to * true *----------------------------------------------------------------------- */ @@ -272,27 +272,27 @@ Make_Update(GNode *cgn) /* the child node */ for (ln = Lst_First(&cgn->parents); ln != NULL; ln = Lst_Adv(ln)) { pgn = Lst_Datum(ln); /* SIB: there should be a siblings loop there */ - pgn->unmade--; + pgn->children_left--; if (pgn->must_make) { if (DEBUG(MAKE)) printf("%s--=%d ", - pgn->name, pgn->unmade); + pgn->name, pgn->children_left); if ( ! (cgn->type & (OP_EXEC|OP_USE))) { if (cgn->built_status == REBUILT) - pgn->childMade = true; + pgn->child_rebuilt = true; (void)Make_TimeStamp(pgn, cgn); } - if (pgn->unmade == 0) { + if (pgn->children_left == 0) { /* - * Queue the node up -- any unmade + * Queue the node up -- any yet-to-build * predecessors will be dealt with in * MakeStartJobs. */ if (DEBUG(MAKE)) printf("QUEUING "); - Array_Push(&toBeMade, pgn); - } else if (pgn->unmade < 0) { + Array_Push(&to_build, pgn); + } else if (pgn->children_left < 0) { Error("Child %s discovered graph cycles through %s", cgn->name, pgn->name); } } @@ -314,11 +314,11 @@ try_to_make_node(GNode *gn) return false; } - if (gn->unmade != 0) { + if (gn->children_left != 0) { if (DEBUG(MAKE)) - printf(" Requeuing (%d)\n", gn->unmade); + printf(" Requeuing (%d)\n", gn->children_left); add_targets_to_make(&gn->children); - Array_Push(&toBeMade, gn); + Array_Push(&to_build, gn); return false; } if (has_been_built(gn)) { @@ -326,16 +326,17 @@ try_to_make_node(GNode *gn) printf(" already made\n"); return false; } - if (has_unmade_predecessor(gn)) { + if (has_predecessor_left_to_build(gn)) { if (DEBUG(MAKE)) printf(" Dropping for now\n"); return false; } /* SIB: this is where there should be a siblings loop */ - if (gn->unmade != 0) { + if (gn->children_left != 0) { if (DEBUG(MAKE)) - printf(" Requeuing (after deps: %d)\n", gn->unmade); + printf(" Requeuing (after deps: %d)\n", + gn->children_left); add_targets_to_make(&gn->children); return false; } @@ -407,7 +408,7 @@ try_to_make_node(GNode *gn) * returns true. At all other times, this function returns false. * * Side Effects: - * Nodes are removed from the toBeMade queue and job table slots + * Nodes are removed from the to_build queue and job table slots * are filled. *----------------------------------------------------------------------- */ @@ -416,7 +417,7 @@ MakeStartJobs(void) { GNode *gn; - while (can_start_job() && (gn = Array_Pop(&toBeMade)) != NULL) { + while (can_start_job() && (gn = Array_Pop(&to_build)) != NULL) { if (try_to_make_node(gn)) return true; } @@ -429,7 +430,7 @@ MakePrintStatus(void *gnp) GNode *gn = gnp; if (gn->built_status == UPTODATE) { printf("`%s' is up to date.\n", gn->name); - } else if (gn->unmade != 0) { + } else if (gn->children_left != 0) { printf("`%s' not remade because of errors.\n", gn->name); } } @@ -454,7 +455,7 @@ MakeHandleUse(void *cgnp, void *pgnp) Make_HandleUse(cgn, pgn); } -/* Add stuff to the toBeMade queue. we try to sort things so that stuff +/* Add stuff to the to_build queue. we try to sort things so that stuff * that can be done directly is done right away. This won't be perfect, * since some dependencies are only discovered later (e.g., SuffFindDeps). */ @@ -488,20 +489,20 @@ add_targets_to_make(Lst todo) Suff_FindDeps(gn); expand_all_children(gn); - if (gn->unmade != 0) { + if (gn->children_left != 0) { if (DEBUG(MAKE)) - printf("%s: not queuing (%d unmade children)\n", - gn->name, gn->unmade); + printf("%s: not queuing (%d children left to build)\n", + gn->name, gn->children_left); Lst_ForEach(&gn->children, MakeAddChild, &examine); } else { if (DEBUG(MAKE)) printf("%s: queuing\n", gn->name); - Array_Push(&toBeMade, gn); + Array_Push(&to_build, gn); } } if (randomize_queue) - randomize_garray(&toBeMade); + randomize_garray(&to_build); } /*- @@ -510,7 +511,7 @@ add_targets_to_make(Lst todo) * Initialize the nodes to remake and the list of nodes which are * ready to be made by doing a breadth-first traversal of the graph * starting from the nodes in the given list. Once this traversal - * is finished, all the 'leaves' of the graph are in the toBeMade + * is finished, all the 'leaves' of the graph are in the to_build * queue. * Using this queue and the Job module, work back up the graph, * calling on MakeStartJobs to keep the job table as full as @@ -521,7 +522,7 @@ add_targets_to_make(Lst todo) * * Side Effects: * The must_make field of all nodes involved in the creation of the given - * targets is set to 1. The toBeMade list is set to contain all the + * targets is set to 1. The to_build list is set to contain all the * 'leaves' of these subgraphs. *----------------------------------------------------------------------- */ @@ -531,7 +532,7 @@ Make_Run(Lst targs) /* the initial list of targets */ bool problem; /* errors occurred */ /* wild guess at initial sizes */ - Array_Init(&toBeMade, 500); + Array_Init(&to_build, 500); Array_Init(&examine, 150); Array_Init(&heldBack, 100); ohash_init(&targets, 10, &gnode_info); @@ -683,7 +684,7 @@ find_cycle(Lst l, struct growableArray *cycle) if (gn->built_status == UPTODATE) continue; - if (gn->unmade != 0) { + if (gn->children_left != 0) { GNode *c; gn->in_cycle = true; diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index aba0d2e64c6..287cf6bae20 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.121 2018/09/20 11:41:28 jsg Exp $ */ +/* $OpenBSD: parse.c,v 1.122 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -240,7 +240,7 @@ create_special_nodes() * * Side Effects: * New elements are added to the parents list of cgn and the - * children list of cgn. the unmade field of pgn is updated + * children list of cgn. the children_left field of pgn is updated * to reflect the additional child. *--------------------------------------------------------------------- */ @@ -250,7 +250,7 @@ ParseLinkSrc(GNode *pgn, GNode *cgn) if (Lst_AddNew(&pgn->children, cgn)) { if (specType == SPECIAL_NONE) Lst_AtEnd(&cgn->parents, pgn); - pgn->unmade++; + pgn->children_left++; } } @@ -361,11 +361,10 @@ static int ParseAddDep(GNode *p, GNode *s) { if (p->order < s->order) { - /* XXX: This can cause loops, and loops can cause unmade - * targets, but checking is tedious, and the debugging output - * can show the problem. */ + /* XXX: This can cause cycles but finding them is hard + * and debugging output will show the problem. */ + Lst_AtEnd(&s->predecessors, p); Lst_AtEnd(&p->successors, s); - Lst_AtEnd(&s->preds, p); return 1; } else return 0; @@ -438,7 +437,7 @@ ParseDoSrc( */ if (predecessor != NULL) { Lst_AtEnd(&predecessor->successors, gn); - Lst_AtEnd(&gn->preds, predecessor); + Lst_AtEnd(&gn->predecessors, predecessor); } predecessor = gn; break; diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 0d5378c27da..cce46f2461a 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.96 2019/12/21 15:28:17 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.97 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -917,10 +917,10 @@ SuffLinkParent(GNode *cgn, GNode *pgn) { Lst_AtEnd(&cgn->parents, pgn); if (!has_been_built(cgn)) - pgn->unmade++; + pgn->children_left++; else if ( ! (cgn->type & (OP_EXEC|OP_USE))) { if (cgn->built_status == REBUILT) - pgn->childMade = true; + pgn->child_rebuilt = true; (void)Make_TimeStamp(pgn, cgn); } } @@ -1050,7 +1050,7 @@ SuffExpandWildChildren(LstNode after, GNode *cgn, GNode *pgn) gn = Targ_FindNode(cp, TARG_CREATE); /* If gn isn't already a child of the parent, make it so and - * up the parent's count of unmade children. */ + * up the parent's count of children to build. */ if (Lst_Member(&pgn->children, gn) == NULL) { Lst_Append(&pgn->children, after, gn); after = Lst_Adv(after); @@ -1070,8 +1070,8 @@ SuffExpandWildChildren(LstNode after, GNode *cgn, GNode *pgn) * * Side Effects: * The expanded node is removed from the parent's list of children, - * and the parent's unmade counter is decremented, but other nodes - * may be added. + * and the parent's children to build counter is decremented, + * but other nodes may be added. *----------------------------------------------------------------------- */ static void @@ -1094,7 +1094,7 @@ SuffExpandChildren(LstNode ln, /* LstNode of child, so we can replace it */ /* Since the source was expanded, remove it from the list of children to * keep it from being processed. */ - pgn->unmade--; + pgn->children_left--; Lst_Remove(&pgn->children, ln); } @@ -1559,8 +1559,8 @@ sfnd_abort: * each target are set from the commands of the transformation rule * used to get from the src suffix to the targ suffix. Note that this * causes the commands list of the original node, gn, to be replaced by - * the commands of the final transformation rule. Also, the unmade - * field of gn is incremented. Etc. */ + * the commands of the final transformation rule. Also, the children + * to build field of gn is incremented. Etc. */ if (bottom->node == NULL) { bottom->node = Targ_FindNode(bottom->file, TARG_CREATE); } diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 7d5b634d499..1cbeb86669d 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.79 2019/12/21 15:28:17 espie Exp $ */ +/* $OpenBSD: targ.c,v 1.80 2019/12/21 15:29:25 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -152,19 +152,19 @@ Targ_NewGNi(const char *name, const char *ename) gn->path = NULL; gn->type = 0; gn->special = SPECIAL_NONE; - gn->unmade = 0; + gn->children_left = 0; gn->must_make = false; gn->built_status = UNKNOWN; gn->in_cycle = false; - gn->childMade = false; + gn->child_rebuilt = false; gn->order = 0; ts_set_out_of_date(gn->mtime); gn->youngest = gn; Lst_Init(&gn->cohorts); Lst_Init(&gn->parents); Lst_Init(&gn->children); + Lst_Init(&gn->predecessors); Lst_Init(&gn->successors); - Lst_Init(&gn->preds); SymTable_Init(&gn->context); gn->impliedsrc = NULL; Lst_Init(&gn->commands); diff --git a/usr.bin/make/targequiv.c b/usr.bin/make/targequiv.c index 2aa22e04d21..b251c775d79 100644 --- a/usr.bin/make/targequiv.c +++ b/usr.bin/make/targequiv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targequiv.c,v 1.8 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: targequiv.c,v 1.9 2019/12/21 15:29:25 espie Exp $ */ /* * Copyright (c) 2007-2008 Marc Espie. * @@ -169,7 +169,7 @@ kludge_look_harder_for_target(GNode *gn) if (Lst_AddNew(&gn->children, cgn)) { Lst_AtEnd(&cgn->parents, gn); - gn->unmade++; + gn->children_left++; } } } |