make(1): fix a few inconsistencies for lint's strict bool mode

This commit is contained in:
rillig 2021-01-16 20:49:31 +00:00
parent 6e842ae30a
commit e820145aad
6 changed files with 25 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.512 2021/01/10 23:59:53 rillig Exp $ */
/* $NetBSD: main.c,v 1.513 2021/01/16 20:49:31 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.512 2021/01/10 23:59:53 rillig Exp $");
MAKE_RCSID("$NetBSD: main.c,v 1.513 2021/01/16 20:49:31 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@ -2095,7 +2095,7 @@ shouldDieQuietly(GNode *gn, int bf)
else
quietly = (gn != NULL && (gn->type & OP_MAKE)) ? 1 : 0;
}
return quietly;
return quietly != 0;
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.c,v 1.234 2021/01/10 21:20:46 rillig Exp $ */
/* $NetBSD: make.c,v 1.235 2021/01/16 20:49:31 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.234 2021/01/10 21:20:46 rillig Exp $");
MAKE_RCSID("$NetBSD: make.c,v 1.235 2021/01/16 20:49:31 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked_seqno = 1;
@ -893,7 +893,7 @@ Make_DoAllVar(GNode *gn)
gn->flags |= DONE_ALLSRC;
}
static int
static Boolean
MakeBuildChild(GNode *cn, GNodeListNode *toBeMadeNext)
{
@ -903,13 +903,13 @@ MakeBuildChild(GNode *cn, GNodeListNode *toBeMadeNext)
GNode_FprintDetails(opts.debug_file, "", cn, "\n");
}
if (GNode_IsReady(cn))
return 0;
return FALSE;
/* 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 */
cn->made = DEFERRED;
return 0; /* but keep looking */
return FALSE; /* but keep looking */
}
DEBUG2(MAKE, "MakeBuildChild: schedule %s%s\n",
@ -925,7 +925,7 @@ MakeBuildChild(GNode *cn, GNodeListNode *toBeMadeNext)
ListNode *ln;
for (ln = cn->cohorts.first; ln != NULL; ln = ln->next)
if (MakeBuildChild(ln->datum, toBeMadeNext) != 0)
if (MakeBuildChild(ln->datum, toBeMadeNext))
break;
}
@ -943,7 +943,7 @@ MakeBuildParent(GNode *pn, GNodeListNode *toBeMadeNext)
if (pn->made != DEFERRED)
return 0;
if (MakeBuildChild(pn, toBeMadeNext) == 0) {
if (!MakeBuildChild(pn, toBeMadeNext)) {
/* When this node is built, reschedule its parents. */
pn->flags |= DONE_ORDER;
}
@ -958,7 +958,7 @@ MakeChildren(GNode *gn)
GNodeListNode *ln;
for (ln = gn->children.first; ln != NULL; ln = ln->next)
if (MakeBuildChild(ln->datum, toBeMadeNext) != 0)
if (MakeBuildChild(ln->datum, toBeMadeNext))
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.242 2021/01/10 21:20:46 rillig Exp $ */
/* $NetBSD: make.h,v 1.243 2021/01/16 20:49:31 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -590,7 +590,7 @@ void debug_printf(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);
do { \
if (DEBUG(module)) \
debug_printf args; \
} while (/*CONSTCOND*/ 0)
} while (/*CONSTCOND*/FALSE)
#define DEBUG0(module, text) \
DEBUG_IMPL(module, ("%s", text))

View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.168 2021/01/10 21:20:46 rillig Exp $ */
/* $NetBSD: meta.c,v 1.169 2021/01/16 20:49:31 rillig Exp $ */
/*
* Implement 'meta' mode.
@ -403,7 +403,7 @@ printCMDs(GNode *gn, FILE *fp)
} \
return FALSE; \
} \
} while (/*CONSTCOND*/0)
} while (/*CONSTCOND*/FALSE)
/*
@ -1695,7 +1695,7 @@ meta_compat_parent(pid_t child)
fflush(stdout);
buf[nread] = '\0';
meta_job_output(NULL, buf, "");
} while (/*CONSTCOND*/0);
} while (/*CONSTCOND*/FALSE);
if (metafd != -1 && FD_ISSET(metafd, &readfds) != 0) {
if (meta_job_event(NULL) <= 0)
metafd = -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: metachar.h,v 1.13 2021/01/10 21:20:46 rillig Exp $ */
/* $NetBSD: metachar.h,v 1.14 2021/01/16 20:49:31 rillig Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@ extern unsigned char _metachar[];
#define is_shell_metachar(c) (_metachar[(c) & 0x7f] != 0)
MAKE_INLINE int
MAKE_INLINE Boolean
needshell(const char *cmd)
{
while (!is_shell_metachar(*cmd) && *cmd != ':' && *cmd != '=')

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.781 2021/01/10 23:59:53 rillig Exp $ */
/* $NetBSD: var.c,v 1.782 2021/01/16 20:49:31 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.781 2021/01/10 23:59:53 rillig Exp $");
MAKE_RCSID("$NetBSD: var.c,v 1.782 2021/01/16 20:49:31 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@ -3650,7 +3650,12 @@ ApplyModifiers(
{
ApplyModifiersState st = {
startc, endc, v, ctxt, eflags,
#if defined(lint)
/* lint cannot parse C99 struct initializers yet. */
{ var_Error, NULL },
#else
FStr_InitRefer(var_Error), /* .newVal */
#endif
' ', /* .sep */
FALSE, /* .oneBigWord */
*exprFlags /* .exprFlags */