summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2020-08-29 07:52:55 +0000
committerrillig <rillig@NetBSD.org>2020-08-29 07:52:55 +0000
commit7aeb91f4d5bbdab0a353cfce09be487fa5c14d42 (patch)
treeab885da6179660feecb79aaeaa404853fab1bd2c /usr.bin
parentfa15de304968eec784657a94ea4cfe24b17c8395 (diff)
make(1): allow for strict type checking for Boolean
Having Boolean aliased to int creates ambiguities since int is widely used. Allow to occasionally compile make with -DUSE_DOUBLE_BOOLEAN to check that the type definitions still agree.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/main.c11
-rw-r--r--usr.bin/make/make.h6
-rw-r--r--usr.bin/make/nonints.h4
-rw-r--r--usr.bin/make/parse.c8
-rw-r--r--usr.bin/make/str.c8
-rw-r--r--usr.bin/make/var.c12
6 files changed, 30 insertions, 19 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index d624fef8353..96d6e3d014e 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.322 2020/08/29 07:13:17 rillig Exp $ */
+/* $NetBSD: main.c,v 1.323 2020/08/29 07:52:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.322 2020/08/29 07:13:17 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.323 2020/08/29 07:52:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.322 2020/08/29 07:13:17 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.323 2020/08/29 07:52:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -1399,8 +1399,9 @@ main(int argc, char **argv)
if (!compatMake)
Job_ServerStart(maxJobTokens, jp_0, jp_1);
if (DEBUG(JOB))
- fprintf(debug_file, "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n",
- jp_0, jp_1, maxJobs, maxJobTokens, compatMake);
+ fprintf(debug_file,
+ "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n",
+ jp_0, jp_1, maxJobs, maxJobTokens, compatMake ? 1 : 0);
if (!printVars)
Main_ExportMAKEFLAGS(TRUE); /* initial export */
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 3d57b1c452e..006ebb43ae4 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.129 2020/08/28 19:14:07 rillig Exp $ */
+/* $NetBSD: make.h,v 1.130 2020/08/29 07:52:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -133,7 +133,11 @@
* boolean argument to be an expression that isn't strictly 0 or 1 valued.
*/
+#ifdef USE_DOUBLE_BOOLEAN /* Just to find type mismatches. */
+typedef double Boolean;
+#else
typedef int Boolean;
+#endif
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h
index dae0eccb6af..94329621aac 100644
--- a/usr.bin/make/nonints.h
+++ b/usr.bin/make/nonints.h
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.99 2020/08/27 06:13:53 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.100 2020/08/29 07:52:55 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -82,7 +82,7 @@ void Arch_FindLib(GNode *, Lst);
Boolean Arch_LibOODate(GNode *);
void Arch_Init(void);
void Arch_End(void);
-int Arch_IsLib(GNode *);
+Boolean Arch_IsLib(GNode *);
/* compat.c */
int CompatRunCommand(void *, void *);
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index c61e19765c0..8db626917c9 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.268 2020/08/28 04:48:57 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.269 2020/08/29 07:52:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.268 2020/08/28 04:48:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.269 2020/08/29 07:52:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: parse.c,v 1.268 2020/08/28 04:48:57 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.269 2020/08/29 07:52:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -2541,7 +2541,7 @@ IsInclude(const char *line, Boolean sysv)
static const size_t inclen = sizeof(inc) - 1;
/* 'd' is not valid for sysv */
- int o = strchr(&("ds-"[sysv]), *line) != NULL;
+ int o = strchr(sysv ? "s-" : "ds-", *line) != NULL;
if (strncmp(line + o, inc, inclen) != 0)
return FALSE;
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index 85684d9fd67..1f407b54913 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.62 2020/08/23 18:26:35 rillig Exp $ */
+/* $NetBSD: str.c,v 1.63 2020/08/29 07:52:55 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: str.c,v 1.62 2020/08/23 18:26:35 rillig Exp $";
+static char rcsid[] = "$NetBSD: str.c,v 1.63 2020/08/29 07:52:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90";
#else
-__RCSID("$NetBSD: str.c,v 1.62 2020/08/23 18:26:35 rillig Exp $");
+__RCSID("$NetBSD: str.c,v 1.63 2020/08/29 07:52:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -383,7 +383,7 @@ Str_Match(const char *str, const char *pat)
*/
if (*pat == '[') {
Boolean neg = pat[1] == '^';
- pat += 1 + neg;
+ pat += neg ? 2 : 1;
for (;;) {
if (*pat == ']' || *pat == 0) {
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 6ec8af6f82f..49816d3802a 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.472 2020/08/25 21:16:53 rillig Exp $ */
+/* $NetBSD: var.c,v 1.473 2020/08/29 07:52:55 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.472 2020/08/25 21:16:53 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.473 2020/08/29 07:52:55 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.472 2020/08/25 21:16:53 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.473 2020/08/29 07:52:55 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -3409,6 +3409,12 @@ Var_Parse(const char * const str, GNode *ctxt, VarEvalFlags eflags,
extramodifiers = NULL; /* extra modifiers to apply first */
dynamic = FALSE;
+#ifdef USE_DOUBLE_BOOLEAN
+ /* Appease GCC 5.5.0, which thinks that the variable might not be
+ * initialized. */
+ endc = '\0';
+#endif
+
startc = str[1];
if (startc != PROPEN && startc != BROPEN) {
char name[2];