The NetBSD Project

CVS log for src/usr.bin/make/Attic/enum.h

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / make

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.20, Sun Nov 28 18:58:58 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.19: +1 -1 lines
FILE REMOVED

make: replace bloated bit-set-to-string code with simple code

It was a nice idea to implement a bit-set using an enum type and have a
generic ToString function for them.  In the end, the implementation
involved really heavy preprocessor magic and was probably difficult to
understand.  Replace all the code with a few bits of straight-forward
preprocessor magic that can be readily understood by just looking 5
lines around, instead of digging through 130 lines of lengthy macro
definitions.

Curiously, this reduces the binary size even though the 3 ToString
functions now have a few lines of duplicate code and there are more
explicit function calls.

The ToString functions are only seldom used, so the additional memory
allocation is acceptable.

No functional change.

Revision 1.19 / (download) - annotate - [select for diffs], Mon Mar 15 16:00:05 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.18: +1 -61 lines
Diff to previous 1.18 (colored)

make: clean up header for runtime type information for enums

An enum with 32 bits would lead to signed integer overflow anyway, so
that definition is not worth keeping even if it works on typical
2-complement platforms.

The definitions for 2, 4 and 8 enum have been unused for several months
now.

No functional change.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Feb 2 21:26:51 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.17: +5 -5 lines
Diff to previous 1.17 (colored)

make: remove unused INTERNAL flag

It had been used for cached_realpaths, until this variable had its type
changed from GNode to HashTable in main.c 1.469 from 2020-11-14.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Feb 2 17:56:31 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.16: +3 -19 lines
Diff to previous 1.16 (colored)

make: remove overengineered Enum_ValueToString

For printing the status of a GNode, there was already made_name (now
renamed to GNodeMade_Name), which prints user-friendly text instead of
the bare enum constant names.

To do this change confidently, I first had to demonstrate that the
output really affects something other than just the word "UNMADE". There
had not been a test for that case before, and the test immediately
discovered a bug in the -dg2 and -dg3 options.  This bug is one of the
oldest in make, dating back to at least 1993.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jan 30 15:53:55 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

make(1): fix lint warning about empty declarations

Revision 1.15 / (download) - annotate - [select for diffs], Sat Jan 30 15:48:42 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.14: +12 -3 lines
Diff to previous 1.14 (colored)

make(1): reduce boilerplate for printing bit sets in debug mode

No functional change.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Dec 30 10:03:16 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.13: +41 -21 lines
Diff to previous 1.13 (colored)

make(1): format multi-line comments

Revision 1.13 / (download) - annotate - [select for diffs], Mon Dec 28 00:46:24 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.12: +12 -1 lines
Diff to previous 1.12 (colored)

make(1): replace global preserveUndefined with VARE_KEEP_UNDEF

Controlling the expansion of variable expressions using a global
variable and a VARE flag was inconsistent.

Converting the global variable into a flag had to prerequisites:

1.  The unintended duplicate variable assignment had to be fixed, as
done in parse.c 1.520 from 2020-12-27.  Without this fix, it would have
been necessary to add more flags to Var_Exists and Var_SetWithFlags, and
this would have become too complex.

2.  There had to be a unit test demonstrating that VARE_KEEP_DOLLAR only
applies to the top-level expression and is not passed to the
subexpressions, while VARE_KEEP_UNDEF applies to all subexpressions as
well.  This test is in var-op-expand.mk 1.10 from 2020-12-28, at least
for the ':@word@' modifier.  In ParseModifierPartSubst, VARE_KEEP_UNDEF
is not passed down either, in the same way.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Sep 25 15:54:50 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

make(1): add tags to some of the unnamed structs

The tags prevent the structs from accidentally becoming compatible
types.

While here, remove a few typedefs for structs that are single-purpose,
since there is no point in abstracting from the actual representation of
these types.

Revision 1.11 / (download) - annotate - [select for diffs], Tue Sep 22 06:13:38 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.10: +23 -1 lines
Diff to previous 1.10 (colored)

make(1): move VAR_JUNK and VAR_KEEP away from VarFlags

These two flags have nothing to do with a variable.  They are only used
while evaluating a variable expression.

While here, rename the flags and make their documentation more precise.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Sep 12 14:41:00 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.9: +10 -10 lines
Diff to previous 1.9 (colored)

make(1): fix inconsistent code indentation

Revision 1.9 / (download) - annotate - [select for diffs], Tue Sep 1 20:34:51 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.8: +2 -4 lines
Diff to previous 1.8 (colored)

make(1): improve documentation for enum.c and enum.h

Revision 1.8 / (download) - annotate - [select for diffs], Tue Aug 25 16:27:24 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.7: +125 -65 lines
Diff to previous 1.7 (colored)

make(1): distinguish enum flags and values in debugging mode

When printing an enum value in debugging mode, distinguish between
bitsets containing flags and ordinary enums that just contain different
values.

Make the macros in enum.h more uniform.  Provide a simple scheme for
defining the run-time type information of enums whose number of values
is a number with more than 2 bits set in the binary representation.
This case was not obvious before, and it was pure luck that the current
interesting enum types only had 3, 10 or 32 different values.

The type with the 32 different values actually only has 31 significant
bits since the enum constant OP_OPMASK is only used when querying the
enum, not for defining or describing the possible values.  For this
reason, it was unavoidable to refactor the rtti macros, to support even
this case.

Revision 1.7 / (download) - annotate - [select for diffs], Mon Aug 24 20:15:51 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.6: +72 -35 lines
Diff to previous 1.6 (colored)

make(1): in debug mode, print GNode details in symbols

A string like OP_DEPENDS|OP_OPTIONAL|OP_PRECIOUS is much easier to read
and understand than the bit pattern 00000089.

The implementation in enum.h looks really bloated and ugly, but using
this API is as simple and natural as possible.  That's the trade-off.

In enum.h, I thought about choosing the numbers in the macros such that
it is always possible to combine two of them in order to reach an
arbitrary number, because of the "part1, part2" in the ENUM__SPEC macro.
The powers of 2 are not these numbers, as 7 cannot be expressed as the
sum of two of them.  Neither are the fibonacci numbers since 12 cannot
be expressed as the sum of 2 fibonacci numbers.  I tried to find a
general pattern to generate these minimal 2-sum numbers, but failed.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Aug 23 09:28:52 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.5: +8 -5 lines
Diff to previous 1.5 (colored)

make(1): fix assertion failure in debug output for read-only variables

Revision 1.5 / (download) - annotate - [select for diffs], Sun Aug 9 09:44:14 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored)

make(1): clean up indentation, includes, add documentation

Revision 1.4 / (download) - annotate - [select for diffs], Sun Aug 9 07:03:06 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.3: +3 -5 lines
Diff to previous 1.3 (colored)

make(1): use fixed-size arrays for Enum_ToString

Declaring the ToStringSize as "static const size_t" made it an ordinary
integer expression.  To avoid variable length arrays, the commonly
accepted way is to declare the length as an enum constant, as that is
considered an integer constant expression, which in turn makes the
declaration a fixed-size array.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Aug 9 02:53:21 2020 UTC (3 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.2: +4 -2 lines
Diff to previous 1.2 (colored)

Fix build; gcc does not like VLA's, so hard code the boundary
Use c99 initializers

Revision 1.2 / (download) - annotate - [select for diffs], Sat Aug 8 14:43:28 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.1: +93 -93 lines
Diff to previous 1.1 (colored)

make(1): fix CRLF line endings in newly added files

Revision 1.1 / (download) - annotate - [select for diffs], Sat Aug 8 13:50:23 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN

make(1): add more detailed debug logging for variable modifiers

Before a modifier is applied to a variable, it is not yet parsed,
therefore it is only possible to log a rough estimate of the modifier.
But after applying it, the parsing position has advanced, and the full
modifier can be logged.

In addition, to fully understand how the modifiers work, it's not enough
to just know the variable names and values, there are also some flags
that influence how the modifiers behave.  The most influential is
VARE_WANTRES.

Thanks to sjg for the extensive review and valuable feedback on the
first drafts.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>