Module Name:    src
Committed By:   rillig
Date:           Fri Oct 23 17:59:25 UTC 2020

Modified Files:
        src/usr.bin/make: make.h test-variants.sh

Log Message:
make(1): allow compilation with Boolean implemented as char


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/usr.bin/make/make.h
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/test-variants.sh

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/make.h
diff -u src/usr.bin/make/make.h:1.160 src/usr.bin/make/make.h:1.161
--- src/usr.bin/make/make.h:1.160	Mon Oct 19 23:43:55 2020
+++ src/usr.bin/make/make.h	Fri Oct 23 17:59:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.160 2020/10/19 23:43:55 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.161 2020/10/23 17:59:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -144,6 +144,12 @@ typedef double Boolean;
 typedef unsigned char Boolean;
 #define TRUE ((unsigned char)0xFF)
 #define FALSE ((unsigned char)0x00)
+#elif defined(USE_CHAR_BOOLEAN)
+/* During development, to find code that uses a boolean as array index, via
+ * -Wchar-subscripts. */
+typedef char Boolean;
+#define TRUE ((char)-1)
+#define FALSE ((char)0x00)
 #elif defined(USE_ENUM_BOOLEAN)
 typedef enum Boolean { FALSE, TRUE } Boolean;
 #else

Index: src/usr.bin/make/test-variants.sh
diff -u src/usr.bin/make/test-variants.sh:1.4 src/usr.bin/make/test-variants.sh:1.5
--- src/usr.bin/make/test-variants.sh:1.4	Mon Sep 21 04:20:35 2020
+++ src/usr.bin/make/test-variants.sh	Fri Oct 23 17:59:25 2020
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: test-variants.sh,v 1.4 2020/09/21 04:20:35 rillig Exp $
+# $NetBSD: test-variants.sh,v 1.5 2020/10/23 17:59:25 rillig Exp $
 #
 # Build several variants of make and run the tests on them.
 #
@@ -43,6 +43,10 @@ testcase USER_CPPFLAGS="-DUSE_DOUBLE_BOO
 #
 testcase USER_CPPFLAGS="-DUSE_UCHAR_BOOLEAN"
 
+# Ensure that variables of type Boolean are not used as array index.
+#
+testcase USER_CPPFLAGS="-DUSE_CHAR_BOOLEAN"
+
 # Try a different compiler, with slightly different warnings and error
 # messages.  One feature that is missing from GCC is a little stricter
 # checks for enums.

Reply via email to