Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): allow for strict type checking for Boo...
details: https://anonhg.NetBSD.org/src/rev/a243a2dfa4b8
branches: trunk
changeset: 937945:a243a2dfa4b8
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 29 07:52:55 2020 +0000
description:
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:
usr.bin/make/main.c | 11 ++++++-----
usr.bin/make/make.h | 6 +++++-
usr.bin/make/nonints.h | 4 ++--
usr.bin/make/parse.c | 8 ++++----
usr.bin/make/str.c | 8 ++++----
usr.bin/make/var.c | 12 +++++++++---
6 files changed, 30 insertions(+), 19 deletions(-)
diffs (187 lines):
diff -r 8c9ad96c0b77 -r a243a2dfa4b8 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Aug 29 07:22:49 2020 +0000
+++ b/usr.bin/make/main.c Sat Aug 29 07:52:55 2020 +0000
@@ -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 @@
#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 @@
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 -r 8c9ad96c0b77 -r a243a2dfa4b8 usr.bin/make/make.h
--- a/usr.bin/make/make.h Sat Aug 29 07:22:49 2020 +0000
+++ b/usr.bin/make/make.h Sat Aug 29 07:52:55 2020 +0000
@@ -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 -r 8c9ad96c0b77 -r a243a2dfa4b8 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h Sat Aug 29 07:22:49 2020 +0000
+++ b/usr.bin/make/nonints.h Sat Aug 29 07:52:55 2020 +0000
@@ -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 @@
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 -r 8c9ad96c0b77 -r a243a2dfa4b8 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sat Aug 29 07:22:49 2020 +0000
+++ b/usr.bin/make/parse.c Sat Aug 29 07:52:55 2020 +0000
@@ -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 @@
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 -r 8c9ad96c0b77 -r a243a2dfa4b8 usr.bin/make/str.c
--- a/usr.bin/make/str.c Sat Aug 29 07:22:49 2020 +0000
+++ b/usr.bin/make/str.c Sat Aug 29 07:52:55 2020 +0000
@@ -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 @@
*/
if (*pat == '[') {
Boolean neg = pat[1] == '^';
- pat += 1 + neg;
+ pat += neg ? 2 : 1;
for (;;) {
if (*pat == ']' || *pat == 0) {
diff -r 8c9ad96c0b77 -r a243a2dfa4b8 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sat Aug 29 07:22:49 2020 +0000
+++ b/usr.bin/make/var.c Sat Aug 29 07:52:55 2020 +0000
@@ -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 @@
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];
Home |
Main Index |
Thread Index |
Old Index