Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): clean up headers, no functional change



details:   https://anonhg.NetBSD.org/src/rev/4909f4d4ff14
branches:  trunk
changeset: 1015322:4909f4d4ff14
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 19 23:43:55 2020 +0000

description:
make(1): clean up headers, no functional change

diffstat:

 usr.bin/make/config.h      |   4 +++-
 usr.bin/make/dir.h         |   5 +++--
 usr.bin/make/job.c         |  12 ++++++------
 usr.bin/make/make.c        |   8 ++++----
 usr.bin/make/make.h        |  45 ++++++++++++++++++++++++++-------------------
 usr.bin/make/make_malloc.h |  14 +++++++-------
 usr.bin/make/meta.h        |   7 ++++---
 usr.bin/make/nonints.h     |   6 ++++--
 usr.bin/make/targ.c        |   6 +++---
 9 files changed, 60 insertions(+), 47 deletions(-)

diffs (truncated from 352 to 300 lines):

diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/config.h
--- a/usr.bin/make/config.h     Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/config.h     Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config.h,v 1.24 2020/10/18 08:01:23 rillig Exp $       */
+/*     $NetBSD: config.h,v 1.25 2020/10/19 23:43:55 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -133,8 +133,10 @@
 /*
  * SYSVINCLUDE
  *     Recognize system V like include directives [include "filename"]
+ *     (required by POSIX 2018)
  * SYSVVARSUB
  *     Recognize system V like ${VAR:x=y} variable substitutions
+ *     (required by POSIX 2018)
  */
 #define SYSVINCLUDE
 #define SYSVVARSUB
diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/dir.h
--- a/usr.bin/make/dir.h        Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/dir.h        Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.h,v 1.30 2020/10/18 12:36:43 rillig Exp $  */
+/*     $NetBSD: dir.h,v 1.31 2020/10/19 23:43:55 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -87,7 +87,8 @@
     int refCount;              /* Number of SearchPaths with this directory */
     int hits;                  /* The number of times a file in this
                                 * directory has been found */
-    HashTable files;           /* Hash set of files in directory */
+    HashTable files;           /* Hash set of files in directory;
+                                * all values are NULL. */
 } CachedDir;
 
 void Dir_Init(void);
diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/job.c        Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.266 2020/10/19 23:07:22 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.267 2020/10/19 23:43:55 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.266 2020/10/19 23:07:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.267 2020/10/19 23:43:55 rillig Exp $");
 
 # define STATIC static
 
@@ -190,10 +190,10 @@
     const char *noPrint;       /* command to skip when printing output from
                                 * shell. This is usually the command which
                                 * was executed to turn off echoing */
-    size_t noPLen;             /* length of noPrint command */
+    size_t noPrintLen;         /* length of noPrint command */
     Boolean hasErrCtl;         /* set if can control error checking for
                                 * individual commands */
-    const char *errCheck;      /* string to turn error checking on */
+    const char *errCheck;      /* string to turn on error checking */
     const char *ignErr;                /* string to turn off error checking */
     const char *errOut;                /* string to use for testing exit code */
     const char *newline;       /* string literal that results in a newline
@@ -1627,7 +1627,7 @@
                (void)fprintf(stdout, "%s", cp);
                (void)fflush(stdout);
            }
-           cp = ecp + commandShell->noPLen;
+           cp = ecp + commandShell->noPrintLen;
            if (cp != endp) {
                /*
                 * Still more to print, look again after skipping
@@ -2273,7 +2273,7 @@
                newShell.echoOn = arg + 5;
            } else if (strncmp(arg, "filter=", 7) == 0) {
                newShell.noPrint = arg + 7;
-               newShell.noPLen = strlen(newShell.noPrint);
+               newShell.noPrintLen = strlen(newShell.noPrint);
            } else if (strncmp(arg, "echoFlag=", 9) == 0) {
                newShell.echo = arg + 9;
            } else if (strncmp(arg, "errFlag=", 8) == 0) {
diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/make.c       Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.165 2020/10/19 21:57:37 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.166 2020/10/19 23:43:55 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include    "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.165 2020/10/19 21:57:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.166 2020/10/19 23:43:55 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -947,13 +947,13 @@
            make_abort(gn, __LINE__);
        }
 
-       if (gn->checked == checked) {
+       if (gn->checked_seqno == checked) {
            /* We've already looked at this node since a job finished... */
            DEBUG2(MAKE, "already checked %s%s\n", gn->name, gn->cohort_num);
            gn->made = DEFERRED;
            continue;
        }
-       gn->checked = checked;
+       gn->checked_seqno = checked;
 
        if (gn->unmade != 0) {
            /*
diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/make.h       Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.159 2020/10/18 17:19:54 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.160 2020/10/19 23:43:55 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -202,7 +202,7 @@
     /* Target is never out of date, but always execute commands anyway.
      * Its time doesn't matter, so it has none...sort of */
     OP_EXEC            = 1 << 5,
-    /* Ignore errors when creating the node */
+    /* Ignore non-zero exit status from shell commands when creating the node */
     OP_IGNORE          = 1 << 6,
     /* Don't remove the target when interrupted */
     OP_PRECIOUS                = 1 << 7,
@@ -245,12 +245,15 @@
     OP_TRANSFORM       = 1 << 31,
     /* Target is a member of an archive */
     OP_MEMBER          = 1 << 30,
-    /* Target is a library */
+    /* Target is a library;
+     * the node's name has the form "-l<libname>" */
     OP_LIB             = 1 << 29,
-    /* Target is an archive construct */
+    /* Target is an archive construct;
+     * the node's name has the form "archive(member)" */
     OP_ARCHV           = 1 << 28,
     /* Target has all the commands it should. Used when parsing to catch
-     * multiple commands for a target. */
+     * multiple command groups for a target.  Only applies to the dependency
+     * operators ':' and '!', but not to '::'. */
     OP_HAS_COMMANDS    = 1 << 27,
     /* The special command "..." has been seen. All further commands from
      * this node will be saved on the .END node instead, to be executed at
@@ -299,14 +302,15 @@
     /* The type of operator used to define the sources (see the OP flags below).
      * XXX: This looks like a wild mixture of type and flags. */
     GNodeType type;
-    /* whether it is involved in this invocation of make */
     GNodeFlags flags;
 
     /* The state of processing on this node */
     GNodeMade made;
     int unmade;                        /* The number of unmade children */
 
-    time_t mtime;              /* Its modification time */
+    /* The modification time; 0 means the node does not have a corresponding
+     * file; see Make_OODate. */
+    time_t mtime;
     struct GNode *cmgn;                /* The youngest child */
 
     /* The GNodes for which this node is an implied source. May be empty.
@@ -314,7 +318,7 @@
      * file.c has the node for file.o in this list. */
     GNodeList *implicitParents;
 
-    /* Other nodes of the same name for the :: operator. */
+    /* Other nodes of the same name, for the '::' operator. */
     GNodeList *cohorts;
 
     /* The nodes that depend on this one, or in other words, the nodes for
@@ -341,10 +345,13 @@
     struct GNode *centurion;
 
     /* Last time (sequence number) we tried to make this node */
-    unsigned int checked;
+    unsigned int checked_seqno;
 
     /* The "local" variables that are specific to this target and this target
-     * only, such as $@, $<, $?. */
+     * only, such as $@, $<, $?.
+     *
+     * Also used for the global variable scopes VAR_GLOBAL, VAR_CMD,
+     * VAR_INTERNAL, which contain variables with arbitrary names. */
     HashTable context;
 
     /* The commands to be given to a shell to create this target. */
@@ -473,7 +480,7 @@
 #define        MAKEOVERRIDES   ".MAKEOVERRIDES"
 #define        MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */
 #define        MAKE_EXPORTED   ".MAKE.EXPORTED"   /* variables we export */
-#define        MAKE_MAKEFILES  ".MAKE.MAKEFILES"  /* all the makefiles we read */
+#define        MAKE_MAKEFILES  ".MAKE.MAKEFILES"  /* all makefiles already loaded */
 #define        MAKE_LEVEL      ".MAKE.LEVEL"      /* recursion level */
 #define MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
 #define MAKE_DEPENDFILE        ".MAKE.DEPENDFILE" /* .depend */
@@ -563,8 +570,8 @@
 Boolean NoExecute(GNode *gn);
 
 /*
- * See if the node with the given type was not the object of a dependency
- * operator.
+ * See if the node with the given type was never seen on the left-hand side
+ * of a dependency operator.
  */
 static Boolean MAKE_ATTR_UNUSED
 OP_NOP(GNodeType t)
@@ -634,13 +641,13 @@
        (*pp)++;
 }
 
-#ifndef MAKE_NATIVE
-#define MAKE_RCSID(id) static volatile char rcsid[] = id
+#ifdef MAKE_NATIVE
+#  include <sys/cdefs.h>
+#  ifndef lint
+#    define MAKE_RCSID(id) __RCSID(id)
+#  endif
 #else
-#include <sys/cdefs.h>
-#ifndef lint
-#define MAKE_RCSID(id) __RCSID(id)
-#endif
+#  define MAKE_RCSID(id) static volatile char rcsid[] = id
 #endif
 
 #endif /* MAKE_MAKE_H */
diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/make_malloc.h
--- a/usr.bin/make/make_malloc.h        Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/make_malloc.h        Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make_malloc.h,v 1.11 2020/09/13 15:27:25 rillig Exp $  */
+/*     $NetBSD: make_malloc.h,v 1.12 2020/10/19 23:43:55 rillig Exp $  */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -33,16 +33,16 @@
 char *bmake_strldup(const char *, size_t);
 #else
 #include <util.h>
-#define bmake_malloc(x)         emalloc(x)
-#define bmake_realloc(x,y)      erealloc(x,y)
-#define bmake_strdup(x)         estrdup(x)
-#define bmake_strldup(x,y)      estrndup(x,y)
+#define bmake_malloc(n)                emalloc(n)
+#define bmake_realloc(p, n)    erealloc(p, n)
+#define bmake_strdup(s)                estrdup(s)
+#define bmake_strldup(s, n)    estrndup(s, n)
 #endif
+
 char *bmake_strsedup(const char *, const char *);
 
 /* Thin wrapper around free(3) to avoid the extra function call in case
- * p is NULL, which on x86_64 costs about 12 machine instructions.
- * Other platforms are similarly affected.
+ * p is NULL, to save a few machine instructions.
  *
  * The case of a NULL pointer happens especially often after Var_Value,
  * since only environment variables need to be freed, but not others. */
diff -r 20fb6ae0e048 -r 4909f4d4ff14 usr.bin/make/meta.h
--- a/usr.bin/make/meta.h       Mon Oct 19 23:07:22 2020 +0000
+++ b/usr.bin/make/meta.h       Mon Oct 19 23:43:55 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.h,v 1.7 2020/07/03 08:13:23 rillig Exp $ */
+/*      $NetBSD: meta.h,v 1.8 2020/10/19 23:43:55 rillig Exp $ */
 
 /*
  * Things needed for 'meta' mode.
@@ -38,9 +38,8 @@
     FILE       *mfp;
 } BuildMon;
 
-extern Boolean useMeta;
+struct Job;
 
-struct Job;                            /* not defined yet */
 void meta_init(void);
 void meta_finish(void);
 void meta_mode_init(const char *);
@@ -57,3 +56,5 @@
 void meta_compat_start(void);
 void meta_compat_child(void);
 void meta_compat_parent(pid_t);
+
+extern Boolean useMeta;



Home | Main Index | Thread Index | Old Index