Commit Graph

14885 Commits

Author SHA1 Message Date
rillig
7c1ae9cea7 make(1): clean up code in make.c
Var_Subst never returns NULL.

In Main_ExportMAKEFLAGS, don't compare ints with booleans.

In MainParseArgs, use char for the current character.  First, that's
more precise and correct, and second, it makes debugging easier for
those who don't know the ASCII table by heart.
2020-08-29 07:13:17 +00:00
rillig
da6468d597 make(1): rename confusing function ReadAllMakefiles
The old name implied that the function would read multiple files, which
was not the case.

The comment above that function was highly confusing.  It's not that the
function returns a boolean, but rather 0 or non-zero, and 0 means that
Lst_Find should stop searching.

One of the next refactorings will be to make Lst_Find return the first
list node for which the function returns TRUE.  This will reduce the
confusion about the several functions called SomethingP in suff.c.  The
P suffix means to return TRUE or FALSE, not 0 or non-zero.
2020-08-29 07:05:12 +00:00
rillig
ae6246b519 make(1): remove redundant MAKEFLAGS from subdir make
The make flags are passed via the environment, not via the command line.
This is not as obvious and visible, but it works.
2020-08-28 20:57:54 +00:00
rillig
61206e6661 make(1): remove unused variable not_parallel
The variable malloc_options seems unused as well, but the manual page
for jemalloc(3) mentions it.
2020-08-28 20:23:20 +00:00
rillig
d418859d56 make(1): remove redundant comments from hash.c 2020-08-28 20:16:19 +00:00
rillig
2b65eef82d make(1): inline LstIsValid and LstNodeIsValid
A simple null pointer comparison is easier to understand than the fuzzy
word "valid".
2020-08-28 19:52:14 +00:00
rillig
851c5fa92a 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.
2020-08-28 19:46:04 +00:00
rillig
dcdf071d13 make(1): rename SuffixCmpData to SuffSuffIsSuffixArgs
The new name makes the comment above that struct redundant.
2020-08-28 19:21:00 +00:00
rillig
328f88448d make(1): clean up targ.c
The main part is removing redundant or outdated information from
comments.  In a few places, the expression cond ? TRUE : FALSE has been
simplified.
2020-08-28 19:14:07 +00:00
rillig
d9d33f9cdc make(1): clean up arch.c
Remove redundant parts of the function comments.  Move the "side
effects" to the main section, since these effects are main effects, not
side effects.

Remove the redundant prototype for ArchFree.
2020-08-28 18:34:45 +00:00
rillig
2c88efad6f make(1): fix test for interrupted command execution
In the first version of this test, I had completely misunderstood the
whole topic.

To test the interrupt, the make process has to be interrupted, not the
shell.  This generates the correct message that the target is removed.

The filename for .PHONY targets is removed even though .PHONY targets
usually don't correspond to a file.  The message is only printed if
there actually is a corresponding file.  That's why this message does
not appear when interrupting "make clean".

Finally, since files get created and removed during a single run of
make, the file cache needs to be disabled.  This is done by prefixing
the filenames with "././", see Dir_FindFile.
2020-08-28 18:16:22 +00:00
rillig
c0a3672957 make(1): clean up suffix handling 2020-08-28 17:27:21 +00:00
rillig
24bce02441 make(1): add tests for :tl and :tu modifiers 2020-08-28 17:21:02 +00:00
rillig
5c2c546f89 make(1): fix manual page about the modifiers of the :C modifier 2020-08-28 17:15:04 +00:00
christos
573be1b963 PR/55605: Soumendra Ganguly: Wait for child to finish when stdin is not a tty 2020-08-28 17:10:15 +00:00
rillig
24bb4aab54 make(1): add test for interrupting a command 2020-08-28 15:40:53 +00:00
rillig
793156de9d make(1): add tests for the &&, || and ! operators 2020-08-28 14:48:37 +00:00
rillig
24afb09ffc make(1): add test for unquoted string literals 2020-08-28 14:07:51 +00:00
rillig
2556a5c35b make(1): add test for operator precedence in conditions 2020-08-28 13:50:48 +00:00
rillig
4566d0c791 make(1): extend test for the exists function in conditions 2020-08-28 12:59:36 +00:00
ozaki-r
1d675d5a3a netstat: strengthen against kernel changes
netstat uses sysctlbyname to get counter data from the kernel.
sysctlbyname fails with ENOMEM if actual counter data in the kernel is
larger than a passed buffer.  netstat just skips showing counters of a
category if sysctlbyname fails, so if we added new counters of the
category to the kernel, nestat shows nothing for the category.

Fortunately sysctlbyname fills data as much as possible even if a passed
buffer is short.  So we can allow netstat to show the filled data anyway
if sysctlbyname fails with ENOMEM.

Note that this backcompat mechanism works only if new counters are
appended, and doesn't work if new counters are inserted into the middle
or counters are moved.
2020-08-28 07:23:48 +00:00
rillig
2c8df40906 make(1): fix the other assertion from Lst_FindFrom
When I migrated the Lst_FindFrom to the strict API variant, I forgot
that Lst_FindFrom requires both arguments (list and node) to be
non-null.  I had only checked that the list is non-null.

There are only very few calls to Lst_FindFrom, and they are all ok now.
2020-08-28 06:47:14 +00:00
rillig
335ef99a86 make(1): fix assertion failure in suffix handling
Found by running ./build.sh, in the very early stage.
Fixed by restoring the previous behavior of returning NULL for invalid
arguments.
2020-08-28 06:37:21 +00:00
ozaki-r
fb54873b52 netstat: support new packet counters 2020-08-28 06:34:17 +00:00
rillig
d5d52de25e make(1): clean up Dir_AddDir
Extract the null check for path to the top level.  This has the
side-effect of only incrementing dotLast.refCount if that entry is
actually used.

Reduce the indentation of the code by returning early from the simple
branches.
2020-08-28 04:59:17 +00:00
rillig
942d06c278 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.
2020-08-28 04:48:56 +00:00
rillig
4acfd85d5e make(1): migrate Lst_Find to Lst_FindS 2020-08-28 04:28:45 +00:00
rillig
acebd2797e make(1): remove unused reference to Lst_Last 2020-08-28 04:16:57 +00:00
rillig
4b307a6103 make(1): migrate Lst_First to Lst_FirstS 2020-08-28 04:14:31 +00:00
rillig
21328ac495 make(1): add test for the undocumented .NULL special dependency target 2020-08-28 04:05:35 +00:00
rillig
f0fdf22f6f make(1): add tests for the special .INCLUDES and .LIBS variables 2020-08-28 03:51:06 +00:00
rillig
3b8b408b28 make(1): print suffix flags in the standard way
This changes the output (it is now SUFF_NULL instead of just NULL), and
the order of the flags in the output is reversed.
2020-08-28 03:35:45 +00:00
rillig
274dc2d0aa make(1): disable the sync-mi convenience target 2020-08-28 02:45:51 +00:00
rillig
74fd7ff4cd make(1): migrate Lst_IsEmpty to Lst_IsEmptyS 2020-08-27 19:15:35 +00:00
rillig
5be8116c2e make(1): pass the command-line variables to the subdir make 2020-08-27 19:09:37 +00:00
rillig
2e8adea593 make(1): add test for the -dg1 option 2020-08-27 19:00:17 +00:00
rillig
8dde8e9642 make(1): migrate Lst_Last to Lst_LastS 2020-08-27 07:03:48 +00:00
rillig
b855b10134 make(1): migrate Lst_Succ to Lst_SuccS 2020-08-27 07:00:29 +00:00
rillig
6c196ebe9c make(1): migrate Lst_ForEach to Lst_ForEachS
Most lists are always valid.  Only the "targets" variable may be null in
some cases, probably.
2020-08-27 06:53:57 +00:00
rillig
f199d14109 make(1): migrate Lst_ForEachFrom to Lst_ForEachFromS 2020-08-27 06:31:46 +00:00
rillig
760b7512c6 make(1): migrate remaining code from Lst_Open to Lst_OpenS 2020-08-27 06:28:44 +00:00
rillig
bc1fe826c1 make(1): remove unused declarations from job.h 2020-08-27 06:18:22 +00:00
rillig
ffe49907b6 make(1): convert Arch_ParseArchive from ReturnStatus to Boolean
There are only few functions left that use the ReturnStatus.  These will
be converted as well, to get rid of the additional typedef.
2020-08-27 06:13:53 +00:00
simonb
8ac9ace5b3 Whitespace nit. 2020-08-27 01:52:04 +00:00
christos
f55490be1e Provide a helpful error message if we don't have privs to read kernel
addresses.
2020-08-26 23:08:29 +00:00
rillig
0ef96ddde1 make(1): merge duplicate code for creating a new suffix 2020-08-26 23:08:26 +00:00
rillig
ca993cd932 make(1): remove header sprite.h
Make is independent of the Sprite operating system.
2020-08-26 23:00:47 +00:00
christos
a09dcfa2d4 undo previous, now sockstat works without privs 2020-08-26 22:57:55 +00:00
rillig
4862a68b32 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.
2020-08-26 22:55:46 +00:00
simonb
f34bcfad7a Use the vm.uspace sysctl instead of using the USPACE kernel define. 2020-08-26 10:56:01 +00:00