diff options
| author | rillig <rillig@NetBSD.org> | 2021-01-10 21:20:46 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2021-01-10 21:20:46 +0000 |
| commit | e2f1e075b9ff265e598a2ee770a4dd6e1ef176b4 (patch) | |
| tree | 89c026775e3c63d035b9e4ac4097a37c535148d2 /usr.bin/make/make.h | |
| parent | 63d67c64a26461b24ecf7d3661c4845dd96784be (diff) | |
make(1): consistently use boolean expressions in conditions
Most of the make code already followed the style of explicitly writing
(ptr != NULL) instead of the shorter (ptr) in conditions.
The remaining 50 instances have been found by an experimental,
unpublished check in lint(1) that treats bool expressions as
incompatible to any other scalar type, just as in Java, C#, Pascal and
several other languages.
The only unsafe operation on Boolean that is left over is (flags &
FLAG), for an enum implementing a bit set. If Boolean is an ordinary
integer type (the default), some high bits may get lost. But if Boolean
is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2
defines that a conversion from any scalar to the type _Bool acts as a
comparison to 0, which cannot lose any bits.
Diffstat (limited to 'usr.bin/make/make.h')
| -rw-r--r-- | usr.bin/make/make.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 23590f62e20..02372118a0f 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.241 2020/12/30 10:03:16 rillig Exp $ */ +/* $NetBSD: make.h,v 1.242 2021/01/10 21:20:46 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -136,7 +136,7 @@ * A boolean type is defined as an integer, not an enum, for historic reasons. * The only allowed values are the constants TRUE and FALSE (1 and 0). */ -#if defined(USE_C99_BOOLEAN) +#if defined(lint) || defined(USE_C99_BOOLEAN) #include <stdbool.h> typedef bool Boolean; #define FALSE false |
