The NetBSD Project

CVS log for src/usr.bin/make/lst.c

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.106 / (download) - annotate - [select for diffs], Sat Feb 26 11:57:21 2022 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.105: +4 -2 lines
Diff to previous 1.105 (colored)

make: fix memory leak in Lst_Remove (since 2020-10-23)

The code to free the list node (as opposed to the node data) was
accidentally removed in lst.c 1.83 from 2020-10-23 as part of cleaning
up an unnecessarily complicated function for traversing linked lists.

The memory leak only affected a few lists that actually used Lst_Remove.
Most lists are append-only and are freed using Lst_Done or Lst_Free at
the end, which correctly free the memory.

Revision 1.105 / (download) - annotate - [select for diffs], Mon Mar 15 16:45:30 2021 UTC (22 months, 3 weeks 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.104: +7 -3 lines
Diff to previous 1.104 (colored)

make: fix documentation of Lst_MoveAll

In CLEANUP mode, was originally meant to track memory allocations but is
useful during debugging as well, initialize the list.  There is no
distinct constant representing an invalid pointer, otherwise that would
have been an even better choice.

Revision 1.104 / (download) - annotate - [select for diffs], Mon Feb 1 19:39:31 2021 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.103: +3 -3 lines
Diff to previous 1.103 (colored)

make: clean up comments

Revision 1.103 / (download) - annotate - [select for diffs], Mon Feb 1 18:55:15 2021 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.102: +2 -13 lines
Diff to previous 1.102 (colored)

make: remove unused Lst_Destroy

The code in job.c that seemed to use it is inside an '#if 0' block.

Revision 1.102 / (download) - annotate - [select for diffs], Wed Dec 30 10:03:16 2020 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.101: +30 -16 lines
Diff to previous 1.101 (colored)

make(1): format multi-line comments

Revision 1.101 / (download) - annotate - [select for diffs], Sun Dec 13 20:57:17 2020 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.100: +7 -7 lines
Diff to previous 1.100 (colored)

make(1): rename Vector.priv_cap to cap

There is no use case for accessing or even modifying the capacity of a
vector, therefore there is no need to hide it using the prefix "priv_".
This way, the member names are aligned between Buffer and Vector.

Revision 1.100 / (download) - annotate - [select for diffs], Fri Dec 4 20:11:48 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.99: +2 -13 lines
Diff to previous 1.99 (colored)

make(1): inline Lst_Enqueue

Revision 1.99 / (download) - annotate - [select for diffs], Fri Dec 4 20:08:07 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.98: +2 -8 lines
Diff to previous 1.98 (colored)

make(1): inline Vector_Done

Revision 1.98 / (download) - annotate - [select for diffs], Fri Dec 4 14:39:56 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.97: +8 -8 lines
Diff to previous 1.97 (colored)

make(1): use consistent variable names for list nodes

Revision 1.97 / (download) - annotate - [select for diffs], Sun Nov 29 00:54:43 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.96: +3 -4 lines
Diff to previous 1.96 (colored)

make(1): reduce memory allocation in suffix handling

The function Lst_MoveAll previously freed the source list.  This
function was only used in a few places, and none of them really needed
the allocation.

Revision 1.96 / (download) - annotate - [select for diffs], Sat Nov 28 19:26:10 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.95: +15 -10 lines
Diff to previous 1.95 (colored)

make(1): reduce pointer indirection for archives

Revision 1.95 / (download) - annotate - [select for diffs], Sat Nov 28 18:55:52 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.94: +11 -8 lines
Diff to previous 1.94 (colored)

make(1): remove pointer indirection from GNode.commands

Just to save a few memory allocations.  No noticeable effect on the
performance though.

Revision 1.94 / (download) - annotate - [select for diffs], Fri Nov 27 08:07:26 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.93: +2 -16 lines
Diff to previous 1.93 (colored)

make(1): inline Lst_ForEachUntil in meta mode

This means no more unnecessary void pointers in function signatures and
no more abstraction level at checking a single element of a list.  In
most cases it is more appropriate to define a function that operates on
the list as a whole, thereby hiding implementation details like the
ListNode from the caller.

Revision 1.93 / (download) - annotate - [select for diffs], Tue Nov 24 19:46:29 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.92: +119 -115 lines
Diff to previous 1.92 (colored)

make(1): indent list functions with tabs instead of spaces

Revision 1.92 / (download) - annotate - [select for diffs], Sun Nov 8 01:29:26 2020 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.91: +68 -76 lines
Diff to previous 1.91 (colored)

make(1): rename list node to ln

That's the name that is used for list nodes outside lst.c, and there is
no reason to use a different name in the implementation of lists.  Sure,
the "l" of the name "ln" is redundant, but it's still shorter than
"node", and the latter sounds too similar to GNode.

Revision 1.91 / (download) - annotate - [select for diffs], Wed Oct 28 02:43:16 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.90: +2 -11 lines
Diff to previous 1.90 (colored)

make(1): inline Vector_Get

It is simple enough that it neither bloats the code nor warrants the
extra function call.

Revision 1.90 / (download) - annotate - [select for diffs], Sun Oct 25 13:06:12 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.89: +27 -22 lines
Diff to previous 1.89 (colored)

make(1): replace PtrVector with Vector, which can contain any type

Revision 1.89 / (download) - annotate - [select for diffs], Sun Oct 25 12:08:53 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.88: +7 -7 lines
Diff to previous 1.88 (colored)

make(1): rename type Vector to PtrVector

This allows the name Vector to be used for a more generic vector type,
which will be added soon.

Revision 1.88 / (download) - annotate - [select for diffs], Sun Oct 25 10:07:23 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.87: +2 -21 lines
Diff to previous 1.87 (colored)

make(1): inline Lst_Copy in Make_ExpandUse

Revision 1.87 / (download) - annotate - [select for diffs], Sat Oct 24 10:36:23 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.86: +2 -31 lines
Diff to previous 1.86 (colored)

make(1): remove unused Lst_Find and Lst_FindFrom

Revision 1.86 / (download) - annotate - [select for diffs], Sat Oct 24 10:18:29 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.85: +4 -5 lines
Diff to previous 1.85 (colored)

make(1): clean up comments in list functions

Revision 1.85 / (download) - annotate - [select for diffs], Sat Oct 24 09:03:54 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.84: +18 -38 lines
Diff to previous 1.84 (colored)

make(1): clean up code in lst.c

Revision 1.84 / (download) - annotate - [select for diffs], Sat Oct 24 08:56:27 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.83: +8 -16 lines
Diff to previous 1.83 (colored)

make(1): refactor LstNodeNew

Revision 1.83 / (download) - annotate - [select for diffs], Fri Oct 23 04:58:33 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.82: +2 -65 lines
Diff to previous 1.82 (colored)

make(1): remove Lst_ForEachUntilConcurrent

The remaining callers of that function don't modify the list
structurally and thus can use the simpler Lst_ForEachUntil instead.

Revision 1.82 / (download) - annotate - [select for diffs], Thu Oct 22 21:27:24 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.81: +20 -3 lines
Diff to previous 1.81 (colored)

make(1): add Lst_ForEachUntilConcurrent

Previously, Lst_ForEachUntil allowed the list to be modified while
iterating.  Almost none of the code needs this, and it's also confusing
for human readers.

None of the current unit tests makes use of this concurrent modification
right now, but that's not evidence enough.  Only 72% of the code are
covered by unit tests right now, and there are lots of edge cases
(whether intended or not) that are not covered by unit tests.

Therefore, all calls to Lst_ForEachUntil were changed to
Lst_ForEachUntilConcurrent and those that were obvious were changed
back.  The remaining calls probably don't need the concurrent
modification code, but that's not obvious from looking at the code.

Revision 1.81 / (download) - annotate - [select for diffs], Thu Oct 22 20:18:20 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.80: +2 -83 lines
Diff to previous 1.80 (colored)

make(1): remove Lst_Open, Lst_Next, Lst_Close

These functions had made the Lst data type more complicated and hard to
understand than necessary.  This additional complexity was not needed in
the vast majority of the cases.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Oct 22 19:14:06 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.79: +6 -18 lines
Diff to previous 1.79 (colored)

make(1): remove code for circular lists from Lst_Next

Since make does not use circular lists, they have been removed from the
list library a few weeks ago.

Revision 1.79 / (download) - annotate - [select for diffs], Mon Oct 19 21:57:37 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.78: +3 -3 lines
Diff to previous 1.78 (colored)

make(1): inline simple Lst getters

The function call variant takes more screen space than the direct field
access.  Having an abstract API is usually a good idea, in this case of
simple read-only member access it makes the code more difficult to read.

LstNode_Set has been kept as a function since it is not a read-only
accessor function.

Revision 1.78 / (download) - annotate - [select for diffs], Mon Oct 19 21:41:31 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.77: +2 -10 lines
Diff to previous 1.77 (colored)

make(1): remove unused Lst_ForEach

All of its uses have been inlined since iterating through a linked list
is trivial.  This avoids the cumbersome callback functions with void
pointer parameters, allowing the compiler to perform better type checks.

Revision 1.77 / (download) - annotate - [select for diffs], Sun Oct 18 13:02:10 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.76: +4 -4 lines
Diff to previous 1.76 (colored)

make(1): rename Lst_Init to Lst_New

For the other types such as HashTable and Buffer, the Init function does
not allocate the memory for the structure itself, it only fills it.

Revision 1.76 / (download) - annotate - [select for diffs], Sun Oct 18 08:58:29 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.75: +22 -22 lines
Diff to previous 1.75 (colored)

make(1): rename Stack to Vector

Both Var_Dump and GetActuallyIncludingFile access more than only the top
item of the stack, therefore it is more honest to rename the data type.

Revision 1.75 / (download) - annotate - [select for diffs], Sat Oct 17 17:47:14 2020 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.74: +3 -3 lines
Diff to previous 1.74 (colored)

make(1): fix indentation

Revision 1.74 / (download) - annotate - [select for diffs], Wed Sep 30 06:27:02 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.73: +7 -35 lines
Diff to previous 1.73 (colored)

make(1): remove redundant assertions in lst.c

These pointers are dereferenced shortly after the assertion, which
reliably leads to a SIGSEGV.

Revision 1.73 / (download) - annotate - [select for diffs], Sun Sep 27 21:35:16 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

make(1): normalize whitespace in source code

There is no more space tab.  Either only tabs or only spaces or tabs
followed by spaces, but not spaces followed by tabs.

Revision 1.72 / (download) - annotate - [select for diffs], Sat Sep 26 17:15:20 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.71: +3 -4 lines
Diff to previous 1.71 (colored)

make(1): inline and remove LstNode_Prev and LstNode_Next

These functions made the code larger than necessary.  The prev and next
fields are published intentionally since navigating in a doubly-linked
list is simple to do and there is no need to wrap this in a layer of
function calls, not even syntactically.  (On the execution level, the
function calls had been inlined anyway.)

Revision 1.71 / (download) - annotate - [select for diffs], Fri Sep 25 04:18:11 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.70: +2 -4 lines
Diff to previous 1.70 (colored)

make(1): fix build on Debian 9

lst.h:92:5: error: unknown type name 'uint8_t'

It had been broken since the previous commit on 2020-09-24 08:23:29.

Revision 1.70 / (download) - annotate - [select for diffs], Thu Sep 24 08:23:29 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.69: +33 -120 lines
Diff to previous 1.69 (colored)

make(1): make the API of the List partially public

Accessing the fields List.first, List.last, ListNode.prev, ListNode.next
and ListNode.datum in read-only mode should be more efficient than a
whole function call.

All modifications to the lists or their nodes must still happen via
function calls.

This change reduces the code size, makes the code faster to execute and
allows Lst_ForEach to be written inline without the visual overhead of
function calls.

Revision 1.69 / (download) - annotate - [select for diffs], Thu Sep 24 07:32:03 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.68: +10 -2 lines
Diff to previous 1.68 (colored)

make(1): move documentation for MakeAddAllSrc to its correct place

Revision 1.68 / (download) - annotate - [select for diffs], Thu Sep 24 07:23:26 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.67: +10 -29 lines
Diff to previous 1.67 (colored)

make(1): merge Lst_ForEachFrom into Lst_ForEachUntil

Revision 1.67 / (download) - annotate - [select for diffs], Thu Sep 24 07:11:29 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.66: +5 -5 lines
Diff to previous 1.66 (colored)

make(1): rename Lst_ForEach to Lst_ForEachUntil

Since the callback function returns a terminating condition, this is not
really a foreach loop.

Many of the calls to Lst_ForEachUntil don't make use of the terminating
condition, and several don't modify the list structurally, which means
they don't need this complicated implementation.

In a follow-up commit, Lst_ForEach will be added back with a much
simpler implementation that iterates over the list naively, without a
terminating condition and without taking the iteration state from
Lst_Open/Lst_Next/Lst_Close into account.  The migration to this simpler
implementation will be done step by step since each callback function
needs to be examined closely.

Revision 1.66 / (download) - annotate - [select for diffs], Thu Sep 24 06:45:59 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.65: +4 -2 lines
Diff to previous 1.65 (colored)

make(1): refactor add_wait_dep to not use Lst_ForEachFrom anymore

It was the last remaining use of that function outside of lst.c.

While here, clean up the code of add_wait_dep by removing unreachable
code (the GNode lists never contain NULL, only the GNode.commands lists
do that).

Revision 1.65 / (download) - annotate - [select for diffs], Tue Sep 22 04:05:41 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.64: +64 -64 lines
Diff to previous 1.64 (colored)

make(1): use fine-grained type names for lists and their nodes

This is only intended to help the human reader.  There is no additional
type safety yet.

Revision 1.64 / (download) - annotate - [select for diffs], Mon Sep 14 19:14:19 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.63: +9 -3 lines
Diff to previous 1.63 (colored)

make(1): in debug mode, reset unused stack space to NULL

Revision 1.63 / (download) - annotate - [select for diffs], Sun Sep 13 15:15:51 2020 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.62: +2 -9 lines
Diff to previous 1.62 (colored)

make(1): clean up RCSID blocks

These blocks mostly consisted of redundant structure, following the same
#ifndef pattern over and over, with only minimal variation.

It's easier to maintain if the common structure is only written once and
encapsulated in a macro.

To avoid "defined but unused" warnings from GCC in the case where
MAKE_NATIVE is not defined, I had to add volatile.  Adding
MAKE_ATTR_UNUSED alone would not preserve the rcsid variable in the
resulting binary.

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

make(1): fix inconsistent code indentation

Revision 1.61 / (download) - annotate - [select for diffs], Fri Sep 4 17:59:36 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.60: +39 -3 lines
Diff to previous 1.60 (colored)

make(1): use a stack instead of a list for the nested include path

By using a Stack instead of a Lst, the available API is reduced to the
very few functions that are really needed for a stack.  This prevents
accidental misuse (such as confusing Lst_Append with Lst_Prepend) and
clearly communicates what the expected behavior is.

A stack also needs fewer calls to bmake_malloc than an equally-sized
list, and the memory is contiguous.  For the nested include path, all
this doesn't matter, but the type is so generic that it may be used in
other places as well.

Revision 1.60 / (download) - annotate - [select for diffs], Mon Aug 31 05:56:02 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.59: +4 -9 lines
Diff to previous 1.59 (colored)

make(1): fix unbalanced Lst_Open/Lst_Close in SuffFindCmds

This bug had been there since the initial import of make, on 1993-03-21.
It just never broke the build because of the missing assertion.

https://mail-index.netbsd.org/tech-toolchain/2020/08/30/msg003847.html

The error message "cd: can't cd to include" that I got when I first
applied the fix was unrelated.  It was caused by an extra directory
"include" in src/tools/compat that didn't belong there.  With that
directory removed, running "./build.sh -j8 tools" succeeds as expected.

Revision 1.59 / (download) - annotate - [select for diffs], Sun Aug 30 21:20:06 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.58: +5 -5 lines
Diff to previous 1.58 (colored)

make(1): fix comment for Lst_Destroy

Revision 1.58 / (download) - annotate - [select for diffs], Sun Aug 30 11:15:05 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.57: +4 -4 lines
Diff to previous 1.57 (colored)

make(1): rename Lst_Datum to LstNode_Datum

Revision 1.57 / (download) - annotate - [select for diffs], Sun Aug 30 11:12:05 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.56: +4 -4 lines
Diff to previous 1.56 (colored)

make(1): rename Lst_Memeber to Lst_FindDatum

The new name nicely aligns with Lst_Find and Lst_FindFrom.

Revision 1.56 / (download) - annotate - [select for diffs], Sat Aug 29 10:41:12 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.55: +6 -6 lines
Diff to previous 1.55 (colored)

make(1): rename LstNode functions to match their type

Revision 1.55 / (download) - annotate - [select for diffs], Sat Aug 29 10:12:06 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.54: +6 -6 lines
Diff to previous 1.54 (colored)

make(1): rename Lst_FindB back to Lst_Find

The migration from "comparison function" to "match function" is done,
the "B" in the names is no longer needed.

Revision 1.54 / (download) - annotate - [select for diffs], Sat Aug 29 10:06:23 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.53: +3 -33 lines
Diff to previous 1.53 (colored)

make(1): migrate remaining Lst_Find to Lst_FindB

While here, rename SuffSuffIsSuffix to SuffSuffGetSuffix since a
function named "is" should return a boolean, not a string pointer.

Revision 1.53 / (download) - annotate - [select for diffs], Sat Aug 29 09:30:10 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.52: +32 -3 lines
Diff to previous 1.52 (colored)

make(1): start replacing Lst_Find with Lst_FindB

Lst_Find is called with a "comparison" function that returns the integer
0 if the desired node is found.  This leads to confusion since there are
so many different return value conventions for int, such as 0/1 for
mimicking false/true, -1/0 as in close(2), and the sign as in strcmp(3).
This API is much easier to understand if the "comparison" function is
not called a comparison function (since that is too close to strcmp),
but a "match" function that just returns a boolean.

In Lst_FindFromB, the node argument may be null.  This deviates from the
other Lst functions, which require Lst and LstNode to generally be
non-null.  In this case it is useful though to make the calling code
simpler.

In arch.c, this makes a lot of the previous documentation redundant.

In cond.c, the documentation is reduced a little bit since it had
already been cleaned up before.  It also removes the strange negation
from CondFindStrMatch.

In dir.c, the documentation collapses as well.

In main.c, separating the ReadMakefile function from the callbacks for
Lst_FindB allows the former to get back its natural function signature,
with proper types and no unused parameters.

To catch any accidental mistakes during the migration from Lst_Find to
Lst_FindB, the code can be compiled with -DUSE_DOUBLE_BOOLEAN, which
will complain about incompatible function pointer types.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Aug 28 19:52:14 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.51: +31 -43 lines
Diff to previous 1.51 (colored)

make(1): inline LstIsValid and LstNodeIsValid

A simple null pointer comparison is easier to understand than the fuzzy
word "valid".

Revision 1.51 / (download) - annotate - [select for diffs], Fri Aug 28 19:46:04 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.50: +5 -5 lines
Diff to previous 1.50 (colored)

make(1): fix build errors for USER_CPPFLAGS=-DNDEBUG

The functions LstIsValid and LstNodeIsValid are only used in assertions.

Without the always-false assertion, Enum_ValueToString could have
returned undefined behavior.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Aug 28 04:48:57 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.49: +38 -38 lines
Diff to previous 1.49 (colored)

make(1): remove trailing 'S' from names of Lst functions

The migration from null-passing Lst functions to argument-checking Lst
functions is completed.

There were 2 surprises: The targets list may be NULL, and in Dir_AddDir,
the path may be NULL.  The latter case is especially surprising since
that function turns into an almost-nop in that case.  This is another
case where probably 2 independent functions have been squeezed into a
single function.  This may be improved in a follow-up commit.

All other lists were fine.  They were always defined and thus didn't
need much work.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Aug 28 04:28:45 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.48: +3 -36 lines
Diff to previous 1.48 (colored)

make(1): migrate Lst_Find to Lst_FindS

Revision 1.48 / (download) - annotate - [select for diffs], Fri Aug 28 04:14:31 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.47: +5 -5 lines
Diff to previous 1.47 (colored)

make(1): migrate Lst_First to Lst_FirstS

Revision 1.47 / (download) - annotate - [select for diffs], Thu Aug 27 19:15:35 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.46: +3 -10 lines
Diff to previous 1.46 (colored)

make(1): migrate Lst_IsEmpty to Lst_IsEmptyS

Revision 1.46 / (download) - annotate - [select for diffs], Thu Aug 27 07:03:48 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.45: +3 -15 lines
Diff to previous 1.45 (colored)

make(1): migrate Lst_Last to Lst_LastS

Revision 1.45 / (download) - annotate - [select for diffs], Thu Aug 27 07:00:29 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.44: +3 -14 lines
Diff to previous 1.44 (colored)

make(1): migrate Lst_Succ to Lst_SuccS

Revision 1.44 / (download) - annotate - [select for diffs], Thu Aug 27 06:53:57 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.43: +3 -26 lines
Diff to previous 1.43 (colored)

make(1): migrate Lst_ForEach to Lst_ForEachS

Most lists are always valid.  Only the "targets" variable may be null in
some cases, probably.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Aug 27 06:28:44 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.42: +3 -15 lines
Diff to previous 1.42 (colored)

make(1): migrate remaining code from Lst_Open to Lst_OpenS

Revision 1.42 / (download) - annotate - [select for diffs], Wed Aug 26 22:55:46 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.41: +120 -39 lines
Diff to previous 1.41 (colored)

make(1): add stricter variants for remaining Lst functions

In most cases the Lst functions are only called when the arguments are
indeed valid.  It's not guaranteed though, therefore each function call
needs to be analyzed and converted individually.

While here, remove a few statements that were only useful when the Lst
functions handled circular lists.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Aug 23 16:58:02 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.40: +9 -8 lines
Diff to previous 1.40 (colored)

make(1): reverse order of the Lst_Find parameters

The other callbacks all have (function, param), only the Lst_Find had
(param, function), which was inconsistent.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Aug 23 16:43:34 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.39: +5 -5 lines
Diff to previous 1.39 (colored)

make(1): define aliases for function types in list processing

This makes the prototypes of the functions clearer.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Aug 23 16:18:12 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.38: +8 -4 lines
Diff to previous 1.38 (colored)

make(1): make navigating lists in debugging mode easier

Lst is an untyped list of pointers.  During debugging, it is often
necessary to inspect the content of the list.  To do this without manual
typecasting, add a few aliases for the LstNode.datum pointer, for
inspecting GNodes and strings.

Revision 1.38 / (download) - annotate - [select for diffs], Sun Aug 23 11:13:08 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.37: +5 -6 lines
Diff to previous 1.37 (colored)

make(1): remove another piece of code for circular lists

Revision 1.37 / (download) - annotate - [select for diffs], Sun Aug 23 10:53:27 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.36: +16 -4 lines
Diff to previous 1.36 (colored)

make(1): handle special case of a list containing null pointers

GNode.commands is the only place in make where a list can contain null
pointers.  That's unexpected, and memory management in CompatRunCommand
looks suspicous enough to warrant extensive documentation.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Aug 22 23:06:51 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.35: +3 -51 lines
Diff to previous 1.35 (colored)

make(1): migrate Lst_AtFront to Lst_PrependS

This makes Lst_AtFront unused, as well as LstInsertBefore.

Revision 1.35 / (download) - annotate - [select for diffs], Sat Aug 22 22:57:53 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.34: +9 -68 lines
Diff to previous 1.34 (colored)

make(1): replace Lst_Duplicate with Lst_CopyS

Lst_Duplicate would have passed through any null pointer, which was not
needed for make.  It was the last function that used Lst_AtEnd, which in
turn was the last function that used LstInsertAfter.  As a result, these
two functions have been removed.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Aug 22 22:41:42 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.33: +17 -80 lines
Diff to previous 1.33 (colored)

make(1): make moving and copying lists simpler

Instead of the two-in-one Lst_Concat, having two separate functions is
easier to understand.  There is no need for a long API comment anymore
since the new functions have a single purpose that is accurately
described by their name.

The long comment inside Lst_Concat has been removed since it only
repeated the exact code, only in more words.

The comments in make.c about appending the cohorts had been wrong.  They
were not appended but prepended.  Once more, the function name expresses
everything that the comment said, making the comment redundant.  There
is no need to test whether the cohorts list is empty, doing nothing is
implied by the word All in Lst_PrependAllS.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Aug 22 22:00:50 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.32: +6 -9 lines
Diff to previous 1.32 (colored)

make(1): make Lst_Prev stricter regarding null pointers

Revision 1.32 / (download) - annotate - [select for diffs], Sat Aug 22 21:42:38 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.31: +3 -4 lines
Diff to previous 1.31 (colored)

make(1): clean up headers

Remove redundant headers that are already included by "make.h".
Make <assert.h> available to all compilation units that use "make.h".

Revision 1.31 / (download) - annotate - [select for diffs], Sat Aug 22 17:34:25 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.30: +5 -5 lines
Diff to previous 1.30 (colored)

make(1): fix indentation

Revision 1.30 / (download) - annotate - [select for diffs], Sat Aug 22 16:00:52 2020 UTC (2 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.29: +4 -3 lines
Diff to previous 1.29 (colored)

#include <stdint.h> for uint8_t

Revision 1.29 / (download) - annotate - [select for diffs], Sat Aug 22 15:43:32 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.28: +8 -14 lines
Diff to previous 1.28 (colored)

make(1): require argument of Lst_Member to be non-null

Since the lists don't contain null pointers, it doesn't make sense to
search for a null pointer.  All calls but one already had obviously
non-null arguments.  The one remaining call using targ->suff has been
guarded for now.

The code for Lst_Member became much simpler than before.  Partly because
the old code had an extra condition for circular lists, which are not
used by make.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Aug 22 15:17:09 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.27: +7 -10 lines
Diff to previous 1.27 (colored)

make(1): replace Lst_Datum with non-null guaranteeing Lst_DatumS

Revision 1.27 / (download) - annotate - [select for diffs], Sat Aug 22 14:56:45 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.26: +8 -8 lines
Diff to previous 1.26 (colored)

make(1): unexport Lst_InsertBefore and Lst_InsertAfter

Revision 1.26 / (download) - annotate - [select for diffs], Sat Aug 22 14:54:48 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.25: +30 -4 lines
Diff to previous 1.25 (colored)

make(1): add strict argument checks for Lst_InsertBefore

As with the other modifying operations on lists, the callers already
made sure that the arguments are valid.

Revision 1.25 / (download) - annotate - [select for diffs], Sat Aug 22 14:39:12 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.24: +13 -20 lines
Diff to previous 1.24 (colored)

make(1): convert Lst_Enqueue and Lst_Dequeue to nonnull variants

Except for once instance in parse.c, the usage pattern for Lst_Dequeue
was to first test whether the list is empty.  This pattern allowed the
implementation of Lst_Dequeue to become simpler since the null check is
not needed anymore.

The calls to Lst_Enqueue never pass an invalid list or a null pointer,
therefore making them strict was trivial.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Aug 22 13:49:40 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.23: +5 -7 lines
Diff to previous 1.23 (colored)

make(1): allow the inconsistency with Lst_OpenS to be discovered

The -dL option is intended to find bugs in Makefiles and in make itself,
therefore enabling the consistency check is ok there.  Having this check
available by default increases the chances of the bug being found and
finally fixed.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Aug 22 13:28:20 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.22: +5 -3 lines
Diff to previous 1.22 (colored)

make(1): convert remaining Lst_AtEnd to the stricter Lst_Append

The general-purpose list library that is included in make allows to call
Lst_AtEnd for invalid lists, silently ignoring this programming error.
This is a flexibility that make doesn't need.

Another unneeded "feature" is that list items can theoretically be null
pointers.  This doesn't make sense as well and is therefore not needed
by make.

These programming errors are now caught early by assertions.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Aug 22 13:06:39 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.21: +46 -5 lines
Diff to previous 1.21 (colored)

make(1): make Make_HandleUse simpler

Since the function names now contain the text from the comments, the
comments can be shortened a bit.

Revision 1.21 / (download) - annotate - [select for diffs], Sat Aug 22 09:40:18 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.20: +26 -4 lines
Diff to previous 1.20 (colored)

make(1): add Lst_Append to add an item at the end of the list

The previous variant of using a special case of Lst_InsertAfter was
unnecessarily complicated.  Linked lists are a very basic data
structure, and there is no need to overcomplicate things by introducing
unnecessary conditions and branches.

Revision 1.20 / (download) - annotate - [select for diffs], Sat Aug 22 07:26:34 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.19: +26 -31 lines
Diff to previous 1.19 (colored)

make(1): rename local list functions

Since the name of LstIsValid and LstNodeIsValid now matches exactly the
comment, the comment is not needed anymore.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Aug 22 00:13:16 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.18: +13 -9 lines
Diff to previous 1.18 (colored)

make(1): document the recently failed assertion in Lst_OpenS

In make, a list has a single iterator that can be used with Lst_Open,
Lst_Next and Lst_Close.  Because this is a single iterator, it doesn't
make sense to call Lst_Open twice in a row without the corresponding
Lst_Close.  Exactly this happens in jobs mode though.

Revision 1.18 / (download) - annotate - [select for diffs], Fri Aug 21 14:33:32 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.17: +3 -4 lines
Diff to previous 1.17 (colored)

make(1): revert invalid assertion

When iterating over a list, it is currently not guaranteed that the list
is marked as "!isOpen", which I had wrongly and naively assumed.

This probably means that there is some hidden bug in make, but even if
there is, this bug would be quite old already and was too small to be
detected.

Therefore, remove the assertion again, until the situation is clear and
reproduced.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Aug 21 07:04:31 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.16: +15 -18 lines
Diff to previous 1.16 (colored)

make(1): clean up list handling

Lst_Init never returns NULL.  Casting postfix increment to void is
unnecessary since that is quite common.  Found a last instance of a
local variable named 'nlnode'.

Revision 1.16 / (download) - annotate - [select for diffs], Fri Aug 21 07:00:32 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.15: +182 -201 lines
Diff to previous 1.15 (colored)

make(1): remove type information from local variables in list library

Every node in this file is of type LstNode, which makes the 'l' in the
name 'ln' redundant.  The name 'ln' is quite close to the name 'l',
which in turn can easily be confused with the digit '1'.  Therefore,
rename 'l' to 'list' and 'ln' to 'node'.

Revision 1.15 / (download) - annotate - [select for diffs], Fri Aug 21 06:38:29 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.14: +103 -106 lines
Diff to previous 1.14 (colored)

make(1): use shorter field names in Lst and LstNode

In a doubly linked list, it is commonly known that the 'prev' and 'next'
fields of the nodes are pointers to other nodes, therefore this does not
need to be repeated in the variable name.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Aug 21 06:28:38 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.13: +49 -301 lines
Diff to previous 1.13 (colored)

make(1): condense the API comments in the list library

Most mentioned "side effects" were either implementation details or
rather "main effects".  The wording of similar functions has been
aligned.

Revision 1.13 / (download) - annotate - [select for diffs], Fri Aug 21 05:28:41 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.12: +40 -42 lines
Diff to previous 1.12 (colored)

make(1): remove unnecessary type duplication in list implementation

Having both the interface types Lst/LstNode and the implementation types
List/ListNode does not make the code clearer, it is an unnecessary
abstraction.  Eliminating the implementation type means that some of the
local variables can be merged, which will make the code simpler than
before.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Aug 21 05:19:48 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.11: +18 -16 lines
Diff to previous 1.11 (colored)

make(1): extract creation of a list node into a separate function

Revision 1.11 / (download) - annotate - [select for diffs], Fri Aug 21 04:57:56 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.10: +7 -14 lines
Diff to previous 1.10 (colored)

make(1): remove unnecessary macro PAlloc

The ptype parameter was never used, which made it redundant.  The
remaining text is so simple that it's not worth having a macro for this
purpose.  This makes it easier to read the code since the previously
implicit variable assignment is now clearly visible.

Revision 1.10 / (download) - annotate - [select for diffs], Fri Aug 21 04:42:02 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.9: +24 -38 lines
Diff to previous 1.9 (colored)

make(1): use stricter list API for sequential access

In several places, it just doesn't make sense to have a null pointer
when a list is expected.

In the existing unit tests, the list passed to Lst_Open is always valid,
but that's not a guarantee for real-world usage.  Therefore, Lst_Open
has been left for now, and Lst_OpenS is only the preferred alternative
to it.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Aug 21 04:09:12 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.8: +6 -8 lines
Diff to previous 1.8 (colored)

make(1): assert correct usage of the Lst_Open API

All calls to Lst_Next are properly protected by Lst_Open, so there is no
possible assertion failure here.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Aug 21 03:36:03 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.7: +17 -51 lines
Diff to previous 1.7 (colored)

make(1): make list library code stricter

Up to now, the list library didn't distinguish between programming
mistakes (violations of invariants, illegal parameter values) and
actually interesting situations like "element not found in list".

The current code contains many branches for conditions that are neither
exercised by the unit tests nor by real-world usage.  There is no point
in keeping this unnecessary code.

The list functions will be migrated from their lenient variants to the
stricter variants in small parts, each function getting the S suffix
when it is made strict, to avoid any confusion about how strict a
particular function is.  When all functions have been migrated, they
will be renamed back to their original names.

While here, the comments of the functions are cleaned up since they
mention irrelevant implementation details in the API comments, as well
as "side effects" that are really main effects.

Revision 1.7 / (download) - annotate - [select for diffs], Fri Aug 21 03:03:45 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.6: +13 -14 lines
Diff to previous 1.6 (colored)

make(1): don't use bitfields in list processing

There is no need to squeeze unrelated fields of the struct into a single
object.  A bitset with a single flag is the same as a simple boolean
variable.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Aug 21 02:56:25 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.5: +6 -59 lines
Diff to previous 1.5 (colored)

make(1): properly clean up the remaining code mentioning circular lists

Revision 1.5 / (download) - annotate - [select for diffs], Fri Aug 21 02:20:47 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.4: +10 -93 lines
Diff to previous 1.4 (colored)

make(1): remove unused code for circular lists

The list library had probably been imported from a general-purpose
library that also supported circular lists.  These are not used by make
though.

After replacing Lst_Init(FALSE) with Lst_Init(), only a single call to
Lst_Init remained with a non-constant argument, and that was in
Lst_Concat, which was to be expected.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Aug 9 20:49:15 2020 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.3: +90 -89 lines
Diff to previous 1.3 (colored)

make(1): fix inconsistent formatting in lst.c

Revision 1.3 / (download) - annotate - [select for diffs], Sat Aug 1 14:47:49 2020 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.2: +5 -5 lines
Diff to previous 1.2 (colored)

make(1): use consistent indentation in source code

Tabs for multiples of 8, then spaces.

The usage string has been kept as-is since the spaces there are
indentional and do influence the output.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jul 26 07:24:27 2020 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.1: +26 -16 lines
Diff to previous 1.1 (colored)

make(1): replace macros with functions

Revision 1.1 / (download) - annotate - [select for diffs], Sun Jul 26 07:15:26 2020 UTC (2 years, 6 months ago) by rillig
Branch: MAIN

make(1): condense the list library into a single file

The list library is only used in make(1). Having it spread out over 28
files made it look more complex than it really is. In fact, it's just a
versatile generic data type like in hash.c.

Having all the list functions in a single file reduces the code size,
both by omitting the many RCS Ids and by inlining commonly used code.

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>