Commit Graph

16702 Commits

Author SHA1 Message Date
rillig
c631bd0242 lint1: remove trailing whitespace 2020-12-28 12:52:45 +00:00
htodd
5ed8424a90 Go into the resize directory to build/install the files since they're in the sets. 2020-12-28 03:48:41 +00:00
rillig
fc135022e2 make(1): replace global preserveUndefined with VARE_KEEP_UNDEF
Controlling the expansion of variable expressions using a global
variable and a VARE flag was inconsistent.

Converting the global variable into a flag had to prerequisites:

1.  The unintended duplicate variable assignment had to be fixed, as
done in parse.c 1.520 from 2020-12-27.  Without this fix, it would have
been necessary to add more flags to Var_Exists and Var_SetWithFlags, and
this would have become too complex.

2.  There had to be a unit test demonstrating that VARE_KEEP_DOLLAR only
applies to the top-level expression and is not passed to the
subexpressions, while VARE_KEEP_UNDEF applies to all subexpressions as
well.  This test is in var-op-expand.mk 1.10 from 2020-12-28, at least
for the ':@word@' modifier.  In ParseModifierPartSubst, VARE_KEEP_UNDEF
is not passed down either, in the same way.
2020-12-28 00:46:24 +00:00
rillig
f56290c2b3 make(1): extend test for modifier parts in ':=' assignments 2020-12-28 00:19:41 +00:00
rillig
6242d146aa make(1): add test for modifier parts in ':=' assignments 2020-12-27 23:25:33 +00:00
rillig
7c100c94f2 make(1): fix edge case in := with undefined in variable name
Previously, the assignment "VAR${UNDEF} := value" actually assigned to 2
variables.  See var-op-expand.mk for details.
2020-12-27 22:29:37 +00:00
rillig
2395673142 make(1): move test result of var-op-expand.mk from exp to mk
This makes it easier to run this test in older versions of make.  Empty
output means success.
2020-12-27 21:31:27 +00:00
reinoud
de9e35d4ce Make the new resize(1) manpage indistinguisable from the original 2020-12-27 21:25:02 +00:00
rillig
12e256c877 make(1): add more tests for ':=' assignments 2020-12-27 21:19:13 +00:00
reinoud
ef6e52b452 Import Xterm's resize(1) for querying (x)terminal sizes in base for headless
clients
2020-12-27 21:13:17 +00:00
rillig
3038064b5b make(1): add tests for variable assignments using the ':=' operator 2020-12-27 20:45:52 +00:00
rillig
996e51af2c make(1): skip variable expansion in ParseDependencyTargetWord
The goal of the code is just to skip over the variable expression, thus
there is no need to evaluate it.
2020-12-27 18:22:28 +00:00
rillig
514845e5f2 make(1): add test for ParseDependencyTargetWord 2020-12-27 18:20:26 +00:00
rillig
7eb297894b make(1): split test for indirect modifiers into paragraphs 2020-12-27 17:32:25 +00:00
rillig
970a54cb9f make(1): add tests for parsing indirect modifiers in nested expressions 2020-12-27 17:17:46 +00:00
rillig
9524640e66 make(1): remove dead code from ApplyModifiersIndirect
At that point, the expression can never be varUndefined.  At the
beginning of ParseVarnameLong, the expression is initialized to a simple
empty string, and that string is only ever converted to varUndefined at
the very end of Var_Parse.
2020-12-27 16:31:58 +00:00
rillig
565eefa2e5 make(1): remove outdated comment about string comparisons
Back in 1993, the variables in a context were stored in a linked list.
Searching such a list indeed required literally thousands of calls to
strcmp.  In make.h 1.22 from 1999-09-15, the linked list was replaced
with a hash table, requiring much fewer string comparisons.  Since then,
the rationale doesn't apply anymore.
2020-12-27 14:41:25 +00:00
rillig
8eecc3ec3e make(1): remove unnecessary VPR_ERR_SILENT 2020-12-27 14:02:12 +00:00
rillig
cd38937700 make(1): do not inspect output variables in ParseVarnameShort 2020-12-27 13:15:43 +00:00
rillig
39c946421d make(1): move error handling code out of UndefinedShortVarValue 2020-12-27 13:12:34 +00:00
rillig
bb4b461edd make(1): exit 2 on technical errors
This allows the -q option to distinguish errors from out-of-date
targets.  Granted, it's an edge case but it should be solved
consistently anyway.

The majority of cases in which make exits with exit status 1, even in -q
mode, is when there are parse errors.  These have been kept as-is for
now as they affect many of the unit tests.

The technical errors, on the other hand, occur so rarely that it's hard
to write reliable tests for them that fail consistently on all platforms
supported by make.
2020-12-27 11:47:04 +00:00
rillig
7c7dae763b make(1): split Var_Subst into easily understandable functions
Extracting the character-level details makes the essence of Var_Subst
visible in the code, which is to iterate over the given text, handling a
few types of tokens.
2020-12-27 11:03:00 +00:00
rillig
fab83987ed make(1): clean up VarParseResult constants
The many constants were invented because at that time I didn't quite
understand the actual outcomes of Var_Parse that need to be
distinguished.  There are only a few:

(1) Errors, whether they are parse errors, or evaluation errors or
    undefined variables.  The old constants VPR_PARSE_MSG and
    VPR_UNDEF_MSG are merged into VPR_ERR.

(2) Undefined expressions in a situation in which they are allowed.
    Previously the documentation for VPR_UNDEF_SILENT talked about
    undefined expressions in situations where they were not allowed.
    That case is fully covered by VPR_ERR instead.

(3) Errors that are silently ignored.  These are probably bugs.

(4) Everything went fine, the expression has a defined value.
2020-12-27 10:53:23 +00:00
rillig
e0ea9a9396 make(1): remove unnecessary VPR_UNKNOWN for error handling
There is no sensible way for a caller of Var_Parse to deal with an error
state of "maybe successful, maybe not", therefore remove the constant
for it.
2020-12-27 10:09:53 +00:00
rillig
6c648b37ce make(1): add error handling for .for loop items
Right now, Var_Subst always returns VPR_OK, even if there had been parse
errors or evaluation errors.  If that is no longer true, the errors will
be reported properly.
2020-12-27 10:04:32 +00:00
rillig
9be4bfa647 make(1): add test for missing error handling in .for loop 2020-12-27 09:58:35 +00:00
rillig
eb9a329939 make(1): re-export variables from the actual make process
Since make uses vfork if available, re-exporting the variables happens
in the address space of the main process anyway, so there is no point in
mentioning anything about "our client process" anywhere.
2020-12-27 05:16:26 +00:00
rillig
0134a24c0d make(1): add test for expansion errors in jobs mode
Since compat mode and jobs mode are implemented separately and vary in
lots of small details, each of them needs to be tested on its own.
2020-12-27 05:11:40 +00:00
rillig
ea8c5a40a4 make(1): align names of VarExportMode with the directives 2020-12-27 05:06:17 +00:00
sjg
a3aef1439d Use .MAKE.DEPENDFILE as makefiles set it 2020-12-26 03:54:48 +00:00
maya
70f2b24ae4 Update to 2021, hopefully less errors made in this year. 2020-12-25 09:02:41 +00:00
dholland
5a724c86b4 List calendar's known calendars explicitly, and only install those.
Prevents build failures caused by installing editor backups and other
such silliness.
2020-12-25 07:00:52 +00:00
rillig
50fdf93be0 make(1): fix a few lint warnings 2020-12-23 14:13:49 +00:00
rillig
f351ad51cc make(1): fix lint warnings for constant condition in DEBUG calls 2020-12-23 14:05:32 +00:00
rillig
ee045a8229 make(1): fix MAKE_RCSID for lint mode
Previously, running lint mode didn't define MAKE_RCSID at all, which
resulted in a syntax error.

While here, reduced the indentation and nesting of the preprocessor
directives.
2020-12-23 14:03:13 +00:00
rillig
dff2a68ecc make(1): rename CmdOpts.lint to strict
When running lint(1) on the code, it defines the preprocessor macro
"lint" to 1, which generated a syntax error in the declaration "Boolean
lint", as that became "Boolean 1".
2020-12-23 13:50:54 +00:00
rillig
b3b6e90160 make(1): remove trailing whitespace in manual page 2020-12-23 13:49:12 +00:00
rillig
060e7853a4 make(1): fix memory leak in Var_Undef (since 2020-12-22) 2020-12-23 13:11:27 +00:00
rillig
82632c2fd8 make(1): fix return type of macro DEBUG
This macro was supposed to return a boolean expression all the time, it
just hadn't been implemented this way.  This resulted in wrong output
for the test sh-flags, in compilation modes -DUSE_UCHAR_BOOLEAN and
-DUSE_CHAR_BOOLEAN, since in ParseCommandFlags, the expression
DEBUG(LOUD) didn't fit into a boolean.
2020-12-22 22:31:50 +00:00
rillig
a542a5a6b7 make(1): allow .undef to undefine multiple variables at once
Since make doesn't support variable names containing spaces, this edge
case is not enough reason to stop this feature.  Having multiple
variable names as arguments nicely aligns with other directives such as
.for and .export.
2020-12-22 20:10:21 +00:00
rillig
ad8b5377ca make(1): add test for undefined variable in dependency declaration 2020-12-22 19:38:44 +00:00
ginsbach
332df7ed8f nl(1): remove superfluous exit
Remove exit(3) call missed when errors were converted to errx(3).
2020-12-22 17:50:55 +00:00
rillig
bd691351f1 make(1): fix comment in test about null bytes in makefiles 2020-12-22 08:57:23 +00:00
rillig
e6d109f2d3 make(1): re-add improved assertion in ParseGetLine 2020-12-22 08:51:30 +00:00
rillig
9582eb4d33 make(1): remove assertion about lines ending with '\n'
It fails the NetBSD build.sh.
2020-12-22 08:31:13 +00:00
rillig
0c15097160 make(1): clean up after test opt-file 2020-12-22 08:23:12 +00:00
rillig
75fb9c6afb make(1): remove needless assignment to line_end in ParseGetLine 2020-12-22 08:10:39 +00:00
rillig
b46e8d7cf5 make(1): fix assertion failure for files without trailing newline
Previously, mmapped files didn't always have the final newline added.
Only those that ended at a page boundary did.

This confused ParseRawLine, which assumed (and since parse.c 1.510 from
moments ago also asserted) that every line ends with a newline, which
allows the code to assume that after a backslash, there is at least one
other character in the buffer, thereby preventing an out-of-bounds read.

This bug had been there at least since parse.c 1.170 from 2010-12-25
04:57:07, maybe even earlier, I didn't check.

Now line_end always points to the trailing newline, which allows
ParseGetLine to overwrite that character to end the string.
2020-12-22 08:05:08 +00:00
rillig
8a4190c0a5 make(1): fix commit number in tests for :gmtime and :localtime 2020-12-22 07:22:39 +00:00
rillig
9b03887383 make(1): prevent undefined behavior in loadfile_mmap
Reading a file without a trailing newline had resulted in an
out-of-bounds write, in the common case where the file is loaded via
mmap.
2020-12-22 06:48:33 +00:00