Commit Graph

285932 Commits

Author SHA1 Message Date
rillig
2b3b250de9 make: remove redundant parameter of ApplySingleModifier 2021-02-23 15:07:58 +00:00
joerg
f2de411b1f The return address register entry is the DWARF register. On PowerPC,
this is not the same as the internal encoding, since the Link Register
is deliberately non-continous from the other general purpose register
values. To handle this, always translate the value into the internal
format.
2021-02-23 15:07:32 +00:00
joerg
c88f61af16 Make use of packed member addreses non-fatal for clang, too 2021-02-23 15:05:08 +00:00
rillig
b5e0384378 make: explain non-obvious code around indirect variable modifiers
No functional change.
2021-02-23 15:03:56 +00:00
christos
3d2aab1347 Add REG_POSIX, and make compile on linux where we don't have a lot of the
internal flags.
2021-02-23 15:00:01 +00:00
christos
df5681bdd2 Delete category stuff that has changed with the new regex; make compile
on linux and with TRE
2021-02-23 14:59:09 +00:00
christos
cd73f43310 Comment out tests that the new stricter regex does not like 2021-02-23 14:57:16 +00:00
ryo
bbb2f83e35 Just a few optimizations.
- in cpu_idle(), ci_intr_depth is always 0, so there is no need to fetch for increment or conditional branch.
- curcpu() is immutable in idle lwp, there is no need to consider KPREEMPT. Therefore, get curcpu() first and keep using it.
- add more comment.
2021-02-23 14:50:33 +00:00
rillig
a31532eb14 make: comment on possible inconsistency in handling modifier ':sh' 2021-02-23 14:27:27 +00:00
rillig
face6b4c9d make: note inconsistent parsing behavior in modifier ':_=' 2021-02-23 14:21:45 +00:00
rillig
0b7a08866d make: demonstrate how to undefine variables during evaluation
For a very long time now, I had thought that it would be impossible to
undefine global variables during the evaluation of variable expressions.
This is something that the memory management in Var_Parse relies upon,
see the comment 'the value of the variable must not change'.

After several unsuccessful attempts at referring to an already freed
previous value of a variable, today I discovered how to unset a global
variable while evaluating an expression, which has the same effect.  To
demonstrate that this use-after-free can reliably crash make, it would
need a memory allocator with a debug mode that never re-allocates the
same memory block after it has been used once.  This is something that
jemalloc cannot do at the moment.  Valgrind would be another idea, but
that has not been ported to NetBSD.

Undefining a global variable while evaluating an expression is made
possible by an implementation detail of the modifier ':@'.  That
modifier undefines the loop variable, without restoring its previous
value, see ApplyModifier_Loop.

By the very old conventions of ODE Make, these loop variables are named
'.V.' and thus do not conflict with variables from other naming
conventions.  In NetBSD and pkgsrc, these loop variables are typically
called 'var', sometimes '_var' with a leading underscore, which also
doesn't conflict with the typical form 'VAR' of variables in the global
namespace.  Therefore, in practice these loop variables don't interfere
with other variables.

One case that can practically arise is when an outer variable has a
modifier ':@word@${VAR.${word}}@' and one of the referenced variables
uses the same variable name in the modifier, see varmod-loop.mk 1.10
line 91 for a detailed explanation.

By using the ${:@VAR@@} modifier in a place that is evaluated with
cmdline scope, it is not only possible to undefine global variables, it
is possible to undefine cmdline variables as well.  When evaluated in a
specific make target, the expression ${:@\@@@} can even be used to
undefine the variable '.TARGET', which will probably crash make with an
assertion failure.
2021-02-23 14:17:21 +00:00
jmcneill
f88c3ac075 Install a default irq handler that panics when no interrupt controller
driver is installed.
2021-02-23 11:31:52 +00:00
jmcneill
522d6fb256 If we are committing a deferred splhigh() to hardware, no need to continue. 2021-02-23 10:03:04 +00:00
wiz
28a0c22ca4 Fix timespeccmp declaration.
From Kouichi Hashikawa in PR 56010.
2021-02-23 09:28:00 +00:00
mrg
850b204abe fix the formating for 'show usbxferlist'. 2021-02-23 08:51:36 +00:00
skrll
3b4959f44f Whitespace (mostly trailing) 2021-02-23 07:17:58 +00:00
wiz
dc9173cfee Fix Fl argument.
From Kouichi Hashikawa in PR 56009.
2021-02-23 07:15:41 +00:00
skrll
37c54030b4 Use the PCI_MAPREG_TYPE macro. No binary change. 2021-02-23 07:15:30 +00:00
mrg
110ac605f8 introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0.  idea from rillig@.

all touched ports built, several booted.
2021-02-23 07:13:51 +00:00
christos
c81959ef98 PR/56007: Greg A. Woods: ksh unable to execute ERR traps
(probably since 2016/03/17 - i.e. 8.x and 9.x)
2021-02-23 01:31:30 +00:00
rillig
ac43378364 make: quote ':S' in error message about missing delimiter 2021-02-23 00:27:47 +00:00
rillig
6b851c0577 make: extract ParseModifier_Match into separate function
No functional change.
2021-02-23 00:25:06 +00:00
rillig
54bec0ad03 make: add context information to error message about ':range' modifier 2021-02-23 00:15:22 +00:00
rillig
39ed2c5332 make: fix local variable name for parsing arguments
The variable name 'arg' was misleading since after a successful
TryParseTime, it would no longer point to the argument of the variable
modifier, but to the _end_ of the argument.  To reduce confusion, use p
instead, like everywhere else.  This name is less specific, which is
still better than a wrong name.
2021-02-23 00:11:07 +00:00
rillig
0c470650a5 make: add quotes around variable name in an error message 2021-02-23 00:04:48 +00:00
rillig
ba8edc0160 make: add test for confusing double space in error message 2021-02-22 23:59:43 +00:00
rillig
3d4c16a2c1 make: reorder code in ModifyWords
No functional change.
2021-02-22 23:46:03 +00:00
rillig
cc8e99da10 make: use more common parameter order for VarSelectWords
No functional change.
2021-02-22 23:42:29 +00:00
rillig
236224f584 make: make ModifyWord_Subst a little easier to understand
Addition is easier than subtraction, and the expression 'word + wordLen'
obviously means 'the end of the word', which was not as easy to spot
before.

No functional change.
2021-02-22 23:39:24 +00:00
rillig
49c1680d06 make: remove freestanding freeIt variables
These variables all belong to a string variable.  Connect them using
FStr, which reduces the number of variables to keep track of.

No functional change.
2021-02-22 23:21:33 +00:00
rillig
4acdc7c93b make: remove boolean parameter and return type from VarFreeEnv
There was only a single case where this parameter was false.  Inline
that case.  That was the only case that needed the return value, so
remove that as well.
2021-02-22 22:55:43 +00:00
rillig
626c9c496d make: add a few open questions to Var_SetWithFlags 2021-02-22 22:34:04 +00:00
rillig
db1760d592 make: do not expand variable name from the command line twice in a row
When

1.  there is a global variable containing a dollar in its expanded name
    (very unlikely since there are lots of undocumented edge cases that
    make variable names containing dollar signs fragile), and

2.  after that (unlikely since that requires .MAKEFLAGS instead of a
    normal command line)

3.  there is a command line variable of the same name (again very
    unlikely since that variable name would contain a dollar sign as
    well in the expanded form),

the global variable would not be undefined as promised by the comments
since its name was expanded once more than intended.

Because of the two 'very unlikely' above, this edge case hopefully does
not affect any practical use cases.

Note that this is not about VAR.${param} (which has a dollar sign in its
unexpanded form), but about the case where param itself would expand to
a dollar sign, such as after param=$$.
2021-02-22 22:26:50 +00:00
rillig
fbed66c0a8 make: add test for cmdline variables overriding global variables 2021-02-22 22:04:28 +00:00
rillig
a1ab648646 make: extract ExistsInCmdline from Var_SetWithFlags
No functional change.
2021-02-22 21:43:57 +00:00
rillig
ae25c3cc92 make: save a hash map lookup when defining a cmdline variable
This is a preparation to extract the code for exporting a cmdline
variable.  That code differs in several details from the other code in
ExportVar.

No functional change.
2021-02-22 21:30:33 +00:00
jmcneill
12fbe177eb Make the splx fast path smaller. 2021-02-22 21:16:25 +00:00
rillig
fd3f4d79e1 make: document interaction between cmdline and global variables
Make prevents global variables from being or becoming visible when a
command line variable of the same name is already defined.

There is a double safety net here.  Even if the call to Var_DeleteExpand
were removed, there would be no noticeable effect, other than one less
line in the debug log.

No functional change.
2021-02-22 21:14:15 +00:00
rillig
f62aab2842 make: fix report-coverage
On NetBSD 8.0 it still worked.  Maybe gcov doesn't support .c files as
arguments anymore.  Using the .gcda files works and is more reliable
anyway since it covers the inline functions in the headers as well.
2021-02-22 20:45:46 +00:00
mrg
2f7a351b70 fix formatting and db_usb_command_table[] static. idea from rillig@. 2021-02-22 20:45:28 +00:00
rillig
bc82f3aea8 make: update constant names in comments
No functional change.
2021-02-22 20:38:55 +00:00
rillig
6ec38e5b23 cgram: fix assertion when substituting at the end of the longest line
Reported by Weitian LI via GitHub.

Contrary to the patch suggested in [1], still allow the cursor to be
placed to the very right of the text in a line since that is the usual
behavior of text editors.

Split the function substitute() into two parts:  one that handles the
curses-specific part of checking whether a substitution is possible at
the current cursor position, and one that performs the actual
substitution.  Only the latter is kept in the code section for the
string manipulation functions, the other is moved to the section for
curses code.  Having all the curses code in one place reduces the places
that call beep().  Previously, as well as now, there is a single beep
per invalid key before, but that was not obvious from the previous code.

[1]: https://github.com/DragonFlyBSD/DragonFlyBSD/commit/18d09f18cf4c
2021-02-22 19:34:07 +00:00
rillig
f7c85ecb67 cgram: add advanced cursor movement with tab, shift+tab, return 2021-02-22 17:36:42 +00:00
rillig
47c6585f93 cgram: properly handle input errors
On both NetBSD and Cygwin, a missing /usr/bin/fortune would previously
continue since popen does not return an error (as /bin/sh is found and
can be executed), so the next chance to catch an error is pclose.  At
that point, the shell has already printed an informative error message
about what happened (or what didn't happen), so that cgram does not need
to print an error by itself.
2021-02-22 16:28:20 +00:00
rillig
199346cc31 lint: change spelling of initialisation to initialization
That's the wording from the ISO C99 standard.
2021-02-22 15:09:50 +00:00
rillig
368c75e0d5 lint: improve debug message and comment 2021-02-22 15:01:03 +00:00
jmcneill
9f542e2491 Adjust description of compact list view output. 2021-02-22 11:38:13 +00:00
jmcneill
25801e14c4 In compact view, show the CPUs as a range (0-n) instead of a list
(0, 1, 2, ...) when the interrupt is assigned to all CPUs in the system.
2021-02-22 11:33:34 +00:00
palle
77d7a13c52 sun4v: update current status of sun4v 2021-02-22 10:30:57 +00:00
palle
ffe39134af sun4v: handle spill normal user traps properly when current trap level is 1 - registers are spilled to the PA of the stack to avoid further mmu-related traps, since sun4v only has 2 trap levels 2021-02-22 09:56:42 +00:00