58ad84b7ab
In strict bool mode, bool is considered incompatible with all other scalar types, just as in Java, C#, Pascal. The controlling expressions in if statements, while loops, for loops and the '?:' operator must be of type bool. The logical operators work on bool instead of int, the bitwise operators accept both integer and bool. The arithmetic operators don't accept bool. Since <stdbool.h> implements bool using C preprocessor macros instead of predefining the identifiers "true" and "false", the integer constants 0 and 1 may be used in all contexts that require a bool expression. Except from these, no implicit conversion between bool and scalar types is allowed. See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details. The command line option -T has been chosen because all obvious choices (-b or -B for bool, -s or -S for strict) are already in use. The -T may stand for "types are checked strictly". The default behavior of lint doesn't change. The strict bool check is purely optional. An example program for strict bool mode is usr.bin/make, which has been using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in most places for a long time now, even before the refactoring in 2020. |
||
---|---|---|
.. | ||
bin | ||
crypto | ||
dev | ||
fs | ||
games | ||
include | ||
ipf | ||
kernel | ||
lib | ||
libexec | ||
modules | ||
net | ||
rump | ||
sbin | ||
share | ||
sys | ||
usr.bin | ||
usr.sbin | ||
Makefile | ||
Makefile.inc | ||
README | ||
h_macros.h |
README
$NetBSD: README,v 1.4 2012/05/18 15:36:21 jruoho Exp $ When adding new tests, please try to follow the following conventions. 1. For library routines, including system calls, the directory structure of the tests should follow the directory structure of the real source tree. For instance, interfaces available via the C library should follow: src/lib/libc/gen -> src/tests/lib/libc/gen src/lib/libc/sys -> src/tests/lib/libc/sys ... 2. Equivalently, all tests for userland utilities should try to follow their location in the source tree. If this can not be satisfied, the tests for a utility should be located under the directory to which the utility is installed. Thus, a test for env(1) should go to src/tests/usr.bin/env. Likewise, a test for tcpdump(8) should be in src/tests/usr.sbin/tcpdump, even though the source code for the program is located under src/external. 3. Otherwise use your own discretion.