diff options
| author | rillig <rillig@NetBSD.org> | 2020-10-23 17:59:25 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2020-10-23 17:59:25 +0000 |
| commit | 2ceb00fb760e8af33a26ef3d7c6f85fcd17f12c6 (patch) | |
| tree | e7392cf471076295348d7e12b1a3cf046b7edc04 /usr.bin/make | |
| parent | d3f41369e15bde0734cff87188e4d9a659dd8b0a (diff) | |
make(1): allow compilation with Boolean implemented as char
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/make.h | 8 | ||||
| -rw-r--r-- | usr.bin/make/test-variants.sh | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index ca470d1c9c4..fff88a47a13 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -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 diff --git a/usr.bin/make/test-variants.sh b/usr.bin/make/test-variants.sh index 4054f25caec..ea75372efa5 100644 --- a/usr.bin/make/test-variants.sh +++ b/usr.bin/make/test-variants.sh @@ -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_BOOLEAN" # 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. |
