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 Nov 28 19:51:06 UTC 2021

Modified Files:
        src/usr.bin/make: arch.c compat.c dir.c job.c make.c make.h targ.c

Log Message:
make: convert GNodeFlags from enum into bit-fields

Now that Enum_ToString is implemented for each type separately, it's
easy to convert them to bit-fields.  This gets rid of the magic numbers
12 for CYCLE and 13 for DONECYCLE that left a suspicious gap in the
numbers.  This gap was not needed since the code didn't make use of the
relative ordering of the enum constants.

The effects of this conversion are fewer capital letters in the code,
smaller scope for the GNode flags, and clearer code especially when
setting a flag back to false.

One strange thing is that GCC 10.3.0 doesn't optimize GNodeFlags_IsNone
to an single bitmasking instruction, at least on x86_64.  Instead it
generates a testb instruction for each of the flags, even loading bit 8
separately from the others.  Clang 12.0.1 knows this optimization
though and generates the obvious sequence of movzwl, testl, jz.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/make/arch.c
cvs rdiff -u -r1.227 -r1.228 src/usr.bin/make/compat.c
cvs rdiff -u -r1.273 -r1.274 src/usr.bin/make/dir.c
cvs rdiff -u -r1.439 -r1.440 src/usr.bin/make/job.c
cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/make.c
cvs rdiff -u -r1.267 -r1.268 src/usr.bin/make/make.h
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/make/targ.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