Commit Graph

286230 Commits

Author SHA1 Message Date
rillig
4a38bf21f4 make: change debug log for variable evaluation flags to lowercase
This makes them easier distinguishable from variable names since the
latter are usually uppercase.

No functional change outside debug mode.
2021-03-15 15:39:13 +00:00
rillig
2f8026b0e5 make: replace enum bit-field with struct bit-field for VarEvalFlags
This makes the code easier to read, especially in var.c.  It also makes
debugging sessions easier since some debuggers don't show enum
bit-fields symbolically as soon as more than one bit is set.

The code outside var.c is basically unchanged, except that instead of
passing the individual flags, there are 4 predefined evaluation modes.
These suffice for all practical use cases.  Only in the implementation
deep inside var.c, the value of the flags keepDollar and keepUndef
differs.

There is no way of passing the struct to EnumFlags_ToString, which means
the ToString function has to be spelled out explicitly.  This allows for
fine-tuning the representation in the debug log, to reduce the amount of
uppercae letters.

No functional change.
2021-03-15 12:15:03 +00:00
rillig
4fd3cf6eed make: rename VARE_NONE to VARE_PARSE_ONLY
The name 'NONE' described the bit pattern, which was not useful to
understand its meaning.  Omitting VARE_WANTRES only parses the
expression, without evaluating any part of it.

No functional change, not even in debug mode since Enum_FlagsToString
always returns "none" for all-bits-unset.
2021-03-15 11:41:07 +00:00
nia
53793f01c2 ossv4 mixer API: be extra careful with the inputs to AUDIO_MIXER_READ.
some drivers (not hdaudio(4), but uaudio(4), eap(4), sb(4), various other
old cards) will return error if a AUDIO_MIXER_VALUE is requested and the
number of channels is not specified as input. this is not documented as
well as it should be, unfortunately.
2021-03-15 10:58:05 +00:00
nia
984ee03fd6 regen 2021-03-15 07:30:40 +00:00
nia
1fe45e8161 correct usb device id for BELKIN F5D7050E
matches freebsd / openbsd (sources of urtw driver), various online
sources

PR kern/56056
2021-03-15 07:29:26 +00:00
christos
089f26f664 Specify the emulation explicitly (n32) so this builds when the default
emulation changes.
2021-03-14 22:58:10 +00:00
christos
400a3a1ed4 provide generic cas for _LP64 2021-03-14 22:56:39 +00:00
rillig
0c8fc40bd0 tests/lint: document how lint discards the typedef name in 247 2021-03-14 22:24:24 +00:00
rillig
6941825e93 tests/lint: add test for message 247 for pointer to unnamed struct 2021-03-14 21:44:35 +00:00
rillig
8699d6553b tests/make: document today's bug fixes in the test 2021-03-14 20:41:39 +00:00
rillig
3042e42091 make: fix documentation of VarFreeEnv
No functional change.
2021-03-14 20:23:29 +00:00
rillig
259019554f make: skip variable lookup for '::=' modifiers in parse-only mode
This is just to keep the code consistent among the various variable
modifiers.  The performance gain is negligible.

The actual assignment to the variable had already been skipped
previously.

No functional change.
2021-03-14 20:18:33 +00:00
rillig
96491d26ea make: separate parsing and evaluating for modifier '::='
No functional change.
2021-03-14 20:12:16 +00:00
rillig
d4faf73862 make: in parse-only mode, do not update the expression value in ':sh'
No functional change outside debug mode.  The other variable modifiers
behave in the same way.
2021-03-14 20:09:26 +00:00
rillig
96faeb06ee make: do not evaluate the ':O' modifiers in parse-only mode
No functional change in practical usage.  Theoretically this change can
be observed by looking at the generated random numbers for the ':Ox'
modifier, but the quality or exact sequence of these random numbers is
not guaranteed anyway.
2021-03-14 20:03:56 +00:00
rillig
f7a4d3a3e0 make: separate parsing and evaluating in the ':O' modifiers
No functional change.
2021-03-14 20:00:48 +00:00
rillig
812ef981d6 make: do not evaluate modifier ':[...]' in parse-only mode
In parse-only mode, variable expressions in the argument to that
modifier are not resolved.  This led to the error message about the 'Bad
modifier' in var-eval-short.mk.
2021-03-14 19:29:37 +00:00
rillig
ef2d559187 make: do not evaluate modifiers ':M' and ':N' in parse-only mode
No functional change outside debug mode (-dv for ModifyWord_Match).
2021-03-14 19:25:05 +00:00
rillig
aaaf8460b3 make: do not return unevaluated 'else' part from the ':?' modifier
No functional change outside debug mode.
2021-03-14 19:21:28 +00:00
rillig
91f10d43f6 tests/make: add test for the ':?' modifier in parse-only mode
The debug output for this scenario will change a bit in an upcoming
commit, but that will not affect anything outside the debug log.
2021-03-14 19:16:41 +00:00
rillig
c8091d0b16 make: do not evaluate ':gmtime' and ':localtime' in parse-only mode
No functional change.
2021-03-14 18:30:24 +00:00
rillig
99e5bcf513 make: don't evaluate several simple modifiers in parse-only mode
This affects the modifiers ':E', ':H', ':P', ':Q', ':R', ':T', ':hash',
':q', ':range', ':tl', ':ts', ':tu', and ':u'.  All these modifiers are
side-effect free.

Skipping the evaluation for these modifiers is purely for code
consistency and performance.

No functional change.
2021-03-14 18:23:44 +00:00
rillig
a1837566a4 make: skip strdup when parsing an irrelevant ':L' modifier
No functional change.
2021-03-14 18:10:57 +00:00
rillig
ae0a762a50 make: skip memcpy when parsing but not evaluating ':D' and ':U'
No functional change, just a tiny bit of performance improvement,
probably not even measurable.  Having the code nevertheless serves as a
copy-and-paste template for implementing other modifiers that might
perform more costly tasks.
2021-03-14 18:08:25 +00:00
rillig
a1747f17a6 make: only evaluate the ':@' modifier if the result is actually used
The test 'var-eval-short' had produced the output 'unexpected' before,
on stderr.  It had been generated by '${:Uword:@${FAIL}@expr@}' by
combining the following obscure "features" of make:

1.  the ':@' modifier loops over the words of the variable.  This
    modifier is not really obscure, it still takes some time to get used
    to it.

2.  the ':@' modifier allows a '$' sign in the variable name, which is
    useless in practice.

3.  the ':@' modifier creates a temporary loop variable in the global
    namespace.  Luckily there are only few collisions with other
    variable names since their naming conventions differ.

4.  after looping over the words of the expression, the temporary global
    loop variable is deleted, and at that point the '$' is expanded,
    being interpreted as the start of a variable expression.

5.  The ':@' modifier deleted the global variable even when it was
    called in parse-only mode (without VARE_WANTRES).

When the modifier ':@' was initially added to make in var.c 1.40 from
2000-04-29, Var_Delete didn't expand the variable name.  That feature
was added in var.c 1.174 from 2013-05-18, probably without thinking of
this very edge-casey combination of features.

This commit fixes item 5 from the above list.  The other obscurities
remain for now.
2021-03-14 18:02:44 +00:00
rillig
9ac0661025 make: eliminate common subexpression in ApplyModifier_Remember
No functional change.
2021-03-14 17:38:24 +00:00
rillig
71128ca3aa make: merge duplicate code in ApplyModifier_Remember
This way, parsing and evaluating the modifier is only written once in
the code.  The downside is that the variable name is allocated even if
VARE_WANTRES is not set, but since this modifier is so obscure and
seldom used this doesn't matter in practice.
2021-03-14 17:34:50 +00:00
rillig
0fc517c113 make: do not expand the variable name in the ':_' modifier
This edge case had been so obscure that even discovering this takes
quite some time and requires reading the source code of make.

The manual page doesn't document whether the variable name is expanded
or not, it doesn't even give an example.  When this obscure modifier was
initially added in var.c 1.210 from 2017-01-30, Var_Set always expanded
the variable name once, and there was no way around it.  Therefore this
expansion has probably been unintentional.
2021-03-14 17:27:27 +00:00
rillig
a442584d73 tests/make: demonstrate unintended edge case for the ':_' modifier 2021-03-14 17:14:15 +00:00
rillig
d905f14720 tests/make: convert test for ':_' modifier to parse time 2021-03-14 17:07:11 +00:00
rillig
64a393d8af make: only evaluate the ':_' modifier if the expression is needed
See var-eval-short.mk:46 for the test demonstrating this change.
Previously, the expression ${:Uword:_=VAR} was evaluated including all
its side effects even though it was in an irrelevant branch of the
condition.
2021-03-14 16:43:30 +00:00
rillig
c361e1ef2f make: return failure in TryParseIntBase0 for empty string
No functional change since the only caller of TryParseIntBase0 already
handles all possible parse errors.  Without this check, the code just
looked wrong though.
2021-03-14 16:03:04 +00:00
rillig
f3e066bf1b make: add test for edge case in modifier ':[...]'
TryParseIntBase0 wrongly returns successful for a string that does not
start with a number at all.  Its only caller, ApplyModifier_Words,
already handles all error cases properly.

No functional change.
2021-03-14 16:00:07 +00:00
rillig
c9c8cb6d43 make: separate parsing from evaluating for several modifiers
This aligns the implementation of these modifiers with the requirements
in the long comment starting with 'The ApplyModifier functions'.

No functional change.
2021-03-14 15:43:31 +00:00
rillig
54f9178de3 make: reduce indentation in ApplyModifier_SunShell
No functional change.
2021-03-14 15:24:37 +00:00
rillig
5367d2f7c6 make: separate parsing and evaluating for modifier ':u'
No functional change.
2021-03-14 15:22:21 +00:00
rillig
a0706d9698 make: separate parsing and evaluating for modifiers ':Q' and ':q'
No functional change.
2021-03-14 15:19:15 +00:00
rillig
d74102acf0 make: extract duplicate code for parsing ':S' and ':C'
No functional change.
2021-03-14 15:15:28 +00:00
rillig
3e9e13f502 make: extract duplicate code for detecting a modifier's end
No functional change.
2021-03-14 15:06:19 +00:00
rillig
115656881d make: document how error handling should be done correctly
Right now, when a variable expression cannot be parsed, the result of
calling Var_Subst is a string containing garbage, and no error is
reported.  In addition, there are some silent errors that are not
reported at all.  This combination makes it difficult to change the
error handling without introducing subtle breakage in some edge cases.

An example for garbage output is in varmod-subst-regex.mk, in target
mod-regex-compile-error.

No functional change.
2021-03-14 15:04:13 +00:00
rin
8b206140eb Build rump for PPC_OEA64 on evbppc64. 2021-03-14 13:11:59 +00:00
rillig
63e8f1e660 tests/make: add test for short-circuit evaluation of modifiers 2021-03-14 11:49:37 +00:00
rillig
58e152bdc2 make: sort modifiers in ApplyModifier alphabetically
No functional change.
2021-03-14 11:15:37 +00:00
rillig
8902b05acf make: fix wrong expression evaluation in -dL mode
The modifier ':C' now only compiles the regular expression if the result
of the expression is actually needed.

Several other modifiers have the same bug of evaluating the expression
in cases where this is not needed.  It just doesn't show up because they
don't have any noticeable side effects, other than wasting CPU time.
This affects irrelevant conditions as well.
2021-03-14 10:57:12 +00:00
rillig
0ed436993c make: demonstrate wrong expression evaluation in -dL mode 2021-03-14 10:45:51 +00:00
skrll
4cfcc99482 Sprinkle kpreempt_{dis,en}able ready for when preemption gets turned on. 2021-03-14 10:36:46 +00:00
skrll
34ee086f83 Use fdtbus_intr_establish_xname 2021-03-14 08:16:57 +00:00
skrll
7fb67d6ed3 No need to have an MD #ifdef in an MI file, so remove it. 2021-03-14 08:13:58 +00:00
skrll
41a3438ddf Remoave an extra space from a comment 2021-03-14 08:10:23 +00:00