Module Name: src
Committed By: rillig
Date: Wed Dec 15 12:58:01 UTC 2021
Modified Files:
src/usr.bin/make: arch.c compat.c cond.c for.c hash.h job.c job.h
main.c make.c make.h nonints.h parse.c suff.c trace.c util.c var.c
Log Message:
make: format comments according to /usr/share/misc/style
Assisted by indent(1), with manual corrections due to its many remaining
bugs.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/usr.bin/make/arch.c
cvs rdiff -u -r1.231 -r1.232 src/usr.bin/make/compat.c
cvs rdiff -u -r1.305 -r1.306 src/usr.bin/make/cond.c
cvs rdiff -u -r1.150 -r1.151 src/usr.bin/make/for.c
cvs rdiff -u -r1.44 -r1.45 src/usr.bin/make/hash.h
cvs rdiff -u -r1.442 -r1.443 src/usr.bin/make/job.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/make/job.h
cvs rdiff -u -r1.546 -r1.547 src/usr.bin/make/main.c
cvs rdiff -u -r1.248 -r1.249 src/usr.bin/make/make.c
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/make/make.h
cvs rdiff -u -r1.220 -r1.221 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.582 -r1.583 src/usr.bin/make/parse.c
cvs rdiff -u -r1.359 -r1.360 src/usr.bin/make/suff.c
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/trace.c
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/make/util.c
cvs rdiff -u -r1.987 -r1.988 src/usr.bin/make/var.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/arch.c
diff -u src/usr.bin/make/arch.c:1.208 src/usr.bin/make/arch.c:1.209
--- src/usr.bin/make/arch.c:1.208 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/arch.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.208 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.209 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.208 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.209 2021/12/15 12:58:01 rillig Exp $");
typedef struct List ArchList;
typedef struct ListNode ArchListNode;
@@ -205,9 +205,8 @@ Arch_ParseArchive(char **pp, GNodeList *
FStr lib; /* Library-part of specification */
FStr mem; /* Member-part of specification */
char saveChar; /* Ending delimiter of member-name */
- bool expandLib; /* Whether the parsed lib contains
- * variable expressions that need to be
- * expanded */
+ bool expandLib; /* Whether the parsed lib contains variable
+ * expressions that need to be expanded */
spec = *pp;
lib = FStr_InitRefer(spec);
@@ -258,7 +257,9 @@ Arch_ParseArchive(char **pp, GNodeList *
while (*cp != '\0' && *cp != ')' && !ch_isspace(*cp)) {
if (*cp == '$') {
/* Expand nested variable expressions. */
- /* XXX: This code can probably be shortened. */
+ /*
+ * XXX: This code can probably be shortened.
+ */
FStr result;
bool isError;
const char *nested_p = cp;
@@ -691,8 +692,10 @@ ArchiveMember_HasName(const struct ar_hd
if (ar_name[namelen] == ' ')
return true;
- /* In archives created by GNU binutils 2.27, the member names end with
- * a slash. */
+ /*
+ * In archives created by GNU binutils 2.27, the member names end
+ * with a slash.
+ */
if (ar_name[namelen] == '/' &&
(namelen == ar_name_len || ar_name[namelen + 1] == ' '))
return true;
Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.231 src/usr.bin/make/compat.c:1.232
--- src/usr.bin/make/compat.c:1.231 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/compat.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.231 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.232 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.231 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.232 2021/12/15 12:58:01 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -167,8 +167,10 @@ DebugFailedTarget(const char *cmd, const
debug_printf("\n*** Failed target: %s\n*** Failed command: ",
gn->name);
- /* Replace runs of whitespace with a single space, to reduce
- * the amount of whitespace for multi-line command lines. */
+ /*
+ * Replace runs of whitespace with a single space, to reduce the
+ * amount of whitespace for multi-line command lines.
+ */
while (*p != '\0') {
if (ch_isspace(*p)) {
debug_printf(" ");
@@ -712,9 +714,11 @@ Compat_Run(GNodeList *targs)
InitSignals();
- /* Create the .END node now, to keep the (debug) output of the
- * counter.mk test the same as before 2020-09-23. This implementation
- * detail probably doesn't matter though. */
+ /*
+ * Create the .END node now, to keep the (debug) output of the
+ * counter.mk test the same as before 2020-09-23. This
+ * implementation detail probably doesn't matter though.
+ */
(void)Targ_GetEndNode();
if (!opts.queryFlag)
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.305 src/usr.bin/make/cond.c:1.306
--- src/usr.bin/make/cond.c:1.305 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/cond.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.305 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.306 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.305 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.306 2021/12/15 12:58:01 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -445,7 +445,7 @@ CondParser_StringExpr(CondParser *par, c
Buf_AddStr(buf, inout_str->str);
FStr_Done(inout_str);
- *inout_str = FStr_InitRefer(NULL); /* not finished yet */
+ *inout_str = FStr_InitRefer(NULL); /* not finished yet */
return true;
}
@@ -553,9 +553,11 @@ EvalNotEmpty(CondParser *par, const char
if (TryParseNumber(value, &num))
return num != 0.0;
- /* For .if ${...}, check for non-empty string. This is different from
- * the evaluation function from that .if variant, which would test
- * whether a variable of the given name were defined. */
+ /*
+ * For .if ${...}, check for non-empty string. This is different
+ * from the evaluation function from that .if variant, which would
+ * test whether a variable of the given name were defined.
+ */
/*
* XXX: Whitespace should count as empty, just as in
* CondParser_FuncCallEmpty.
@@ -1132,8 +1134,10 @@ Cond_EvalLine(const char *line)
/* None of the previous <cond> evaluated to true. */
IFS_INITIAL = 0,
- /* The previous <cond> evaluated to true.
- * The lines following this condition are interpreted. */
+ /*
+ * The previous <cond> evaluated to true. The lines following
+ * this condition are interpreted.
+ */
IFS_ACTIVE = 1 << 0,
/* The previous directive was an '.else'. */
@@ -1278,7 +1282,9 @@ Cond_EvalLine(const char *line)
/* And evaluate the conditional expression */
if (CondEvalExpression(p, &value, plain, evalBare, negate,
true, false) == COND_INVALID) {
- /* Syntax error in conditional, error message already output. */
+ /*
+ * Syntax error in conditional, error message already output.
+ */
/* Skip everything to matching .endif */
/* XXX: An extra '.else' is not detected in this case. */
cond_states[cond_depth] = IFS_WAS_ACTIVE;
Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.150 src/usr.bin/make/for.c:1.151
--- src/usr.bin/make/for.c:1.150 Sun Dec 12 15:44:41 2021
+++ src/usr.bin/make/for.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.150 2021/12/12 15:44:41 rillig Exp $ */
+/* $NetBSD: for.c,v 1.151 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
#include "make.h"
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: for.c,v 1.150 2021/12/12 15:44:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.151 2021/12/15 12:58:01 rillig Exp $");
/* One of the variables to the left of the "in" in a .for loop. */
@@ -174,7 +174,7 @@ ForLoop_ParseItems(ForLoop *f, const cha
free(items);
if (f->items.len == 1 && Substring_IsEmpty(f->items.words[0]))
- f->items.len = 0; /* .for var in ${:U} */
+ f->items.len = 0; /* .for var in ${:U} */
if (f->items.len != 0 && f->items.len % f->vars.len != 0) {
Parse_Error(PARSE_FATAL,
@@ -340,8 +340,10 @@ Buf_AddEscaped(Buffer *cmds, Substring i
return;
}
- /* Escape ':', '$', '\\' and 'endc' - these will be removed later by
- * :U processing, see ApplyModifier_Defined. */
+ /*
+ * Escape ':', '$', '\\' and 'endc' - these will be removed later by
+ * :U processing, see ApplyModifier_Defined.
+ */
for (p = item.start; p != item.end; p++) {
ch = *p;
if (ch == '$') {
Index: src/usr.bin/make/hash.h
diff -u src/usr.bin/make/hash.h:1.44 src/usr.bin/make/hash.h:1.45
--- src/usr.bin/make/hash.h:1.44 Wed Dec 15 12:08:25 2021
+++ src/usr.bin/make/hash.h Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: hash.h,v 1.44 2021/12/15 12:08:25 rillig Exp $ */
+/* $NetBSD: hash.h,v 1.45 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -88,8 +88,8 @@ typedef struct HashEntry {
/* The hash table containing the entries. */
typedef struct HashTable {
- HashEntry **buckets; /* Pointers to HashEntry, one
- * for each bucket in the table. */
+ HashEntry **buckets; /* Pointers to HashEntry, one for each bucket
+ * in the table. */
unsigned int bucketsSize;
unsigned int numEntries; /* Number of entries in the table. */
unsigned int bucketsMask; /* Used to select the bucket for a hash. */
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.442 src/usr.bin/make/job.c:1.443
--- src/usr.bin/make/job.c:1.442 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/job.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.442 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: job.c,v 1.443 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.442 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.443 2021/12/15 12:58:01 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -201,13 +201,15 @@ typedef struct Shell {
const char *errOff; /* command to turn off error checking */
const char *echoTmpl; /* template to echo a command */
- const char *runIgnTmpl; /* template to run a command
- * without error checking */
- const char *runChkTmpl; /* template to run a command
- * with error checking */
+ const char *runIgnTmpl; /* template to run a command without error
+ * checking */
+ const char *runChkTmpl; /* template to run a command with error
+ * checking */
- /* string literal that results in a newline character when it appears
- * outside of any 'quote' or "quote" characters */
+ /*
+ * A string literal that results in a newline character when it
+ * occurs outside of any 'quote' or "quote" characters.
+ */
const char *newline;
char commentChar; /* character used by shell for comment lines */
@@ -425,7 +427,7 @@ static void watchfd(Job *);
static void clearfd(Job *);
static bool readyfd(Job *);
-static char *targPrefix = NULL; /* To identify a job change in the output. */
+static char *targPrefix = NULL; /* To identify a job change in the output. */
static Job tokenWaitJob; /* token wait pseudo-job */
static Job childExitJob; /* child exit pseudo-job */
@@ -1266,9 +1268,11 @@ TouchRegular(GNode *gn)
return; /* XXX: What about propagating the error? */
}
- /* Last resort: update the file's time stamps in the traditional way.
+ /*
+ * Last resort: update the file's time stamps in the traditional way.
* XXX: This doesn't work for empty files, which are sometimes used
- * as marker files. */
+ * as marker files.
+ */
if (read(fd, &c, 1) == 1) {
(void)lseek(fd, 0, SEEK_SET);
while (write(fd, &c, 1) == -1 && errno == EAGAIN)
@@ -1620,7 +1624,7 @@ JobWriteShellCommands(Job *job, GNode *g
#ifdef USE_META
if (useMeta) {
meta_job_start(job, gn);
- if (gn->type & OP_SILENT) /* might have changed */
+ if (gn->type & OP_SILENT) /* might have changed */
job->echo = false;
}
#endif
@@ -1683,7 +1687,7 @@ JobStart(GNode *gn, bool special)
* also dead...
*/
if (!cmdsOK) {
- PrintOnError(gn, NULL); /* provide some clue */
+ PrintOnError(gn, NULL); /* provide some clue */
DieHorribly();
}
} else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) ||
@@ -1700,7 +1704,7 @@ JobStart(GNode *gn, bool special)
* also dead...
*/
if (!cmdsOK) {
- PrintOnError(gn, NULL); /* provide some clue */
+ PrintOnError(gn, NULL); /* provide some clue */
DieHorribly();
}
@@ -2133,7 +2137,7 @@ Job_CatchOutput(void)
*/
if (useMeta && job->inPollfd != &fds[i]) {
if (meta_job_event(job) <= 0) {
- fds[i].events = 0; /* never mind */
+ fds[i].events = 0; /* never mind */
}
}
#endif
@@ -2309,8 +2313,10 @@ Job_Init(void)
AddSig(SIGCONT, JobContinueSig);
(void)Job_RunTarget(".BEGIN", NULL);
- /* Create the .END node now, even though no code in the unit tests
- * depends on it. See also Targ_GetEndNode in Compat_Run. */
+ /*
+ * Create the .END node now, even though no code in the unit tests
+ * depends on it. See also Targ_GetEndNode in Compat_Run.
+ */
(void)Targ_GetEndNode();
}
@@ -2450,13 +2456,17 @@ Job_ParseShell(char *line)
} else if (strncmp(arg, "newline=", 8) == 0) {
newShell.newline = arg + 8;
} else if (strncmp(arg, "check=", 6) == 0) {
- /* Before 2020-12-10, these two variables
- * had been a single variable. */
+ /*
+ * Before 2020-12-10, these two variables had
+ * been a single variable.
+ */
newShell.errOn = arg + 6;
newShell.echoTmpl = arg + 6;
} else if (strncmp(arg, "ignore=", 7) == 0) {
- /* Before 2020-12-10, these two variables
- * had been a single variable. */
+ /*
+ * Before 2020-12-10, these two variables had
+ * been a single variable.
+ */
newShell.errOff = arg + 7;
newShell.runIgnTmpl = arg + 7;
} else if (strncmp(arg, "errout=", 7) == 0) {
@@ -3015,4 +3025,4 @@ emul_poll(struct pollfd *fd, int nfd, in
return npoll;
}
-#endif /* USE_SELECT */
+#endif /* USE_SELECT */
Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.76 src/usr.bin/make/job.h:1.77
--- src/usr.bin/make/job.h:1.76 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/job.h Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: job.h,v 1.76 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: job.h,v 1.77 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -80,7 +80,7 @@
#ifndef MAKE_JOB_H
#define MAKE_JOB_H
-#define TMPPAT "makeXXXXXX" /* relative to tmpdir */
+#define TMPPAT "makeXXXXXX" /* relative to tmpdir */
#ifdef USE_SELECT
/*
@@ -144,9 +144,11 @@ typedef struct Job {
/* The target the child is making */
GNode *node;
- /* If one of the shell commands is "...", all following commands are
- * delayed until the .END node is made. This list node points to the
- * first of these commands, if any. */
+ /*
+ * If one of the shell commands is "...", all following commands are
+ * delayed until the .END node is made. This list node points to the
+ * first of these commands, if any.
+ */
StringListNode *tailCmds;
/* This is where the shell commands go. */
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.546 src/usr.bin/make/main.c:1.547
--- src/usr.bin/make/main.c:1.546 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/main.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.546 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: main.c,v 1.547 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.546 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.547 2021/12/15 12:58:01 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -134,7 +134,7 @@ static const char *tracefile;
static int ReadMakefile(const char *);
static void purge_relative_cached_realpaths(void);
-static bool ignorePWD; /* if we use -C, PWD is meaningless */
+static bool ignorePWD; /* if we use -C, PWD is meaningless */
static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */
char curdir[MAXPATHLEN + 1]; /* Startup directory */
const char *progname;
@@ -619,7 +619,10 @@ rearg:
/* '-' found at some earlier point */
optspec = strchr(optspecs, c);
if (c != '\0' && optspec != NULL && optspec[1] == ':') {
- /* -<something> found, and <something> should have an arg */
+ /*
+ * -<something> found, and <something> should have an
+ * argument
+ */
inOption = false;
arginc = 1;
argvalue = optscan;
@@ -906,7 +909,7 @@ static bool
runTargets(void)
{
GNodeList targs = LST_INIT; /* target nodes to create */
- bool outOfDate; /* false if all targets up to date */
+ bool outOfDate; /* false if all targets up to date */
/*
* Have now read the entire graph and need to make a list of
@@ -1226,8 +1229,13 @@ ReadBuiltinRules(void)
Fatal("%s: cannot open %s.",
progname, (const char *)sysMkFiles.first->datum);
- /* Free the list nodes but not the actual filenames since these may
- * still be used in GNodes. */
+ /*
+ * Free the list nodes but not the actual filenames since these may
+ * still be used in GNodes.
+ *
+ * TODO: Check whether the above is still true after Str_Intern has
+ * been added.
+ */
Lst_Done(&sysMkFiles);
}
@@ -1317,10 +1325,12 @@ ReadFirstDefaultMakefile(void)
SCOPE_CMDLINE, VARE_WANTRES, &prefs);
/* TODO: handle errors */
- /* XXX: This should use a local list instead of opts.makefiles
- * since these makefiles do not come from the command line. They
- * also have different semantics in that only the first file that
- * is found is processed. See ReadAllMakefiles. */
+ /*
+ * XXX: This should use a local list instead of opts.makefiles since
+ * these makefiles do not come from the command line. They also have
+ * different semantics in that only the first file that is found is
+ * processed. See ReadAllMakefiles.
+ */
(void)str2Lst_Append(&opts.makefiles, prefs);
for (ln = opts.makefiles.first; ln != NULL; ln = ln->next)
@@ -1390,7 +1400,7 @@ main_Init(int argc, char **argv)
#ifdef MAKE_VERSION
Global_Set("MAKE_VERSION", MAKE_VERSION);
#endif
- Global_Set(".newline", "\n"); /* handy for :@ loops */
+ Global_Set(".newline", "\n"); /* handy for :@ loops */
/*
* This is the traditional preference for makefiles.
*/
@@ -1811,7 +1821,7 @@ Cmd_Exec(const char *cmd, const char **e
(void)execv(shellPath, UNCONST(args));
_exit(1);
- /*NOTREACHED*/
+ /* NOTREACHED */
case -1:
*errfmt = "Couldn't exec \"%s\"";
@@ -1850,7 +1860,10 @@ Cmd_Exec(const char *cmd, const char **e
else if (WEXITSTATUS(status) != 0)
*errfmt = "\"%s\" returned non-zero status";
- /* Convert newlines to spaces. A final newline is just stripped */
+ /*
+ * Convert newlines to spaces. A final newline is just
+ * stripped.
+ */
if (res_len > 0 && res[res_len - 1] == '\n')
res[res_len - 1] = '\0';
for (cp = res; *cp != '\0'; cp++)
@@ -2044,8 +2057,10 @@ purge_relative_cached_realpaths(void)
if (he->key[0] != '/') {
DEBUG1(DIR, "cached_realpath: purging %s\n", he->key);
HashTable_DeleteEntry(&cached_realpaths, he);
- /* XXX: What about the allocated he->value? Either
- * free them or document why they cannot be freed. */
+ /*
+ * XXX: What about the allocated he->value? Either
+ * free them or document why they cannot be freed.
+ */
}
he = nhe;
}
Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.248 src/usr.bin/make/make.c:1.249
--- src/usr.bin/make/make.c:1.248 Sun Nov 28 23:12:51 2021
+++ src/usr.bin/make/make.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.248 2021/11/28 23:12:51 rillig Exp $ */
+/* $NetBSD: make.c,v 1.249 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -104,7 +104,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.248 2021/11/28 23:12:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.249 2021/12/15 12:58:01 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked_seqno = 1;
@@ -599,8 +599,9 @@ Make_Recheck(GNode *gn)
}
#endif
- /* XXX: The returned mtime may differ from gn->mtime.
- * Intentionally? */
+ /*
+ * XXX: The returned mtime may differ from gn->mtime. Intentionally?
+ */
return mtime;
}
@@ -952,7 +953,9 @@ MakeBuildChild(GNode *cn, GNodeListNode
/* If this node is on the RHS of a .ORDER, check LHSs. */
if (IsWaitingForOrder(cn)) {
- /* Can't build this (or anything else in this child list) yet */
+ /*
+ * Can't build this (or anything else in this child list) yet
+ */
cn->made = DEFERRED;
return false; /* but keep looking */
}
@@ -1327,7 +1330,9 @@ add_wait_dependency(GNodeListNode *owln,
DEBUG3(MAKE, ".WAIT: add dependency %s%s -> %s\n",
cn->name, cn->cohort_num, wn->name);
- /* XXX: This pattern should be factored out, it repeats often */
+ /*
+ * XXX: This pattern should be factored out, it repeats often
+ */
Lst_Append(&wn->children, cn);
wn->unmade++;
Lst_Append(&cn->parents, wn);
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.276 src/usr.bin/make/make.h:1.277
--- src/usr.bin/make/make.h:1.276 Wed Dec 15 12:08:25 2021
+++ src/usr.bin/make/make.h Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.276 2021/12/15 12:08:25 rillig Exp $ */
+/* $NetBSD: make.h,v 1.277 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -196,26 +196,34 @@ typedef unsigned char bool;
typedef enum GNodeMade {
/* Not examined yet. */
UNMADE,
- /* The node has been examined but is not yet ready since its
- * dependencies have to be made first. */
+ /*
+ * The node has been examined but is not yet ready since its
+ * dependencies have to be made first.
+ */
DEFERRED,
/* The node is on the toBeMade list. */
REQUESTED,
- /* The node is already being made. Trying to build a node in this
- * state indicates a cycle in the graph. */
+ /*
+ * The node is already being made. Trying to build a node in this
+ * state indicates a cycle in the graph.
+ */
BEINGMADE,
/* Was out-of-date and has been made. */
MADE,
/* Was already up-to-date, does not need to be made. */
UPTODATE,
- /* An error occurred while it was being made.
- * Used only in compat mode. */
+ /*
+ * An error occurred while it was being made. Used only in compat
+ * mode.
+ */
ERROR,
- /* The target was aborted due to an error making a dependency.
- * Used only in compat mode. */
+ /*
+ * The target was aborted due to an error making a dependency. Used
+ * only in compat mode.
+ */
ABORTED
} GNodeMade;
@@ -231,16 +239,22 @@ typedef enum GNodeMade {
typedef enum GNodeType {
OP_NONE = 0,
- /* The dependency operator ':' is the most common one. The commands
- * of this node are executed if any child is out-of-date. */
+ /*
+ * The dependency operator ':' is the most common one. The commands
+ * of this node are executed if any child is out-of-date.
+ */
OP_DEPENDS = 1 << 0,
- /* The dependency operator '!' always executes its commands, even if
- * its children are up-to-date. */
+ /*
+ * The dependency operator '!' always executes its commands, even if
+ * its children are up-to-date.
+ */
OP_FORCE = 1 << 1,
- /* The dependency operator '::' behaves like ':', except that it
+ /*
+ * The dependency operator '::' behaves like ':', except that it
* allows multiple dependency groups to be defined. Each of these
- * groups is executed on its own, independently from the others.
- * Each individual dependency group is called a cohort. */
+ * groups is executed on its own, independently from the others. Each
+ * individual dependency group is called a cohort.
+ */
OP_DOUBLEDEP = 1 << 2,
/* Matches the dependency operators ':', '!' and '::'. */
@@ -250,21 +264,29 @@ typedef enum GNodeType {
OP_OPTIONAL = 1 << 3,
/* Use associated commands for parents. */
OP_USE = 1 << 4,
- /* Target is never out of date, but always execute commands anyway.
- * Its time doesn't matter, so it has none...sort of. */
+ /*
+ * 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 non-zero exit status from shell commands 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,
/* Don't echo commands when executed. */
OP_SILENT = 1 << 8,
- /* Target is a recursive make so its commands should always be
- * executed when it is out of date, regardless of the state of the
- * -n or -t flags. */
+ /*
+ * Target is a recursive make so its commands should always be
+ * executed when it is out of date, regardless of the state of the -n
+ * or -t flags.
+ */
OP_MAKE = 1 << 9,
- /* Target is out-of-date only if any of its children was out-of-date. */
+ /*
+ * Target is out-of-date only if any of its children was out-of-date.
+ */
OP_JOIN = 1 << 10,
/* Assume the children of the node have been already made. */
OP_MADE = 1 << 11,
@@ -272,20 +294,26 @@ typedef enum GNodeType {
OP_SPECIAL = 1 << 12,
/* Like .USE, only prepend commands. */
OP_USEBEFORE = 1 << 13,
- /* The node is invisible to its parents. I.e. it doesn't show up in
- * the parents' local variables (.IMPSRC, .ALLSRC). */
+ /*
+ * The node is invisible to its parents. I.e. it doesn't show up in
+ * the parents' local variables (.IMPSRC, .ALLSRC).
+ */
OP_INVISIBLE = 1 << 14,
- /* The node does not become the main target, even if it is the first
- * target in the first makefile. */
+ /*
+ * The node does not become the main target, even if it is the first
+ * target in the first makefile.
+ */
OP_NOTMAIN = 1 << 15,
/* Not a file target; run always. */
OP_PHONY = 1 << 16,
/* Don't search for the file in the path. */
OP_NOPATH = 1 << 17,
- /* In a dependency line "target: source1 .WAIT source2", source1 is
+ /*
+ * In a dependency line "target: source1 .WAIT source2", source1 is
* made first, including its children. Once that is finished,
* source2 is made, including its children. The .WAIT keyword may
- * appear more than once in a single dependency declaration. */
+ * appear more than once in a single dependency declaration.
+ */
OP_WAIT = 1 << 18,
/* .NOMETA do not create a .meta file */
OP_NOMETA = 1 << 19,
@@ -303,23 +331,32 @@ typedef enum GNodeType {
/* Target is a member of an archive */
/* XXX: How does this differ from OP_ARCHV? */
OP_MEMBER = 1 << 29,
- /* The node is a library,
- * its name has the form "-l<libname>" */
+ /*
+ * The node is a library, its name has the form "-l<libname>".
+ */
OP_LIB = 1 << 28,
- /* The node is an archive member,
- * its name has the form "archive(member)" */
+ /*
+ * The node is an archive member, its name has the form
+ * "archive(member)".
+ */
/* XXX: How does this differ from OP_MEMBER? */
OP_ARCHV = 1 << 27,
- /* Target has all the commands it should. Used when parsing to catch
+ /*
+ * Target has all the commands it should. Used when parsing to catch
* multiple command groups for a target. Only applies to the
- * dependency operators ':' and '!', but not to '::'. */
+ * dependency operators ':' and '!', but not to '::'.
+ */
OP_HAS_COMMANDS = 1 << 26,
- /* The special command "..." has been seen. All further commands from
- * this node will be saved on the .END node instead, to be executed at
- * the very end. */
+ /*
+ * The special command "..." has been seen. All further commands from
+ * this node will be saved on the .END node instead, to be executed
+ * at the very end.
+ */
OP_SAVE_CMDS = 1 << 25,
- /* Already processed by Suff_FindDeps, to find dependencies from
- * suffix transformation rules. */
+ /*
+ * Already processed by Suff_FindDeps, to find dependencies from
+ * suffix transformation rules.
+ */
OP_DEPS_FOUND = 1 << 24,
/* Node found while expanding .ALLSRC */
OP_MARK = 1 << 23,
@@ -367,14 +404,20 @@ typedef struct GNode {
char *name;
/* The unexpanded name of a .USE node */
char *uname;
- /* The full pathname of the file belonging to the target.
+ /*
+ * The full pathname of the file belonging to the target.
+ *
* XXX: What about .PHONY targets? These don't have an associated
- * path. */
+ * path.
+ */
char *path;
- /* The type of operator used to define the sources (see the OP flags
+ /*
+ * 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. */
+ *
+ * XXX: This looks like a wild mixture of type and flags.
+ */
GNodeType type;
GNodeFlags flags;
@@ -383,29 +426,39 @@ typedef struct GNode {
/* The number of unmade children */
int unmade;
- /* The modification time; 0 means the node does not have a
- * corresponding file; see GNode_IsOODate. */
+ /*
+ * The modification time; 0 means the node does not have a
+ * corresponding file; see GNode_IsOODate.
+ */
time_t mtime;
struct GNode *youngestChild;
- /* The GNodes for which this node is an implied source. May be empty.
- * For example, when there is an inference rule for .c.o, the node for
- * file.c has the node for file.o in this list. */
+ /*
+ * The GNodes for which this node is an implied source. May be empty.
+ * For example, when there is an inference rule for .c.o, the node
+ * for file.c has the node for file.o in this list.
+ */
GNodeList implicitParents;
- /* The nodes that depend on this one, or in other words, the nodes for
- * which this is a source. */
+ /*
+ * The nodes that depend on this one, or in other words, the nodes
+ * for which this is a source.
+ */
GNodeList parents;
/* The nodes on which this one depends. */
GNodeList children;
- /* .ORDER nodes we need made. The nodes that must be made (if they're
+ /*
+ * .ORDER nodes we need made. The nodes that must be made (if they're
* made) before this node can be made, but that do not enter into the
- * datedness of this node. */
+ * datedness of this node.
+ */
GNodeList order_pred;
- /* .ORDER nodes who need us. The nodes that must be made (if they're
+ /*
+ * .ORDER nodes who need us. The nodes that must be made (if they're
* made at all) after this node is made, but that do not depend on
- * this node, in the normal sense. */
+ * this node, in the normal sense.
+ */
GNodeList order_succ;
/*
@@ -417,8 +470,10 @@ typedef struct GNode {
char cohort_num[8];
/* The number of unmade instances on the cohorts list */
int unmade_cohorts;
- /* Pointer to the first instance of a '::' node; only set when on a
- * cohorts list */
+ /*
+ * Pointer to the first instance of a '::' node; only set when on a
+ * cohorts list
+ */
struct GNode *centurion;
/* Last time (sequence number) we tried to make this node */
@@ -437,8 +492,10 @@ typedef struct GNode {
/* The commands to be given to a shell to create this target. */
StringList commands;
- /* Suffix for the node (determined by Suff_FindDeps and opaque to
- * everyone but the Suff module) */
+ /*
+ * Suffix for the node (determined by Suff_FindDeps and opaque to
+ * everyone but the Suff module)
+ */
struct Suffix *suffix;
/* Filename where the GNode got defined, unlimited lifetime */
@@ -449,8 +506,10 @@ typedef struct GNode {
/* Error levels for diagnostics during parsing. */
typedef enum ParseErrorLevel {
- /* Exit when the current top-level makefile has been parsed
- * completely. */
+ /*
+ * Exit when the current top-level makefile has been parsed
+ * completely.
+ */
PARSE_FATAL = 1,
/* Print "warning"; may be upgraded to fatal by the -w option. */
PARSE_WARNING,
@@ -468,13 +527,13 @@ typedef enum CondEvalResult {
} CondEvalResult;
/* Names of the variables that are "local" to a specific target. */
-#define TARGET "@" /* Target of dependency */
-#define OODATE "?" /* All out-of-date sources */
-#define ALLSRC ">" /* All sources */
-#define IMPSRC "<" /* Source implied by transformation */
-#define PREFIX "*" /* Common prefix */
-#define ARCHIVE "!" /* Archive in "archive(member)" syntax */
-#define MEMBER "%" /* Member in "archive(member)" syntax */
+#define TARGET "@" /* Target of dependency */
+#define OODATE "?" /* All out-of-date sources */
+#define ALLSRC ">" /* All sources */
+#define IMPSRC "<" /* Source implied by transformation */
+#define PREFIX "*" /* Common prefix */
+#define ARCHIVE "!" /* Archive in "archive(member)" syntax */
+#define MEMBER "%" /* Member in "archive(member)" syntax */
/*
* Global Variables
@@ -608,17 +667,21 @@ typedef struct CmdOpts {
/* -B: whether we are make compatible */
bool compatMake;
- /* -d: debug control: There is one bit per module. It is up to the
- * module what debug information to print. */
+ /*
+ * -d: debug control: There is one bit per module. It is up to the
+ * module what debug information to print.
+ */
DebugFlags debug;
/* -df: debug output is written here - default stderr */
FILE *debug_file;
- /* -dL: lint mode
+ /*
+ * -dL: lint mode
*
* Runs make in strict mode, with additional checks and better error
- * handling. */
+ * handling.
+ */
bool strict;
/* -dV: for the -V option, print unexpanded variable values */
@@ -633,12 +696,16 @@ typedef struct CmdOpts {
/* -i: if true, ignore all errors from shell commands */
bool ignoreErrors;
- /* -j: the maximum number of jobs that can run in parallel;
- * this is coordinated with the submakes */
+ /*
+ * -j: the maximum number of jobs that can run in parallel; this is
+ * coordinated with the submakes
+ */
int maxJobs;
- /* -k: if true and an error occurs while making a node, continue
- * making nodes that do not depend on the erroneous node */
+ /*
+ * -k: if true and an error occurs while making a node, continue
+ * making nodes that do not depend on the erroneous node
+ */
bool keepgoing;
/* -N: execute no commands from the targets */
@@ -659,8 +726,10 @@ typedef struct CmdOpts {
/* -s: don't echo the shell commands before executing them */
bool beSilent;
- /* -t: touch the targets if they are out-of-date, but don't actually
- * make them */
+ /*
+ * -t: touch the targets if they are out-of-date, but don't actually
+ * make them
+ */
bool touchFlag;
/* -[Vv]: print expanded or unexpanded selected variables */
@@ -674,12 +743,16 @@ typedef struct CmdOpts {
/* -w: print 'Entering' and 'Leaving' for submakes */
bool enterFlag;
- /* -X: if true, do not export variables set on the command line to the
- * environment. */
+ /*
+ * -X: if true, do not export variables set on the command line to
+ * the environment.
+ */
bool varNoExportEnv;
- /* The target names specified on the command line.
- * Used to resolve .if make(...) statements. */
+ /*
+ * The target names specified on the command line. Used to resolve
+ * .if make(...) statements.
+ */
StringList create;
} CmdOpts;
Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.220 src/usr.bin/make/nonints.h:1.221
--- src/usr.bin/make/nonints.h:1.220 Wed Dec 15 10:04:49 2021
+++ src/usr.bin/make/nonints.h Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.220 2021/12/15 10:04:49 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.221 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -270,8 +270,10 @@ typedef enum VarSetFlags {
/* do not export */
VAR_SET_NO_EXPORT = 1 << 0,
- /* Make the variable read-only. No further modification is possible,
- * except for another call to Var_Set with the same flag. */
+ /*
+ * Make the variable read-only. No further modification is possible,
+ * except for another call to Var_Set with the same flag.
+ */
VAR_SET_READONLY = 1 << 1
} VarSetFlags;
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.582 src/usr.bin/make/parse.c:1.583
--- src/usr.bin/make/parse.c:1.582 Wed Dec 15 10:12:20 2021
+++ src/usr.bin/make/parse.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.582 2021/12/15 10:12:20 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.583 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.582 2021/12/15 10:12:20 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.583 2021/12/15 12:58:01 rillig Exp $");
/* types and constants */
@@ -569,8 +569,10 @@ PrintLocation(FILE *f, const char *fname
return;
}
- /* Find out which makefile is the culprit.
- * We try ${.PARSEDIR} and apply realpath(3) if not absolute. */
+ /*
+ * Find out which makefile is the culprit. We try ${.PARSEDIR} and
+ * apply realpath(3) if not absolute.
+ */
dir = Var_Value(SCOPE_GLOBAL, ".PARSEDIR");
if (dir.str == NULL)
@@ -1251,7 +1253,9 @@ ParseDependencyCheckSpec(ParseSpecial sp
* shouldn't be empty.
*/
case SP_NOT:
- /* Nothing special here -- targets can be empty if it wants. */
+ /*
+ * Nothing special here -- targets can be empty if it wants.
+ */
break;
default:
Parse_Error(PARSE_WARNING,
@@ -1651,8 +1655,8 @@ ParseDependency(char *line)
{
char *cp; /* our current position */
GNodeType op; /* the operator on the line */
- SearchPathList *paths; /* search paths to alter when parsing
- * a list of .PATH targets */
+ SearchPathList *paths; /* search paths to alter when parsing a list
+ * of .PATH targets */
GNodeType tOp; /* operator from special target */
/* target names to be found and added to the targets list */
StringList curTargs = LST_INIT;
@@ -1963,7 +1967,7 @@ static void
VarAssignSpecial(const char *name, const char *avalue)
{
if (strcmp(name, MAKEOVERRIDES) == 0)
- Main_ExportMAKEFLAGS(false); /* re-export MAKEFLAGS */
+ Main_ExportMAKEFLAGS(false); /* re-export MAKEFLAGS */
else if (strcmp(name, ".CURDIR") == 0) {
/*
* Someone is being (too?) clever...
@@ -1982,7 +1986,7 @@ VarAssignSpecial(const char *name, const
void
Parse_Var(VarAssign *var, GNode *scope)
{
- FStr avalue; /* actual value (maybe expanded) */
+ FStr avalue; /* actual value (maybe expanded) */
VarCheckSyntax(var->op, var->value, scope);
if (VarAssign_Eval(var->varname, var->op, var->value, scope, &avalue)) {
@@ -2558,7 +2562,10 @@ ParseEOF(void)
if (ptr != NULL)
return true; /* Iterate again */
- /* Ensure the makefile (or loop) didn't have mismatched conditionals */
+ /*
+ * Ensure the makefile (or .for loop) didn't have mismatched
+ * conditionals.
+ */
Cond_restore_depth(curFile->cond_depth);
if (curFile->lf != NULL) {
@@ -2793,7 +2800,7 @@ ParseGetLine(GetLineMode mode)
break;
}
- /* Brutally ignore anything after a non-escaped '#' in non-commands. */
+ /* Ignore anything after a non-escaped '#' in non-commands. */
if (firstComment != NULL && line[0] != '\t')
*firstComment = '\0';
@@ -3087,20 +3094,22 @@ ParseDependencyLine(char *line)
* in which the middle is interpreted as a source, not a target.
*/
- /* In lint mode, allow undefined variables to appear in
- * dependency lines.
+ /*
+ * In lint mode, allow undefined variables to appear in dependency
+ * lines.
*
- * Ideally, only the right-hand side would allow undefined
- * variables since it is common to have optional dependencies.
- * Having undefined variables on the left-hand side is more
- * unusual though. Since both sides are expanded in a single
- * pass, there is not much choice what to do here.
+ * Ideally, only the right-hand side would allow undefined variables
+ * since it is common to have optional dependencies. Having undefined
+ * variables on the left-hand side is more unusual though. Since
+ * both sides are expanded in a single pass, there is not much choice
+ * what to do here.
*
- * In normal mode, it does not matter whether undefined
- * variables are allowed or not since as of 2020-09-14,
- * Var_Parse does not print any parse errors in such a case.
- * It simply returns the special empty string var_Error,
- * which cannot be detected in the result of Var_Subst. */
+ * In normal mode, it does not matter whether undefined variables are
+ * allowed or not since as of 2020-09-14, Var_Parse does not print
+ * any parse errors in such a case. It simply returns the special
+ * empty string var_Error, which cannot be detected in the result of
+ * Var_Subst.
+ */
emode = opts.strict ? VARE_WANTRES : VARE_UNDEFERR;
(void)Var_Subst(line, SCOPE_CMDLINE, emode, &expanded_line);
/* TODO: handle errors */
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.359 src/usr.bin/make/suff.c:1.360
--- src/usr.bin/make/suff.c:1.359 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/suff.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.359 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.360 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.359 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.360 2021/12/15 12:58:01 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -207,20 +207,26 @@ typedef struct Suffix {
typedef struct Candidate {
/* The file or node to look for. */
char *file;
- /* The prefix from which file was formed.
- * Its memory is shared among all candidates. */
+ /*
+ * The prefix from which file was formed. Its memory is shared among
+ * all candidates.
+ */
char *prefix;
/* The suffix on the file. */
Suffix *suff;
- /* The candidate that can be made from this,
- * or NULL for the top-level candidate. */
+ /*
+ * The candidate that can be made from this, or NULL for the
+ * top-level candidate.
+ */
struct Candidate *parent;
/* The node describing the file. */
GNode *node;
- /* Count of existing children, only used for memory management, so we
- * don't free this candidate too early or too late. */
+ /*
+ * Count of existing children, only used for memory management, so we
+ * don't free this candidate too early or too late.
+ */
int numChildren;
#ifdef DEBUG_SRC
CandidateList childrenList;
@@ -692,7 +698,9 @@ RebuildGraph(GNode *transform, Suffix *s
size_t nameLen = strlen(name);
const char *toName;
- /* See if it is a transformation from this suffix to another suffix. */
+ /*
+ * See if it is a transformation from this suffix to another suffix.
+ */
toName = StrTrimPrefix(suff->name, name);
if (toName != NULL) {
Suffix *to = FindSuffixByName(toName);
@@ -702,7 +710,9 @@ RebuildGraph(GNode *transform, Suffix *s
}
}
- /* See if it is a transformation from another suffix to this suffix. */
+ /*
+ * See if it is a transformation from another suffix to this suffix.
+ */
toName = Suffix_TrimSuffix(suff, nameLen, name + nameLen);
if (toName != NULL) {
Suffix *from = FindSuffixByNameLen(name,
@@ -1197,7 +1207,9 @@ FindCmds(Candidate *targ, CandidateSearc
base = str_basename(sgn->name);
if (strncmp(base, targ->prefix, prefLen) != 0)
continue;
- /* The node matches the prefix, see if it has a known suffix. */
+ /*
+ * The node matches the prefix, see if it has a known suffix.
+ */
suff = FindSuffixByName(base + prefLen);
if (suff == NULL)
continue;
@@ -1254,7 +1266,7 @@ ExpandWildcards(GNodeListNode *cln, GNod
DEBUG1(SUFF, "%s...", cp);
gn = Targ_GetNode(cp);
- /* Add gn to the parents child list before the original child */
+ /* Insert gn before the original child. */
Lst_InsertBefore(&pgn->children, cln, gn);
Lst_Append(&gn->parents, pgn);
pgn->unmade++;
Index: src/usr.bin/make/trace.c
diff -u src/usr.bin/make/trace.c:1.29 src/usr.bin/make/trace.c:1.30
--- src/usr.bin/make/trace.c:1.29 Tue Sep 21 23:06:18 2021
+++ src/usr.bin/make/trace.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: trace.c,v 1.29 2021/09/21 23:06:18 rillig Exp $ */
+/* $NetBSD: trace.c,v 1.30 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
#include "job.h"
#include "trace.h"
-MAKE_RCSID("$NetBSD: trace.c,v 1.29 2021/09/21 23:06:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: trace.c,v 1.30 2021/12/15 12:58:01 rillig Exp $");
static FILE *trfile;
static pid_t trpid;
@@ -69,8 +69,10 @@ Trace_Init(const char *pathname)
if (pathname != NULL) {
FStr curDir;
trpid = getpid();
- /* XXX: This variable may get overwritten later, which
- * would make trwd point to undefined behavior. */
+ /*
+ * XXX: This variable may get overwritten later, which would
+ * make trwd point to undefined behavior.
+ */
curDir = Var_Value(SCOPE_GLOBAL, ".CURDIR");
trwd = curDir.str;
Index: src/usr.bin/make/util.c
diff -u src/usr.bin/make/util.c:1.77 src/usr.bin/make/util.c:1.78
--- src/usr.bin/make/util.c:1.77 Wed Dec 15 12:24:13 2021
+++ src/usr.bin/make/util.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.77 2021/12/15 12:24:13 rillig Exp $ */
+/* $NetBSD: util.c,v 1.78 2021/12/15 12:58:01 rillig Exp $ */
/*
* Missing stuff from OS's
@@ -15,7 +15,7 @@
#include "make.h"
-MAKE_RCSID("$NetBSD: util.c,v 1.77 2021/12/15 12:24:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.78 2021/12/15 12:58:01 rillig Exp $");
#if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
extern int errno, sys_nerr;
@@ -75,7 +75,7 @@ unsetenv(const char *name)
return -1;
}
- while (findenv(name, &offset)) { /* if set multiple times */
+ while (findenv(name, &offset)) { /* if set multiple times */
for (p = &environ[offset];; p++)
if (!(*p = *(p + 1)))
break;
@@ -96,7 +96,7 @@ setenv(const char *name, const char *val
return -1;
}
- if (*value == '=') /* no `=' in value */
+ if (*value == '=') /* no `=' in value */
value++;
l_value = strlen(value);
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.987 src/usr.bin/make/var.c:1.988
--- src/usr.bin/make/var.c:1.987 Wed Dec 15 11:58:40 2021
+++ src/usr.bin/make/var.c Wed Dec 15 12:58:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.987 2021/12/15 11:58:40 rillig Exp $ */
+/* $NetBSD: var.c,v 1.988 2021/12/15 12:58:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.987 2021/12/15 11:58:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.988 2021/12/15 12:58:01 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -1023,8 +1023,10 @@ Var_SetWithFlags(GNode *scope, const cha
if (!opts.varNoExportEnv)
setenv(name, val, 1);
/* XXX: What about .MAKE.EXPORTED? */
- /* XXX: Why not just mark the variable for needing export,
- * as in ExportVarPlain? */
+ /*
+ * XXX: Why not just mark the variable for needing export, as
+ * in ExportVarPlain?
+ */
Global_Append(MAKEOVERRIDES, name);
}
@@ -1834,7 +1836,9 @@ SubstringWords_JoinFree(SubstringWords w
for (i = 0; i < words.len; i++) {
if (i != 0) {
- /* XXX: Use ch->sep instead of ' ', for consistency. */
+ /*
+ * XXX: Use ch->sep instead of ' ', for consistency.
+ */
Buf_AddByte(&buf, ' ');
}
Buf_AddBytesBetween(&buf,
@@ -2232,11 +2236,15 @@ ParseModifierPartSubst(
VarEvalMode emode,
ModChain *ch,
LazyBuf *part,
- /* For the first part of the modifier ':S', set anchorEnd if the last
- * character of the pattern is a $. */
+ /*
+ * For the first part of the modifier ':S', set anchorEnd if the last
+ * character of the pattern is a $.
+ */
PatternFlags *out_pflags,
- /* For the second part of the :S modifier, allow ampersands to be
- * escaped and replace unescaped ampersands with subst->lhs. */
+ /*
+ * For the second part of the :S modifier, allow ampersands to be escaped
+ * and replace unescaped ampersands with subst->lhs.
+ */
struct ModifyWord_SubstArgs *subst
)
{
@@ -2506,9 +2514,11 @@ ApplyModifier_Defined(const char **pp, M
LazyBuf_Init(&buf, p);
while (!IsDelimiter(*p, ch) && *p != '\0') {
- /* XXX: This code is similar to the one in Var_Parse.
- * See if the code can be merged.
- * See also ApplyModifier_Match and ParseModifierPart. */
+ /*
+ * XXX: This code is similar to the one in Var_Parse. See if
+ * the code can be merged. See also ApplyModifier_Match and
+ * ParseModifierPart.
+ */
/* Escaped delimiter or other special character */
/* See Buf_AddEscaped in for.c. */
@@ -2716,7 +2726,7 @@ ApplyModifier_ShellCommand(const char **
else
Expr_SetValueRefer(expr, "");
if (errfmt != NULL)
- Error(errfmt, cmd.str); /* XXX: why still return AMR_OK? */
+ Error(errfmt, cmd.str); /* XXX: why still return AMR_OK? */
FStr_Done(&cmd);
Expr_Define(expr);
@@ -2765,7 +2775,9 @@ ApplyModifier_Range(const char **pp, Mod
for (i = 0; i < n; i++) {
if (i != 0) {
- /* XXX: Use ch->sep instead of ' ', for consistency. */
+ /*
+ * XXX: Use ch->sep instead of ' ', for consistency.
+ */
Buf_AddByte(&buf, ' ');
}
Buf_AddInt(&buf, 1 + (int)i);
@@ -3452,7 +3464,7 @@ ApplyModifier_IfElse(const char **pp, Mo
else_emode = expr->emode;
}
- (*pp)++; /* skip past the '?' */
+ (*pp)++; /* skip past the '?' */
res = ParseModifierPart(pp, ':', then_emode, ch, &thenBuf);
if (res != VPR_OK)
return AMR_CLEANUP;
@@ -3723,7 +3735,9 @@ ApplyModifier_SysV(const char **pp, ModC
if (res != VPR_OK)
return AMR_CLEANUP;
- /* The SysV modifier lasts until the end of the variable expression. */
+ /*
+ * The SysV modifier lasts until the end of the variable expression.
+ */
res = ParseModifierPart(pp, ch->endc, expr->emode, ch, &rhsBuf);
if (res != VPR_OK) {
LazyBuf_Done(&lhsBuf);
@@ -4098,7 +4112,7 @@ ApplyModifiers(
}
*pp = p;
- assert(Expr_Str(expr) != NULL); /* Use var_Error or varUndefined. */
+ assert(Expr_Str(expr) != NULL); /* Use var_Error or varUndefined. */
return;
bad_modifier:
@@ -4409,8 +4423,10 @@ ParseVarnameLong(
v = VarFindSubstring(name, scope, true);
- /* At this point, p points just after the variable name,
- * either at ':' or at endc. */
+ /*
+ * At this point, p points just after the variable name, either at
+ * ':' or at endc.
+ */
if (v == NULL && Substring_Equals(name, ".SUFFIXES")) {
char *suffixes = Suff_NamesStr();
@@ -4643,7 +4659,7 @@ Var_Parse(const char **pp, GNode *scope,
}
if (haveModifier) {
- p++; /* Skip initial colon. */
+ p++; /* Skip initial colon. */
ApplyModifiers(&expr, &p, startc, endc);
}
@@ -4726,10 +4742,12 @@ VarSubstExpr(const char **pp, Buffer *bu
p = nested_p;
*inout_errorReported = true;
} else {
- /* Copy the initial '$' of the undefined expression,
+ /*
+ * Copy the initial '$' of the undefined expression,
* thereby deferring expansion of the expression, but
- * expand nested expressions if already possible.
- * See unit-tests/varparse-undef-partial.mk. */
+ * expand nested expressions if already possible. See
+ * unit-tests/varparse-undef-partial.mk.
+ */
Buf_AddByte(buf, *p);
p++;
}
@@ -4776,8 +4794,10 @@ Var_Subst(const char *str, GNode *scope,
const char *p = str;
Buffer res;
- /* Set true if an error has already been reported,
- * to prevent a plethora of messages when recursing */
+ /*
+ * Set true if an error has already been reported, to prevent a
+ * plethora of messages when recursing
+ */
/* XXX: Why is the 'static' necessary here? */
static bool errorReported;