Module Name:    src
Committed By:   rillig
Date:           Mon Oct 19 23:43:55 UTC 2020

Modified Files:
        src/usr.bin/make: config.h dir.h job.c make.c make.h make_malloc.h
            meta.h nonints.h targ.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/config.h
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/dir.h
cvs rdiff -u -r1.266 -r1.267 src/usr.bin/make/job.c
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/make.c
cvs rdiff -u -r1.159 -r1.160 src/usr.bin/make/make.h
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/make_malloc.h
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/meta.h
cvs rdiff -u -r1.144 -r1.145 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.118 -r1.119 src/usr.bin/make/targ.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/config.h
diff -u src/usr.bin/make/config.h:1.24 src/usr.bin/make/config.h:1.25
--- src/usr.bin/make/config.h:1.24	Sun Oct 18 08:01:23 2020
+++ src/usr.bin/make/config.h	Mon Oct 19 23:43:55 2020
@@ -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

Index: src/usr.bin/make/dir.h
diff -u src/usr.bin/make/dir.h:1.30 src/usr.bin/make/dir.h:1.31
--- src/usr.bin/make/dir.h:1.30	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/dir.h	Mon Oct 19 23:43:55 2020
@@ -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 @@ typedef struct CachedDir {
     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);

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.266 src/usr.bin/make/job.c:1.267
--- src/usr.bin/make/job.c:1.266	Mon Oct 19 23:07:22 2020
+++ src/usr.bin/make/job.c	Mon Oct 19 23:43:55 2020
@@ -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 @@ typedef struct Shell {
     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 @@ JobOutput(Job *job, char *cp, char *endp
 		(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 @@ Job_ParseShell(char *line)
 		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) {

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.165 src/usr.bin/make/make.c:1.166
--- src/usr.bin/make/make.c:1.165	Mon Oct 19 21:57:37 2020
+++ src/usr.bin/make/make.c	Mon Oct 19 23:43:55 2020
@@ -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 @@ MakeStartJobs(void)
 	    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) {
 	    /*

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.159 src/usr.bin/make/make.h:1.160
--- src/usr.bin/make/make.h:1.159	Sun Oct 18 17:19:54 2020
+++ src/usr.bin/make/make.h	Mon Oct 19 23:43:55 2020
@@ -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 @@ typedef enum GNodeType {
     /* 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 @@ typedef enum GNodeType {
     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 @@ typedef struct GNode {
     /* 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 @@ typedef struct GNode {
      * 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 @@ typedef struct GNode {
     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 @@ extern pid_t	myPid;
 #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 @@ void GNode_FprintDetails(FILE *, const c
 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_skip_whitespace(char **pp)
 	(*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 */

Index: src/usr.bin/make/make_malloc.h
diff -u src/usr.bin/make/make_malloc.h:1.11 src/usr.bin/make/make_malloc.h:1.12
--- src/usr.bin/make/make_malloc.h:1.11	Sun Sep 13 15:27:25 2020
+++ src/usr.bin/make/make_malloc.h	Mon Oct 19 23:43:55 2020
@@ -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_strdup(const char *);
 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. */

Index: src/usr.bin/make/meta.h
diff -u src/usr.bin/make/meta.h:1.7 src/usr.bin/make/meta.h:1.8
--- src/usr.bin/make/meta.h:1.7	Fri Jul  3 08:13:23 2020
+++ src/usr.bin/make/meta.h	Mon Oct 19 23:43:55 2020
@@ -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 @@ typedef struct BuildMon {
     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 @@ Boolean meta_oodate(GNode *, Boolean);
 void meta_compat_start(void);
 void meta_compat_child(void);
 void meta_compat_parent(pid_t);
+
+extern Boolean useMeta;

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.144 src/usr.bin/make/nonints.h:1.145
--- src/usr.bin/make/nonints.h:1.144	Sun Oct 18 20:14:27 2020
+++ src/usr.bin/make/nonints.h	Mon Oct 19 23:43:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.144 2020/10/18 20:14:27 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.145 2020/10/19 23:43:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -138,12 +138,14 @@ typedef struct VarAssign {
     const char *value;		/* unexpanded */
 } VarAssign;
 
+typedef char *(*NextBufProc)(void *, size_t *);
+
 void Parse_Error(int, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
 Boolean Parse_IsVar(const char *, VarAssign *out_var);
 void Parse_DoVar(VarAssign *, GNode *);
 void Parse_AddIncludeDir(const char *);
 void Parse_File(const char *, int);
-void Parse_SetInput(const char *, int, int, char *(*)(void *, size_t *), void *);
+void Parse_SetInput(const char *, int, int, NextBufProc, void *);
 GNodeList *Parse_MainName(void);
 
 /* str.c */

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.118 src/usr.bin/make/targ.c:1.119
--- src/usr.bin/make/targ.c:1.118	Mon Oct 19 21:17:35 2020
+++ src/usr.bin/make/targ.c	Mon Oct 19 23:43:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.118 2020/10/19 21:17:35 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.119 2020/10/19 23:43:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.118 2020/10/19 21:17:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.119 2020/10/19 23:43:55 rillig Exp $");
 
 static GNodeList *allTargets;	/* the list of all targets found so far */
 #ifdef CLEANUP
@@ -187,7 +187,7 @@ Targ_NewGN(const char *name)
     gn->centurion = NULL;
     gn->made = UNMADE;
     gn->flags = 0;
-    gn->checked = 0;
+    gn->checked_seqno = 0;
     gn->mtime = 0;
     gn->cmgn = NULL;
     gn->implicitParents = Lst_New();

Reply via email to