Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/usr.bin/make



Module Name:    src
Committed By:   rillig
Date:           Sun Jan 10 21:20:47 UTC 2021

Modified Files:
        src/usr.bin/make: compat.c cond.c dir.c for.c job.c main.c make.c
            make.h meta.c metachar.h parse.c str.c suff.c var.c
        src/usr.bin/make/filemon: filemon_ktrace.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/usr.bin/make/compat.c
cvs rdiff -u -r1.234 -r1.235 src/usr.bin/make/cond.c
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/dir.c
cvs rdiff -u -r1.133 -r1.134 src/usr.bin/make/for.c
cvs rdiff -u -r1.395 -r1.396 src/usr.bin/make/job.c
cvs rdiff -u -r1.510 -r1.511 src/usr.bin/make/main.c
cvs rdiff -u -r1.233 -r1.234 src/usr.bin/make/make.c
cvs rdiff -u -r1.241 -r1.242 src/usr.bin/make/make.h
cvs rdiff -u -r1.167 -r1.168 src/usr.bin/make/meta.c
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/metachar.h
cvs rdiff -u -r1.525 -r1.526 src/usr.bin/make/parse.c
cvs rdiff -u -r1.76 -r1.77 src/usr.bin/make/str.c
cvs rdiff -u -r1.334 -r1.335 src/usr.bin/make/suff.c
cvs rdiff -u -r1.779 -r1.780 src/usr.bin/make/var.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/filemon/filemon_ktrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index