Home | History | Annotate | Download | only in unit-tests
History log of /src/usr.bin/make/unit-tests/cond-func-empty.mk
RevisionDateAuthorComments
 1.29  11-Jun-2025  sjg make: check variable names for invalid characters

Variable names should not contain white-space.
As is; make quietly ignores gmake syntax like
$(addprefix -I, $(INCLUDE_DIR_LIST))
which means we are not doing what the makefile wants, and the
user has no clue.

CheckVarname is called only if there are no modifiers to be applied
as :L and others legitimately can handle white-space,
it will issue a warning if illegal characters are found.
Currently only white-space is checked.

The NetBSD build produces a few warnings - in one case a makefile
intended for gmake, and the other some dubious constructs by bsd.prog.mk
in support of ATF tests such as OBJS.${PROG} when PROG is actually a list.

Reviewed by: rillig
 1.28  11-Jan-2025  rillig make: omit redundant follow-up message "Malformed conditional"

If there is a parse error or an evaluation error during the conditional,
the conditional is already mentioned in the "while evaluating condition"
line, so there's no reason to repeat it once again.

Same for the "Bad condition" message from the '?:' modifier.
 1.27  10-Jan-2025  rillig tests/make: test expressions based on undefined variables

When an undefined variable is used in a conditional, make complains about
"Malformed conditional", which is wrong since the conditional is
well-formed but errors out during evaluation.

In order to fix this wrong error message and preserve the remaining
behavior, cover the places in which an expression is evaluated with
undefined expressions being an error (VARE_EVAL_DEFINED), but with
neither producing an error message nor handling errors. This combination
results in the same behavior as evaluating the expressions in the mode
that allows undefined variables to be used in expressions.
 1.26  06-Aug-2024  rillig make: in error message about conditionals, use single quotes

Single quotes are used less often in the conditionals themselves, which
leads to fewer confusions.
 1.25  02-Jun-2024  rillig branches: 1.25.2;
make: sync VarEvalMode constant names with their debug log names
 1.24  19-Dec-2023  rillig make: clean up comments

No binary change, except for line numbers in assertions.
 1.23  19-Nov-2023  rillig tests/make: replace 'variable expression' with 'expression'

Each expression is based on a variable, there's no need for the
verbosity. The wording in make's diagnostics will be changed in a
follow-up commit.
 1.22  11-Aug-2023  rillig tests/make: fix grammar in a test comment
 1.21  28-Jun-2023  rillig tests/make: extend test for the 'empty' function in conditions
 1.20  01-Jun-2023  rillig tests/make: force line-based diagnostics to be listed in the tests

This way, contradictions between the intended output and the actual
output are closer together and have a better chance of being spotted.
 1.19  01-Jun-2023  rillig tests/make: clean up comments, extend a few tests
 1.18  04-Mar-2023  rillig tests/make: improve explanations in test for 'empty' function
 1.17  28-Dec-2021  rillig tests/make: test function names without following '('
 1.16  11-Dec-2021  rillig make: inline ParseEmptyArg into CondParser_FuncCallEmpty

No functional change.
 1.15  11-Dec-2021  rillig tests/make: proofread and clean up comments for function 'empty'

This prepares a refactoring for handling the function 'empty' in
conditionals like '.if'.

The function 'empty' is fundamentally different from all other functions
since it is parsed differently and passes its result on different path
than the other functions. Splitting up these code paths will untangle
the control flow of parsing a condition like 'empty(VARNAME)'. It will
also remove several ARGSUSED and MAKE_ATTR_UNUSED that make the current
code smell.
 1.14  11-Apr-2021  rillig make: clean up remaining references to VarEvalFlags

VarEvalFlags has been replaced with VarEvalMode. There were some
comments and tests that still referred to the old names.

No functional change.
 1.13  15-Mar-2021  rillig 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.
 1.12  22-Feb-2021  rillig make: update constant names in comments

No functional change.
 1.11  28-Nov-2020  rillig make(1): move test for recursive variable to cond-func-empty

Previously, the documentation of that test was much too short to explain
all the effects that happened in the bug situation from 2020-06-28 until
2020-07-02.
 1.10  15-Nov-2020  rillig make(1): clean up some tests

Fix some mistakes in comments.

Improve some comments to be easier understandable.

Inline variables that are irrelevant for the test at hand (RUN,
MAKE_CMD).

Remove references to functions and constants that have since been removed
or renamed.
 1.9  07-Nov-2020  rillig make(1): add test for parse error in condition using empty()
 1.8  23-Sep-2020  rillig make(1): add tests for spaces in condition functions
 1.7  23-Sep-2020  rillig make(1): fix unexpected behavior in ::= variable modifier

Previously, the ::= modifier had returned an error value, which caused
the variable expression to be preserved. This behavior was not useful
in this case; it had only been intended to be used for undefined
variables.

To fix it, distinguish between parse errors, undefined variables and
regular empty strings.
 1.6  04-Sep-2020  rillig make(1): rename local functions for parsing conditions

The word "get" implies a cheap operation without side effects. Parsing
instead has lots of side effects, even if it's only that the parsing
position is updated.
 1.5  04-Sep-2020  rillig make(1): migrate get_mpt_arg to Var_ParsePP

This part is covered well by the unit tests. When I forgot to decrement
the linePtr, several of them failed reliably.
 1.4  04-Sep-2020  rillig make(1): add more explanation for undefined variable expressions
 1.3  03-Sep-2020  rillig make(1): add test for the empty function in conditionals
 1.2  16-Aug-2020  rillig make(1): describe the purpose of each newly added unit test dummy
 1.1  16-Aug-2020  rillig make(1): add dummies for fine-grained tests, one per single feature

The test names have been derived from the current manual page.

All these tests are dummies right now, and the code from the existing
tests will be moved into the new tests step by step.

This is done to prevent modmisc, escape, varmod-edge and varmisc from
growing without any bounds, and to reduce the side-effects of one test
to the others.
 1.25.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed