summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2021-01-10 21:20:46 +0000
committerrillig <rillig@NetBSD.org>2021-01-10 21:20:46 +0000
commite2f1e075b9ff265e598a2ee770a4dd6e1ef176b4 (patch)
tree89c026775e3c63d035b9e4ac4097a37c535148d2 /usr.bin/make
parent63d67c64a26461b24ecf7d3661c4845dd96784be (diff)
make(1): consistently use boolean expressions in conditions
Most of the make code already followed the style of explicitly writing (ptr != NULL) instead of the shorter (ptr) in conditions. The remaining 50 instances have been found by an experimental, unpublished check in lint(1) that treats bool expressions as incompatible to any other scalar type, just as in Java, C#, Pascal and several other languages. The only unsafe operation on Boolean that is left over is (flags & FLAG), for an enum implementing a bit set. If Boolean is an ordinary integer type (the default), some high bits may get lost. But if Boolean is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2 defines that a conversion from any scalar to the type _Bool acts as a comparison to 0, which cannot lose any bits.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/compat.c10
-rw-r--r--usr.bin/make/cond.c6
-rw-r--r--usr.bin/make/dir.c18
-rw-r--r--usr.bin/make/filemon/filemon_ktrace.c8
-rw-r--r--usr.bin/make/for.c6
-rw-r--r--usr.bin/make/job.c26
-rw-r--r--usr.bin/make/main.c6
-rw-r--r--usr.bin/make/make.c6
-rw-r--r--usr.bin/make/make.h4
-rw-r--r--usr.bin/make/meta.c29
-rw-r--r--usr.bin/make/metachar.h4
-rw-r--r--usr.bin/make/parse.c8
-rw-r--r--usr.bin/make/str.c6
-rw-r--r--usr.bin/make/suff.c6
-rw-r--r--usr.bin/make/var.c8
15 files changed, 77 insertions, 74 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index 893a64f0747..c077cc18419 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.218 2020/12/30 10:03:16 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.219 2021/01/10 21:20:46 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.218 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.219 2021/01/10 21:20:46 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -281,7 +281,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
errCheck = FALSE;
else if (*cmd == '+') {
doIt = TRUE;
- if (!shellName) /* we came here from jobs */
+ if (shellName == NULL) /* we came here from jobs */
Shell_Init();
} else
break;
@@ -326,7 +326,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
/* The following work for any of the builtin shell specs. */
int shargc = 0;
shargv[shargc++] = shellPath;
- if (errCheck && shellErrFlag)
+ if (errCheck && shellErrFlag != NULL)
shargv[shargc++] = shellErrFlag;
shargv[shargc++] = DEBUG(SHELL) ? "-xc" : "-c";
shargv[shargc++] = cmd;
@@ -707,7 +707,7 @@ Compat_Run(GNodeList *targs)
{
GNode *errorNode = NULL;
- if (!shellName)
+ if (shellName == NULL)
Shell_Init();
InitSignals();
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 82155168c4f..1a8aba637fe 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.234 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.235 2021/01/10 21:20:46 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.234 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.235 2021/01/10 21:20:46 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -171,7 +171,7 @@ static unsigned int cond_min_depth = 0; /* depth at makefile open */
*/
static Boolean lhsStrict;
-static int
+static Boolean
is_token(const char *str, const char *tok, size_t len)
{
return strncmp(str, tok, len) == 0 && !ch_isalpha(str[len]);
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 2636d625322..230b66b3baf 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.254 2020/12/30 10:03:16 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.255 2021/01/10 21:20:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -137,7 +137,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: dir.c,v 1.254 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.255 2021/01/10 21:20:46 rillig Exp $");
/*
* A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -1168,7 +1168,8 @@ Dir_FindFile(const char *name, SearchPath *path)
if ((file = DirLookupSubdir(dot, name)) != NULL)
return file;
}
- if (cur && (file = DirLookupSubdir(cur, name)) != NULL)
+ if (cur != NULL &&
+ (file = DirLookupSubdir(cur, name)) != NULL)
return file;
}
@@ -1186,12 +1187,13 @@ Dir_FindFile(const char *name, SearchPath *path)
}
if (seenDotLast) {
- if (dot && !checkedDot) {
+ if (dot != NULL && !checkedDot) {
checkedDot = TRUE;
if ((file = DirLookupSubdir(dot, name)) != NULL)
return file;
}
- if (cur && (file = DirLookupSubdir(cur, name)) != NULL)
+ if (cur != NULL &&
+ (file = DirLookupSubdir(cur, name)) != NULL)
return file;
}
@@ -1219,7 +1221,7 @@ Dir_FindFile(const char *name, SearchPath *path)
*/
DEBUG0(DIR, " Trying exact path matches...\n");
- if (!seenDotLast && cur &&
+ if (!seenDotLast && cur != NULL &&
((file = DirLookupAbs(cur, name, base)) != NULL)) {
if (file[0] == '\0') {
free(file);
@@ -1241,7 +1243,7 @@ Dir_FindFile(const char *name, SearchPath *path)
}
}
- if (seenDotLast && cur &&
+ if (seenDotLast && cur != NULL &&
((file = DirLookupAbs(cur, name, base)) != NULL)) {
if (file[0] == '\0') {
free(file);
@@ -1418,7 +1420,7 @@ ResolveFullName(GNode *gn)
fullName = ResolveMovedDepends(gn);
DEBUG2(DIR, "Found '%s' as '%s'\n",
- gn->name, fullName ? fullName : "(not found)");
+ gn->name, fullName != NULL ? fullName : "(not found)");
}
if (fullName == NULL)
diff --git a/usr.bin/make/filemon/filemon_ktrace.c b/usr.bin/make/filemon/filemon_ktrace.c
index 49ccdb32b59..1cca1b19725 100644
--- a/usr.bin/make/filemon/filemon_ktrace.c
+++ b/usr.bin/make/filemon/filemon_ktrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: filemon_ktrace.c,v 1.10 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: filemon_ktrace.c,v 1.11 2021/01/10 21:20:47 rillig Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -524,7 +524,7 @@ top: /* If the child has exited, nothing to do. */
if (nread == 0) {
if (feof(F->in))
return 0;
- assert(ferror(F->in));
+ assert(ferror(F->in) != 0);
/*
* If interrupted or would block, there may be
* more events. Otherwise fail.
@@ -619,7 +619,7 @@ show_paths(struct filemon *F, const struct filemon_state *S,
* Ignore it if it failed or yielded EJUSTRETURN (-2), or if
* we're not producing output.
*/
- if (ret->ktr_error && ret->ktr_error != -2)
+ if (ret->ktr_error != 0 && ret->ktr_error != -2)
return;
if (F->out == NULL)
return;
@@ -645,7 +645,7 @@ show_retval(struct filemon *F, const struct filemon_state *S,
* Ignore it if it failed or yielded EJUSTRETURN (-2), or if
* we're not producing output.
*/
- if (ret->ktr_error && ret->ktr_error != -2)
+ if (ret->ktr_error != 0 && ret->ktr_error != -2)
return;
if (F->out == NULL)
return;
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index bf83a40d848..af55179dee8 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.133 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: for.c,v 1.134 2021/01/10 21:20:46 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.133 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.134 2021/01/10 21:20:46 rillig Exp $");
static int forLevel = 0; /* Nesting level */
@@ -222,7 +222,7 @@ For_Eval(const char *line)
size_t nitems, nvars;
if ((nitems = f->items.len) > 0 &&
- nitems % (nvars = f->vars.len)) {
+ nitems % (nvars = f->vars.len) != 0) {
Parse_Error(PARSE_FATAL,
"Wrong number of words (%u) in .for "
"substitution list with %u variables",
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 617a46b1e19..fe46073b3b2 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.395 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: job.c,v 1.396 2021/01/10 21:20:46 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.395 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.396 2021/01/10 21:20:46 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -425,7 +425,7 @@ static Job **allJobs = NULL;
static nfds_t nJobs = 0;
static void watchfd(Job *);
static void clearfd(Job *);
-static int readyfd(Job *);
+static Boolean readyfd(Job *);
static char *targPrefix = NULL; /* To identify a job change in the output. */
static Job tokenWaitJob; /* token wait pseudo-job */
@@ -441,7 +441,7 @@ enum {
static sigset_t caught_signals; /* Set of signals we handle */
static void JobDoOutput(Job *, Boolean);
-static void JobInterrupt(int, int) MAKE_ATTR_DEAD;
+static void JobInterrupt(Boolean, int) MAKE_ATTR_DEAD;
static void JobRestartJobs(void);
static void JobSigReset(void);
@@ -952,7 +952,7 @@ JobPrintCommand(Job *job, ShellWriter *wr, StringListNode *ln, const char *ucmd)
* set up commands to run through it.
*/
- if (!shell->hasErrCtl && shell->runChkTmpl &&
+ if (!shell->hasErrCtl && shell->runChkTmpl != NULL &&
shell->runChkTmpl[0] != '\0') {
if (job->echo && cmdFlags.echo) {
ShellWriter_EchoOff(wr);
@@ -1544,11 +1544,11 @@ JobMakeArgv(Job *job, char **argv)
argc++;
}
} else {
- if (!job->ignerr && shell->errFlag) {
+ if (!job->ignerr && shell->errFlag != NULL) {
argv[argc] = UNCONST(shell->errFlag);
argc++;
}
- if (job->echo && shell->echoFlag) {
+ if (job->echo && shell->echoFlag != NULL) {
argv[argc] = UNCONST(shell->echoFlag);
argc++;
}
@@ -2090,7 +2090,7 @@ Job_CatchOutput(void)
return;
for (i = npseudojobs * nfds_per_job(); i < nJobs; i++) {
- if (!fds[i].revents)
+ if (fds[i].revents == 0)
continue;
job = allJobs[i];
if (job->status == JOB_ST_RUNNING)
@@ -2150,7 +2150,7 @@ Shell_Init(void)
if (shell->echoFlag == NULL)
shell->echoFlag = "";
if (shell->hasErrCtl && shell->errFlag[0] != '\0') {
- if (shellErrFlag &&
+ if (shellErrFlag != NULL &&
strcmp(shell->errFlag, &shellErrFlag[1]) != 0) {
free(shellErrFlag);
shellErrFlag = NULL;
@@ -2509,7 +2509,7 @@ Job_ParseShell(char *line)
Shell_Init();
}
- if (shell->echoOn && shell->echoOff)
+ if (shell->echoOn != NULL && shell->echoOff != NULL)
shell->hasEchoCtl = TRUE;
if (!shell->hasErrCtl) {
@@ -2539,7 +2539,7 @@ Job_ParseShell(char *line)
* signo signal received
*/
static void
-JobInterrupt(int runINTERRUPT, int signo)
+JobInterrupt(Boolean runINTERRUPT, int signo)
{
Job *job; /* job descriptor in that element */
GNode *interrupt; /* the node describing the .INTERRUPT target */
@@ -2750,7 +2750,7 @@ clearfd(Job *job)
job->inPollfd = NULL;
}
-static int
+static Boolean
readyfd(Job *job)
{
if (job->inPollfd == NULL)
@@ -2820,7 +2820,7 @@ Job_TokenReturn(void)
jobTokensRunning--;
if (jobTokensRunning < 0)
Punt("token botch");
- if (jobTokensRunning || JOB_TOKENS[aborting] != '+')
+ if (jobTokensRunning != 0 || JOB_TOKENS[aborting] != '+')
JobTokenAdd();
}
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index d40b1140f4b..373d47986f9 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.510 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: main.c,v 1.511 2021/01/10 21:20:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.510 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.511 2021/01/10 21:20:46 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -1774,7 +1774,7 @@ Cmd_Exec(const char *cmd, const char **errfmt)
*errfmt = NULL;
- if (!shellName)
+ if (shellName == NULL)
Shell_Init();
/*
* Set up arguments for shell
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index b58bb07bd6e..7745e038c81 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.233 2020/12/30 10:03:16 rillig Exp $ */
+/* $NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -103,7 +103,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.233 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked_seqno = 1;
@@ -418,7 +418,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
}
(void)Var_Subst(gn->uname, pgn, VARE_WANTRES, &gn->name);
/* TODO: handle errors */
- if (gn->uname && strcmp(gn->name, gn->uname) != 0) {
+ if (gn->uname != NULL && strcmp(gn->name, gn->uname) != 0) {
/* See if we have a target for this node. */
GNode *tgn = Targ_FindNode(gn->name);
if (tgn != NULL)
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 23590f62e20..02372118a0f 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.241 2020/12/30 10:03:16 rillig Exp $ */
+/* $NetBSD: make.h,v 1.242 2021/01/10 21:20:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -136,7 +136,7 @@
* A boolean type is defined as an integer, not an enum, for historic reasons.
* The only allowed values are the constants TRUE and FALSE (1 and 0).
*/
-#if defined(USE_C99_BOOLEAN)
+#if defined(lint) || defined(USE_C99_BOOLEAN)
#include <stdbool.h>
typedef bool Boolean;
#define FALSE false
diff --git a/usr.bin/make/meta.c b/usr.bin/make/meta.c
index 946d7d6c671..aaf7e492843 100644
--- a/usr.bin/make/meta.c
+++ b/usr.bin/make/meta.c
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.167 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.168 2021/01/10 21:20:46 rillig Exp $ */
/*
* Implement 'meta' mode.
@@ -124,7 +124,7 @@ meta_open_filemon(BuildMon *pbm)
pbm->mon_fd = -1;
pbm->filemon = NULL;
- if (!useFilemon || !pbm->mfp)
+ if (!useFilemon || pbm->mfp == NULL)
return;
pbm->filemon = filemon_open();
@@ -523,7 +523,7 @@ meta_create(BuildMon *pbm, GNode *gn)
fprintf(fp, "CWD %s\n", getcwd(buf, sizeof buf));
fprintf(fp, "TARGET %s\n", tname);
cp = GNode_VarOodate(gn);
- if (cp && *cp) {
+ if (cp != NULL && *cp != '\0') {
fprintf(fp, "OODATE %s\n", cp);
}
if (metaEnv) {
@@ -700,7 +700,7 @@ meta_job_child(Job *job)
}
if (pbm->mfp != NULL) {
close(fileno(pbm->mfp));
- if (useFilemon && pbm->filemon) {
+ if (useFilemon && pbm->filemon != NULL) {
pid_t pid;
pid = getpid();
@@ -723,7 +723,7 @@ meta_job_parent(Job *job, pid_t pid)
} else {
pbm = &Mybm;
}
- if (useFilemon && pbm->filemon) {
+ if (useFilemon && pbm->filemon != NULL) {
filemon_setpid_parent(pbm->filemon, pid);
}
#endif
@@ -740,7 +740,7 @@ meta_job_fd(Job *job)
} else {
pbm = &Mybm;
}
- if (useFilemon && pbm->filemon) {
+ if (useFilemon && pbm->filemon != NULL) {
return filemon_readfd(pbm->filemon);
}
#endif
@@ -758,7 +758,7 @@ meta_job_event(Job *job)
} else {
pbm = &Mybm;
}
- if (useFilemon && pbm->filemon) {
+ if (useFilemon && pbm->filemon != NULL) {
return filemon_process(pbm->filemon);
}
#endif
@@ -967,7 +967,7 @@ path_starts_with(const char *path, const char *prefix)
return path[n] == '\0' || path[n] == '/';
}
-static int
+static Boolean
meta_ignore(GNode *gn, const char *p)
{
char fname[MAXPATHLEN];
@@ -1037,7 +1037,7 @@ meta_ignore(GNode *gn, const char *p)
* if we detect this we want to reproduce it.
* Setting oodate TRUE will have that effect.
*/
-#define CHECK_VALID_META(p) if (!(p && *p)) { \
+#define CHECK_VALID_META(p) if (!(p != NULL && *p != '\0')) { \
warnx("%s: %d: malformed", fname, lineno); \
oodate = TRUE; \
continue; \
@@ -1436,7 +1436,7 @@ meta_oodate(GNode *gn, Boolean oodate)
}
sdirs[sdx++] = NULL;
- for (sdp = sdirs; *sdp && !found; sdp++) {
+ for (sdp = sdirs; *sdp != NULL && !found; sdp++) {
#ifdef DEBUG_META_MODE
DEBUG3(META, "%s: %d: looking for: %s\n",
fname, lineno, *sdp);
@@ -1579,7 +1579,8 @@ meta_oodate(GNode *gn, Boolean oodate)
const char *cp = NULL;
/* if target is in .CURDIR we do not need a meta file */
- if (gn->path && (cp = strrchr(gn->path, '/')) && cp > gn->path) {
+ if (gn->path != NULL && (cp = strrchr(gn->path, '/')) != NULL &&
+ (cp > gn->path)) {
if (strncmp(curdir, gn->path, (size_t)(cp - gn->path)) != 0) {
cp = NULL; /* not in .CURDIR */
}
@@ -1655,7 +1656,7 @@ meta_compat_parent(pid_t child)
close(childPipe[1]); /* child side */
outfd = childPipe[0];
#ifdef USE_FILEMON
- metafd = Mybm.filemon ? filemon_readfd(Mybm.filemon) : -1;
+ metafd = Mybm.filemon != NULL ? filemon_readfd(Mybm.filemon) : -1;
#else
metafd = -1;
#endif
@@ -1680,7 +1681,7 @@ meta_compat_parent(pid_t child)
err(1, "select");
}
- if (outfd != -1 && FD_ISSET(outfd, &readfds)) do {
+ if (outfd != -1 && FD_ISSET(outfd, &readfds) != 0) do {
/* XXX this is not line-buffered */
ssize_t nread = read(outfd, buf, sizeof buf - 1);
if (nread == -1)
@@ -1695,7 +1696,7 @@ meta_compat_parent(pid_t child)
buf[nread] = '\0';
meta_job_output(NULL, buf, "");
} while (/*CONSTCOND*/0);
- if (metafd != -1 && FD_ISSET(metafd, &readfds)) {
+ if (metafd != -1 && FD_ISSET(metafd, &readfds) != 0) {
if (meta_job_event(NULL) <= 0)
metafd = -1;
}
diff --git a/usr.bin/make/metachar.h b/usr.bin/make/metachar.h
index ced0648fa19..3c0780a31b8 100644
--- a/usr.bin/make/metachar.h
+++ b/usr.bin/make/metachar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: metachar.h,v 1.12 2020/11/10 00:32:12 rillig Exp $ */
+/* $NetBSD: metachar.h,v 1.13 2021/01/10 21:20:46 rillig Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
extern unsigned char _metachar[];
-#define is_shell_metachar(c) _metachar[(c) & 0x7f]
+#define is_shell_metachar(c) (_metachar[(c) & 0x7f] != 0)
MAKE_INLINE int
needshell(const char *cmd)
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 61597f679ee..9d41bc0b880 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.525 2020/12/31 17:39:36 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.526 2021/01/10 21:20:46 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.525 2020/12/31 17:39:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.526 2021/01/10 21:20:46 rillig Exp $");
/* types and constants */
@@ -2218,7 +2218,7 @@ ParseDoInclude(char *line /* XXX: bad name */)
endc = '"';
/* Skip to matching delimiter */
- for (cp = ++file; *cp && *cp != endc; cp++)
+ for (cp = ++file; *cp != '\0' && *cp != endc; cp++)
continue;
if (*cp != endc) {
@@ -2508,7 +2508,7 @@ ParseGmakeExport(char *line)
pp_skip_whitespace(&variable);
- for (value = variable; *value && *value != '='; value++)
+ for (value = variable; *value != '\0' && *value != '='; value++)
continue;
if (*value != '=') {
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index e65ffeece3a..e57a216c2ac 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.76 2020/12/30 10:03:16 rillig Exp $ */
+/* $NetBSD: str.c,v 1.77 2021/01/10 21:20:46 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
#include "make.h"
/* "@(#)str.c 5.8 (Berkeley) 6/1/90" */
-MAKE_RCSID("$NetBSD: str.c,v 1.76 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.77 2021/01/10 21:20:46 rillig Exp $");
/* Return the concatenation of s1 and s2, freshly allocated. */
char *
@@ -212,7 +212,7 @@ Str_Words(const char *str, Boolean expand)
words[words_len++] = word_start;
word_start = NULL;
if (ch == '\n' || ch == '\0') {
- if (expand && inquote) {
+ if (expand && inquote != '\0') {
free(words);
free(words_buf);
return (Words){ NULL, 0, NULL };
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index 82b689b3034..db9ad982ece 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.334 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.335 2021/01/10 21:20:46 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.334 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.335 2021/01/10 21:20:46 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -288,7 +288,7 @@ Suffix_Unassign(Suffix **var)
static const char *
StrTrimPrefix(const char *pref, const char *str)
{
- while (*str && *pref == *str) {
+ while (*str != '\0' && *pref == *str) {
pref++;
str++;
}
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 807ada64bb7..5e0692e4fe1 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.779 2021/01/09 16:06:09 rillig Exp $ */
+/* $NetBSD: var.c,v 1.780 2021/01/10 21:20:47 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.779 2021/01/09 16:06:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.780 2021/01/10 21:20:47 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@@ -347,7 +347,7 @@ CanonicalVarname(const char *name)
break;
case 'S':
if (strcmp(name, ".SHELL") == 0) {
- if (!shellPath)
+ if (shellPath == NULL)
Shell_Init();
}
break;
@@ -805,7 +805,7 @@ ClearEnv(void)
environ = savedEnv = newenv;
newenv[0] = NULL;
newenv[1] = NULL;
- if (cp && *cp)
+ if (cp != NULL && *cp != '\0')
setenv(MAKE_LEVEL_ENV, cp, 1);
}