Commit Graph

281614 Commits

Author SHA1 Message Date
rillig
9d72f76464 make(1): clean up local variables in Parse_DoVar
The variable "line" was misnamed since it turned from the beginning of
the line to the variable name.  The variable "cp" was named too broadly.
Having two moving pointers in a single parsing function was too much.

Now p is the only moving pointer.  From it, the variable name and value
are extracted as the pointer flies by.  These more specific names make
the lower half of the function more readable since Var_Set(name, value)
sounds more correct and to the point than Var_Set(line, cp).

Memory management for the possibly expanded variable value is now
simpler as there may or may not be an expanded value, and that is freed
in every case.  No need for another Boolean variable called freeCp
anymore.  Distinguishing between the unexpanded value and the actual
value highlights the data flow.

Using const pointers is a step into the direction of having a parser
that operates on a read-only string.  Right now the string is destroyed
upon parsing.
2020-10-04 13:24:59 +00:00
rillig
2bd1a09b0a make(1): fix out-of-bounds memory access in Parse_DoVar
When a line starts with "=value", this is interpreted as a variable
assignment, with an empty variable name.  In that case, there is no
"previous character" from the '='.  Accessing that character therefore
was an out-of-bounds read access.

If a whole file starts with "=value", instead of just a single line,
this out-of-bounds access can actually lead to a segmentation fault.
This depends on the memory allocator though.
2020-10-04 11:58:57 +00:00
rillig
c814087e2a make(1): only use the VARE_ASSIGN flag if necessary
When checking the right-hand side of a variable assignment for syntax
errors, it does not matter  whether a '$$' is expanded to '$' or kept as
'$$'.
2020-10-04 10:35:25 +00:00
rin
498c80dabc Add missing __{BEGIN,END}_DECLS in order to catch up with
sanitizer_linux_libcdep.cc rev 1.17:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc#rev1.17

Fix build with HAVE_GCC=9.
2020-10-04 10:34:18 +00:00
rillig
59dabd71e0 make(1): add basic tests for the += assignment operator 2020-10-04 10:16:09 +00:00
rin
a9c87449c2 Fix ramdisk overflow:
- switch to x_disklabel (drop non-native label support)
- switch to x_fsck_ffs and x_newfs (drop byte-swapped and Apple UFS support)
- switch to more
2020-10-04 09:42:48 +00:00
rin
5958de7d2a Fix miniroot overflow by switching to x_fsck_ffs and x_newfs
(drop byte-swapped and Apple UFS support).
2020-10-04 09:34:18 +00:00
rillig
6e682a454c make(1): add test for combining :sh with += 2020-10-04 08:32:52 +00:00
rillig
03e490953a make(1): make documentation of Error more precise 2020-10-04 08:22:59 +00:00
rillig
079405bd8d make(1): add another test for parsing :sh assignments 2020-10-04 08:14:35 +00:00
skrll
17871edd4a KNF 2020-10-04 08:09:12 +00:00
rillig
369666478e make(1): test another edge case for the :sh assignment 2020-10-04 08:02:17 +00:00
rillig
127040e6d2 make(1): fix parsing of the :sh assignment operator modifier 2020-10-04 07:49:45 +00:00
rillig
65f1297096 make(1): add tests for parsing assignments, especially :sh
Luckily nobody uses the :sh variable assignment modifier since its
syntactical variant != is simpler.
2020-10-04 06:53:15 +00:00
nat
a73bf1cfe7 Ensure event_thread stays in event loop upon creation. 2020-10-04 06:15:54 +00:00
rillig
dfde7bb817 make(1): replace strcpy with memcpy in Hash_CreateEntry
The string length is already known, no need to recalculate it.
2020-10-03 23:16:28 +00:00
rillig
ae60f31db0 make(1): remove unnecessary code from Hash_DeleteEntry
This function is only called 2 times, and both callers pass valid
arguments.
2020-10-03 22:33:26 +00:00
riastradh
35a4cb626d autoconf: Blame devices holding up boot with config_pending.
Blame message requires `boot -x' (AB_DEBUG).

Fix ata so it doesn't mismatch config_pending_incr/decr devices.
2020-10-03 22:32:50 +00:00
christos
5e85fe34cc PR/55693: Andreas Gustafsson: factor(6) lists factors in wrong order
Sync with FreeBSD and change their -h (that printed hex) to -x because
we were already using -h.
2020-10-03 22:27:00 +00:00
rillig
7a85896268 make(1): clean up hash table implementation
Having the hash function potentially redefined is a bit too much
flexibility.  If actually needed, this should be done using a patch, not
using the C preprocessor.

Converting the macro to a function made the control flow easier to
understand.  It also revealed that the variable p was unnecessary in
both Hash_FindEntry and Hash_CreateEntry.
2020-10-03 22:25:04 +00:00
rillig
052e64b5e1 make(1): clean up #include sections 2020-10-03 21:52:50 +00:00
rillig
aea5b99b75 make(1): remove dead store in ParseGetLine
GCC 5 didn't dare to optimize this by itself.
2020-10-03 21:43:41 +00:00
rillig
78fa7ec431 make(1): inline macro ISEQOPERATOR
The name of the macro was wrong.  These characters are not used in an
equality operator, it's an assignment operator.
2020-10-03 21:23:42 +00:00
rillig
75f91a54ee make(1): use consistent pattern for parsing whitespace
The pp and cpp in the function names stand for "parsing position" and
"const parsing position".
2020-10-03 21:19:54 +00:00
rillig
00e17f17bf make(1): add unit test for the Towers of Hanoi puzzle 2020-10-03 20:34:06 +00:00
martin
d9c7022040 PR 55384: detangle pm->ptstart from the "install" flag (selecting a
target partition). Instead introduce a new PTI_INSTALL_TARGET per partition
flag and deal with it in the partitioning backends.

Honour pm->ptstart when allocating new partitions - it is supposed to be
the first sector usable by NetBSD.
2020-10-03 18:54:18 +00:00
christos
10f7eba97a - centralize number parsing code
- enable -g
- KNF
2020-10-03 18:42:20 +00:00
christos
f717d52b2d bump libc for set_rpc_maxgrouplist 2020-10-03 18:35:21 +00:00
christos
460972a5e2 bump for set_rpc_maxgrouplist 2020-10-03 18:34:15 +00:00
christos
f0047c9ccc add set_rpc_maxgrouplist 2020-10-03 18:33:52 +00:00
christos
fb8fd3ef27 Add set_rpc_maxgrouplist 2020-10-03 18:31:29 +00:00
christos
c53d404f5e add set_rpc_maxgrouplist(3) 2020-10-03 18:30:39 +00:00
wiz
2858bf9ece New sentence, new line. 2020-10-03 18:29:02 +00:00
christos
a9f74273b0 Add -A (noac) option to turn off the attribute cache. (Maciej W. Rozycki) 2020-10-03 18:06:37 +00:00
thorpej
806d42fb8f Add a comment describing the rpb::rpb_vptb field. 2020-10-03 17:33:23 +00:00
thorpej
ef2f8a9cde Provide an alternate delay function that uses the Qemu get-time hypercall. 2020-10-03 17:32:49 +00:00
thorpej
d0123f4cd6 Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us.  Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments.  So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
  "root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD".  In the case of
  Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
  perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
2020-10-03 17:31:46 +00:00
rillig
6f58a78513 make(1): add test demonstrating the Towers of Hanoi puzzle
It's not the primary task of make to handle procedure calls with
parameters, combined with lexical scoping, therefore the code does not
look as straight-forward or clean as in other programming languages.  It
feels more like squeezing a programming problem from the imperative
world into the world of declarative dependencies.

A more idiomatic way of implementing this puzzle should be as a
dependency graph since that's both the natural structure of the puzzle
and the primary domain of make.  Something like having a main target
"hanoi-5" that depends on intermediate targets of the form
"move-1.2.3.4.5-_._._._._-_._._._._", each representing a single
configuration of the stacks.  These targets could be generated
dynamically.  A benefit of this implementation would be that the puzzle
could be resumed from an arbitrary configuration, just just from the
initial configuration.
2020-10-03 17:30:54 +00:00
rillig
27ec5f2921 make(1): demonstrate naive output filtering with csh in parallel mode 2020-10-03 15:38:13 +00:00
rillig
eaf8289576 make(1): fix shell definition for csh
The bug has been there since at least 1993-03-21.  This is strong
evidence that nobody has ever used the csh in parallel mode.
2020-10-03 15:28:37 +00:00
rillig
cc4e65a520 make(1): demonstrate wrong output when using csh in parallel mode 2020-10-03 15:23:42 +00:00
rillig
53e5ff806e make(1): refine test for printing commands using csh 2020-10-03 15:21:12 +00:00
rillig
7455b57006 make(1): inline Str_FindSubstring in JobOutput 2020-10-03 15:00:57 +00:00
rillig
2a17966ff7 make(1): inline Str_FindSubstring in ModifyWord_Subst 2020-10-03 14:41:20 +00:00
rillig
227e2c03bb make(1): add tests for the various supported shells 2020-10-03 14:39:36 +00:00
christos
1f8ba1a635 Filter out the VUSECOUNT_GATE bit 2020-10-03 14:01:16 +00:00
jmcneill
ac87b8e9ad MMIO configuration space is in guest byte order. AArch64 BE is special,
as the guest starts in LE and we switch to BE after the kernel starts.
For this case, we need to byte swap all config space accesses.
2020-10-03 13:51:34 +00:00
rillig
2804d33708 make(1): replace backslash-newline with ordinary string literals
The character sequence backslash-newline is not mentioned in ISO C99.
2020-10-03 13:22:39 +00:00
rillig
36aaeb8197 make(1): allow to disable debug logging options
This is only intended for the unit tests, to selectively enable and
disable debug logging as needed.  Previously the tests for debug logging
required complicated postprocessing that was not obvious when looking at
the test .mk file alone, but was specified externally in
unit-tests/Makefile.

This is the simplest possible implementation.  Another variant would
have been to selectively disable individual debug logging options, but
that would have made the code more complicated.

The -dL option is not affected by -d0 since that is not really a debug
option, even if it is implemented as one.
2020-10-03 13:06:56 +00:00
rillig
9685dd8d18 make(1): extract ApplyModifier_Literal into separate function 2020-10-03 12:51:49 +00:00