Commit Graph

20931 Commits

Author SHA1 Message Date
rillig 9979fcb6e2 make: fix memory leak in realpath cache 2024-06-01 20:19:40 +00:00
rillig 518dc17b32 tests/make: test more modifiers and special variables 2024-06-01 18:44:05 +00:00
sjg aee3d42c8f Run check-expect.lua in .CURDIR 2024-06-01 15:54:40 +00:00
rillig b9ffd9f0c2 make: replace strncpy with snprintf
There's no point copying a MAXPATHLEN buffer in its entirety when only
the initial string part is ever used.
2024-06-01 12:27:31 +00:00
rillig 37273b4570 make: fix variable lifetime when initializing MAKE and .MAKE
The pathbuf buffer is aliased by abspath, which later escapes the block
where the buffer is declared.
2024-06-01 12:17:41 +00:00
rillig bef27c5733 tests/make: test invalid character in a late .for variable name
This covers the cleanup code that frees the earlier variable names when
a late variable name is invalid.
2024-06-01 11:24:11 +00:00
rillig eae7578437 tests/make: cover purging the realpath cache
In purge_relative_cached_realpaths, the hash table containing the cache
is modified while being iterated, which needs extra care, so add a test
that covers this code in at least a single simple scenario.
2024-06-01 11:06:17 +00:00
martin 74b93bff11 Fix typo in previous 2024-06-01 10:17:12 +00:00
rillig 241c9849b3 make: require return value of HashIter_Next to be used
This would have prevented an endless loop in
purge_relative_cached_realpaths.
2024-06-01 10:10:50 +00:00
rillig cdbdfe2384 tests/make: require all expected messages to be listed in the .mk files 2024-06-01 10:06:23 +00:00
tsutsui 4f42adff2a Don't try to set non-POSIX struct stat members on tools builds.
Fixes PR/58278 (src/tools/gzip build failed on Cygwin).
2024-06-01 09:45:36 +00:00
sjg 7aee84d4aa make: ensure loop termination in purge_relative_cached_realpaths
You cannot ignore the return from HashIter_Next
2024-06-01 07:37:19 +00:00
sjg cdcc95b114 make: add .export-all
An explicit syntax for exporting all global variables is much safer
than allowing .export with no argument to do the same.

Add .export-all and have .export with no argument throw a warning saying
to use .export-all

Reviewed by: rillig
2024-06-01 06:26:36 +00:00
rillig f8e0665918 make: remove unused VARE_EVAL_KEEP_DOLLAR 2024-06-01 05:08:48 +00:00
rillig 29b142dfe2 make: merge functions that parse modifier parts
This commit subtly changes the behavior for the :gmtime and :localtime
modifiers, but only in irrelevant cases since the time value must be an
integer, and neither '\' nor ':' nor '$' may occur in these values.
2024-05-31 20:21:34 +00:00
rillig 0fbf3fce65 tests/make: replace or document .error in tests
The text 'Missing argument for ".error"' in an .exp file may be a hint
for an accidentally broken test, so eliminate them as far as possible.
2024-05-31 07:13:12 +00:00
rillig 72b6692e9f make: simplify expression in iteration over hash tables 2024-05-31 07:11:12 +00:00
rillig 2864ddb2e9 make: clean up API for iterating over hash tables 2024-05-31 05:50:11 +00:00
rillig 880d6717fe make: don't log anything when freeing memory 2024-05-30 21:50:34 +00:00
sjg e78cefbe42 make: allow debugging the warning about .OBJDIR
When make complains about an unwritable .OBJDIR
it is not always obvious how we derrived that value.

If MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is enabled call PrintOnError
so we can examine variables that are likely relevant.

Fix description of MAKE_OBJDIR_CHECK_WRITABLE in make.1
2024-05-28 19:09:04 +00:00
rillig f3426a08ed make: use fewer technical terms in debug message for dependency 2024-05-25 22:08:35 +00:00
rillig f80730c1d3 make: replace magic numbers with POSIX FILENO constants
No binary change.
2024-05-25 21:34:38 +00:00
rillig e67daf6e75 tests/make: rename temporary file
The filename extension '.inc' is reserved for files that are checked
into version control.
2024-05-25 21:11:30 +00:00
rillig 734fc80208 make: fix memory leak for command strings 2024-05-25 21:07:48 +00:00
rillig cd90f040db make: minimize local variables around a vfork call
Passing all relevant values as arguments allows to remove the 'volatile'
qualifiers.
2024-05-25 15:37:17 +00:00
rillig c05c85b7d7 make: fix some more memory leaks 2024-05-25 08:03:19 +00:00
rillig dd76681b7b make: fix a few more memory leaks 2024-05-25 00:00:25 +00:00
rillig 0ab57ba387 make: in -DCLEANUP mode, free variables and their values
The variables in the 3 scopes must be freed before the scopes themselves
are freed by Targ_End.

The test opt-m-include-dir creates a directory of the form '*.tmp', thus
it must be removed before attempting to only remove regular files of
this name.

POSIX requires setenv to copy the passed name and value, so there is no
need to keep that memory allocated any longer.
2024-05-24 23:02:46 +00:00
rillig e3cf24f959 make: remove dead code from HashTable_DeleteEntry 2024-05-24 22:54:07 +00:00
rillig 9755e146fc make: remove trailing whitespace 2024-05-24 22:52:24 +00:00
uwe 61a71e7495 mkubootimage.1: improve markup 2024-05-22 00:02:46 +00:00
uwe 7d9f356046 mkubootimage.1: restore .Ed lost in previous 2024-05-21 23:31:21 +00:00
gutteridge e8de72e87c mkubootimage(1): adjust example output in man page
Refresh to show current output format (an additional field) and address
a "TODO" comment that's been there for over a decade.
2024-05-21 22:10:21 +00:00
gutteridge 1887598093 mkubootimage(1): adjust usage, etc.
In the tool, reflow and reorder usage() output and also consistently
mark which arguments are optional.

In the man page, add missing -t argument in the synopsis and follow
consistent argument ordering.
2024-05-21 04:01:26 +00:00
gutteridge 5231fcf070 mkubootimage(1): add riscv 2024-05-21 03:54:31 +00:00
nia d257b0e8a9 aiomixer(1): Fix setting volume on sb(4) emulated in QEMU.
The driver does not return a "delta", assume it's 16.
2024-05-20 22:21:45 +00:00
wiz 7964e1f2d6 Improve usage.
From Igor Sobrado Delgado, so we're in sync with OpenBSD.
2024-05-20 20:46:05 +00:00
sjg 034e15ae19 make: cleanup style in FindFile
Since we removed the last check for isinclude,
restore to the previous indentation etc.

No functional change.
2024-05-20 19:14:12 +00:00
sjg 146cab6498 Allow .include <> to search .CURDIR last
libc at least appears to depend on this.
2024-05-20 16:04:46 +00:00
christos 98b3419359 PR/58270: RVP: tic does not honor the user's umask, output files are 0666. 2024-05-20 14:41:37 +00:00
sjg c86b32d1f8 make: use separate function to include makefiles.
Have Dir_FindFile and Dir_FindInclude call FindFile with a
bool flag to indicate whether .CURDIR should be be searched at all.
2024-05-19 20:09:40 +00:00
sjg 8853c17bba Dir_FindFile treat sysIncPath and defSysIncPath as special
Rather than play games with adding .DOTLAST and then having to
exclude that from .SYSPATH, just have Dir_FindFile check if
path is sysIncPath or defSysIncPath and behave as if .DOTLAST seen
and also skip the final search of .CURDIR.

Fix Dir_SetSYSPATH to use defSysIncPath if sysIncPath is empty.
2024-05-19 17:55:54 +00:00
andvar b087128c77 s/Abosrb/Absorb/ in comment. 2024-05-18 19:28:36 +00:00
andvar 9d70975e70 s/Aborb/Absorb/ in comment. 2024-05-18 19:03:31 +00:00
msaitoh 01f9da81b9 s/of of/of/ in comment. 2024-05-13 00:32:39 +00:00
msaitoh 441cf27377 emtpy -> empty in comment. 2024-05-13 00:25:23 +00:00
rillig 403b9b79e2 lint: remove redundant LINTFLAGS for lint2
The -T flag is already provided by ../Makefile.inc, along with several
other flags.
2024-05-12 19:00:10 +00:00
rillig 0671c09e39 lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor
output does not indicate which tokens come from a system header and
which tokens come from the user code.  Lint's strict bool mode relies on
this information to treat the character classification functions from
<ctype.h> as if their return type were bool instead of int.

These wrapper functions are only used when their argument is indeed a
'char', but not when the argument might be 'EOF or representable as an
unsigned char', such as when reading a byte from the input.
2024-05-12 18:49:35 +00:00
rillig 91e71a2ef4 lint: remove unused flag '-u' from lint1
This flag is completely handled by lint2.
2024-05-12 18:00:58 +00:00
rillig 0866d10930 lint: suppress "used but not defined" for bin, sbin, usr.bin, usr.sbin
These diagnostics are emitted by lint2, and like all diagnostics from
lint2, they don't affect the exit status.

In libc, lint cannot handle the renamings from namespace.h, generating
many false positive diagnostics since 'libc_function' is used but
'_libc_function' is defined. Until this situation is handled properly,
suppress this diagnostic.
2024-05-12 17:55:36 +00:00