Commit Graph

16854 Commits

Author SHA1 Message Date
rillig
0197fc8fc4 lint: split cluparg into separate functions
That function did more than its short name could express, and the things
it did were not related in any way.
2020-12-30 13:17:42 +00:00
rillig
47bf7e655e lint: replace LERROR with lint_assert
This removes the redundancy of mentioning the function name in the error
message.  This redundancy had been correct in all but 2 cases:
build_real_imag and tsize.
2020-12-30 12:22:51 +00:00
rillig
6bddcb2931 lint: spell check comments 2020-12-30 11:56:10 +00:00
rillig
9db9468642 lint: fix Clang-tidy warning about narrowing conversion 2020-12-30 11:47:15 +00:00
rillig
9ec3ffac74 lint: remove unused macro STRBLEN 2020-12-30 11:43:13 +00:00
rillig
ea78491f30 lint: inline STRUCT_ASSIGN
This had only been necessary for some pre-C90 compilers.
2020-12-30 11:39:55 +00:00
rillig
3bd4b094fc lint: un-abbreviate s_dpos, s_spos and s_upos 2020-12-30 11:14:03 +00:00
rillig
eb502cf640 lint: un-abbreviate s_field, s_keyw and s_xsym 2020-12-30 11:04:48 +00:00
rillig
a2826784dd lint: un-abbreviate parenthesized and _strg 2020-12-30 10:56:51 +00:00
rillig
873deaeeb7 lint: rename remaining _nxt members to _next 2020-12-30 10:49:10 +00:00
rillig
c5b43f746f lint: rename more _nxt members to _next 2020-12-30 10:46:11 +00:00
rillig
a2cbddd569 lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
2020-12-30 10:35:38 +00:00
rillig
95c0030060 lint: rename s_nxt to s_next 2020-12-30 10:26:12 +00:00
rillig
b754dcb0cc make(1): format multi-line comments 2020-12-30 10:03:16 +00:00
rillig
106bafb2f3 lint: reduce nesting of function calls 2020-12-30 01:44:32 +00:00
ginsbach
05e6749c39 nl: fix -d delim parsing for POSIX
POSIX specifies it is possible to specify a one delimiter character.
Fix the logic so that both one and two character delimiters are accepted.
2020-12-30 01:42:31 +00:00
rillig
64e104d6f9 lint: reduce verbosity of assertions
Having 2 lines of source code per assertion is too much, especially
since most of this code is redundant anyway.  Extract the common code
and the additional negation into a simple function instead.
2020-12-30 01:33:30 +00:00
rillig
85b03529a9 lint: add debug logging to the parser
Even with -DDEBUG and -DYYDEBUG, the debug output is not detailed enough
to clearly see what happens.

Add some custom debug logging to the parser, mainly for demonstration
purposes, and also to find out how to fix the test d_struct_init_nested.
2020-12-30 01:02:38 +00:00
rillig
dcab0392c7 lint: rename istk_t.i_cnt to i_remaining 2020-12-29 23:12:48 +00:00
rillig
8ed5e02447 lint: rename functions that had very short names 2020-12-29 23:04:31 +00:00
rillig
a5a7f2dbca lint: fix typo in comments 2020-12-29 21:32:46 +00:00
rillig
1af901126c lint: untangle conditions in initstack_next_nobrace 2020-12-29 20:56:28 +00:00
rillig
243e03680f lint: clean up debug logging for initializations 2020-12-29 20:07:04 +00:00
rillig
447de2e185 lint: make debug output for initializations more uniform 2020-12-29 19:57:44 +00:00
rillig
ca73041003 lint: remove redundant function prototypes 2020-12-29 19:09:53 +00:00
rillig
351a1350bb lint: improve debug output for initializing structs
Still trying to find out where the wrong warning in d_struct_init_nested
comes from.
2020-12-29 19:02:16 +00:00
rillig
374913ae51 lint: split complete_tag into separate functions 2020-12-29 17:29:31 +00:00
rillig
eaac8d6f4d lint: split initstack_next into separate functions 2020-12-29 16:59:12 +00:00
rillig
1d9b6c3dda lint: split initstack_pop into separate functions 2020-12-29 16:53:36 +00:00
rillig
312ed535ca lint: rename functions for handling the initialization stack 2020-12-29 16:48:53 +00:00
rillig
2008c479fd lint: rename functions with very short names 2020-12-29 13:33:03 +00:00
rillig
6e356060f2 lint: remove redundant parentheses around return value 2020-12-29 12:29:03 +00:00
rillig
132ce748b5 lint: fix indentation and alignment that used space-tab 2020-12-29 12:18:42 +00:00
rillig
454956c699 lint: spell check 2020-12-29 11:54:56 +00:00
rillig
9068543091 lint: remove redundant parentheses around return value 2020-12-29 11:35:11 +00:00
rillig
1864d10dbc lint: rename functions that had very short names
C99 guarantees that the first 31 characters of an identifier with
external linkage are significant.  This removes the need to use
abbreviations for common words.
2020-12-29 10:24:22 +00:00
rillig
df20b01d0d make(1): clean up code in extracted ExportVar functions 2020-12-29 03:21:09 +00:00
rillig
1bddd5d3de make(1): split ExportVar into separate functions 2020-12-29 03:05:15 +00:00
rillig
dc3491a1cc make(1): rename local variables in Var_ReexportVars 2020-12-29 01:48:46 +00:00
rillig
c182aecfbc make(1): add test that explains how variables are exported
Exporting the variables at the right time and with the correct values is
a subtle issue.  The current implementation carefully marks variables as
ready to be exported, then exports them and at the same time tries to
export as few variables as possible, to avoid memory leaks.  This test
describes and explains how all this works in detail.

This test also justifies that the call to Var_ReexportVars happens in
the make process itself, not in the child processes, no matter whether
these are created with vfork or (only theoretically) with plain fork.
This has changed in compat.c 1.217, job.c 1.390 and main.c 1.504 from
2020-12-27.
2020-12-29 01:45:06 +00:00
rillig
e2e06973fc lint: rename confusing function setcompl
The previous function name suggested that it would set the complete flag
of the type, but it was the exact opposite.  To reduce confusion, negate
the meaning of the parameter.
2020-12-28 22:31:31 +00:00
rillig
e0f7967137 lint: remove trailing whitespace 2020-12-28 22:16:42 +00:00
rillig
0ab178ad4b lint: spell check 2020-12-28 21:24:55 +00:00
rillig
1129695e46 lint: remove trailing whitespace 2020-12-28 19:47:42 +00:00
rillig
9be60dc2a5 lint: rename fields in mod_t 2020-12-28 19:38:54 +00:00
rillig
85dfb0396a lint: sort includes 2020-12-28 19:07:43 +00:00
rillig
d7e85c8e1e lint: realign code 2020-12-28 19:02:16 +00:00
rillig
de8e6de031 lint: rename tspec macros 2020-12-28 18:49:02 +00:00
rillig
95b384ac0e lint: fix typo in comment 2020-12-28 18:06:23 +00:00
rillig
76736a6e95 make(1): rename Buf_Expand_1 to Buf_Expand 2020-12-28 15:42:53 +00:00
rillig
a2efb39127 make(1): remove mmap for loading files, only allow files < 1 GiB
Using mmap is beneficial if the loaded data is read-only, or if it is
accessed in random order.  Neither of these applies here.  When loading
a file, make reads it strictly from top to bottom, once.  During
parsing, the loaded data is modified in-place to insert '\0' and '\n'
for terminating strings and lines.  Because of all of this, there is no
benefit in using mmap.

Reading the file using 2 calls to read(2) (one for the data, one for
checking for EOF) loads the data in a single pass, instead of producing
a page fault whenever the parser passes another page boundary.

Use a Buffer for loading the file data, to avoid calling bmake_realloc
directly.

Do not resize the loaded buffer at the end.  Each loaded file is
short-lived anyway, and only a few files are loaded at the same time, so
there is no point in optimizing this part for low memory usage.
2020-12-28 15:21:33 +00:00
rillig
355b925473 lint1: remove unused t_field 2020-12-28 12:56:33 +00:00
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
rillig
f2023805b3 make(1): remove excess newline from parse errors (since 2020-11-01)
For the modifiers :gmtime and :localtime, the excess newline had been
added in var.c 1.631 from 2020-10-31 21:40:20.

For the modifiers :range and :ts, the excess newline had been added in
var.c 1.635 from 2020-11-01 14:36:25.
2020-12-21 21:04:18 +00:00
rillig
ecb61f4a92 make(1): align tests for :localtime with those for :gmtime
These tests had been almost the same before, now they are as similar as
possible again.
2020-12-21 20:47:29 +00:00
rillig
23e24e814c make(1): move tests for :gmtime to parse time
It's easier to have both the expressions and the expected values in a
single file.  This also allows for flexible handling of multiple
acceptable outputs, in this case for 32-bit time_t.
2020-12-21 20:35:17 +00:00
sjg
2de15e97b5 Set default for .MAKE.OS once 2020-12-21 18:22:31 +00:00
rillig
8277081861 make(1): remove redundant parameters from ParseModifierPart 2020-12-21 02:38:57 +00:00
rillig
0743b63f41 make(1): fix garbled output for failed shell command (since 2020-12-20)
Passing a struct as printf argument for the %s conversion doesn't work.
On NetBSD-8.0-x86_64, the output looks normal, but on SunOS-5.9, the
output is garbled, containing bytes 0xFF and 0xFE.

This bug had been introduced in parse.c 1.507 from 2020-12-20 14:52:16.

Thanks to sjg for finding this bug so quickly.
2020-12-21 02:09:34 +00:00
rillig
fcd6900042 make(1): save a few memory allocations in variable expressions 2020-12-21 00:30:13 +00:00
rillig
e6694a528e make(1): switch memory handling from MFStr to FStr
This makes all intermediate strings constant.  For this simple
search-and-replace refactoring, all intermediate locations where the
"current value of the expression" was stored had to be of the type
MFStr.

Using FStr instead of MFStr allows to save a few memory allocations,
which will be done in the follow-up commits.
2020-12-21 00:20:58 +00:00
rillig
be2b5e4446 make(1): clean up memory management for expanding variable expressions
Previously, memory management had been split among several variables.
The general idea was very simple though.  The current value of the
expression needs to be kept in memory, and each modifier either keeps
that value or replaces it with its own newly allocated result, or
var_Error or varUndefined.

Using MFStr, it does not matter anymore that var_Error and varUndefined
are statically allocated since these are assigned using MFStr_InitRefer.

The complexity of the implementation is now closer to the actual
complexity.  Most probably the code can be simplified even more.
2020-12-21 00:11:29 +00:00
rillig
23688beebb make(1): add tests for :tW and :tw modifiers 2020-12-20 23:29:50 +00:00
rillig
b8f5741af7 make(1): use FStr for ApplyModifiersState.newVal
Memory management is still complicated in this area.  To clean this up,
the previous value of the expression needs to be converted to an MFStr
first, and later to an FStr.
2020-12-20 23:27:37 +00:00
rillig
26a72fc416 make(1): add tests for variable modifiers on trailing slashes 2020-12-20 22:57:40 +00:00
rillig
94f06ed7ea make(1): fix undefined behavior in meta_oodate
Do not increment a null pointer.

Do not assign to a variable twice in the same statement.  To be fair,
this may be safe because of the sequence point when the function is
called, but anyway, it looks too close to undefined behavior.
2020-12-20 22:36:40 +00:00
rillig
06ccd6ce96 make(1): reduce scope of cp in meta_oodate
That function is way too long (550 lines) and has too creative variable
names such as fname, fname1, fname2, fname3.
2020-12-20 22:12:36 +00:00
rillig
4b4d56707b make(1): fix declared variable type in printCMDs
No functional changes since StringListNode and GNodeListNode are both
typedefs of a simple generic ListNode.
2020-12-20 22:02:54 +00:00
rillig
5196cc55b0 make(1): omit linear search for command in Compat_RunCommand 2020-12-20 21:07:32 +00:00
rillig
7a800efcdb make(1): remove redundant assignment in ApplyModifier_SysV 2020-12-20 19:51:37 +00:00
rillig
00ba7da94c make(1): error out on unknown variable modifiers at parse time
Before, make printed an "error message" that did not include the word
error and thus was not easily identified as such.  This "error message"
also did not influence the exit status in the default mode but only in
-dL mode.  The error message also didn't include any line number
information and was thus rude.
2020-12-20 19:47:34 +00:00
rillig
d52e9b267b make(1): include line numbers in output of test varmod-edge.mk
Suppressing the line numbers does not provide much benefit, given that
the test file doesn't change often.
2020-12-20 19:37:23 +00:00
rillig
374368e991 make(1): move tests for indirect modifiers around
The next commit will error out on unknown modifiers and influence the
exit status.  The test modmisc.mk contains both parse time tests and run
time tests.  To prevent the latter from being run, the parse error is
moved to varmod-indirect.mk, which only contains parse time tests.
2020-12-20 19:29:06 +00:00
rillig
b1b3d2f62b make(1): remove wrong error message for indirect modifier in lint mode 2020-12-20 19:10:53 +00:00
rillig
4938cf88d2 make(1): document that indirect modifiers fall back to SysV modifiers 2020-12-20 19:02:28 +00:00
rillig
9c42de2852 make(1): remove redundant const declarations for parameters 2020-12-20 18:23:24 +00:00
rillig
ffd320932f make(1): extract ApplySingleModifier from ApplyModifiers 2020-12-20 18:13:50 +00:00
rillig
e2fd21af29 make(1): turn ApplyModifiersState.val into a local variable
This reduces the scope and makes it more obvious at which places this
variable can be changed and how the memory management is done.
2020-12-20 17:22:10 +00:00
rillig
0e4ce27167 make(1): use FStr for memory management in Var_SetWithFlags 2020-12-20 15:31:29 +00:00
rillig
fa8bd88f04 make(1): extract SetVar from Var_SetWithFlags
SetVar contains the part that is not concerned about memory management
and expansion of the variable name.
2020-12-20 15:26:40 +00:00
rillig
eb277e70f2 make(1): fix memory leak in Var_Delete (since yesterday)
The memory leak had been introduced in var.c 1.736 from 2020-12-19
20:47:24.
2020-12-20 15:04:29 +00:00
rillig
80fba7d531 make(1): clean up memory handling in VarAssign_EvalShell 2020-12-20 14:52:16 +00:00
rillig
0b4b42e295 make(1): clean up memory handling in Parse_DoVar 2020-12-20 14:48:35 +00:00
rillig
431ba0ec4b make(1): remove constant parameter from MakeMode 2020-12-20 14:39:46 +00:00
rillig
0307413016 make(1): change return type of Var_Value to FStr 2020-12-20 14:32:13 +00:00
rillig
0462095db2 make(1): use FStr in VarNew 2020-12-20 13:50:10 +00:00
rillig
03f1822098 make(1): eliminate libName_freeIt from Arch_ParseArchive 2020-12-20 13:46:27 +00:00
rillig
7b3d8cbe3a make(1): return FStr from Var_Parse
This reduces the number of variable declarations at the call sites.
2020-12-20 13:38:43 +00:00
rillig
49eb293fd6 make(1): clean up memory handling in CondParser_String 2020-12-20 13:03:48 +00:00
rillig
81b5e18281 make(1): export FStr and MFStr
These types are a replacement for the pattern "var + var_freeIt" that
enforces these two variables to be updated together.
2020-12-20 12:53:34 +00:00
rillig
37fbcac361 make(1): clean up memory handling in CondParser_String 2020-12-20 12:46:49 +00:00
rillig
8f72c319f5 make(1): document memory handling in ApplyModifiers 2020-12-20 11:38:51 +00:00
rillig
0af8f23f02 make(1): replace freeIt with FStr in EvalUndefined
Previously, the parameter out_freeIt was not guaranteed to be
initialized in every case, at least when looking only at EvalUndefined.
This contradicted the variable name.

Replace the two parameters with a single FStr to ensure that these
variables are always initialized together.
2020-12-20 10:59:21 +00:00
rillig
19824f4691 make(1): replace FStr_Assign with separate initialization functions
In GetVarnamesToUnexport, there is no need to free the local FStr since
the only place where it is assigned an allocated string is at the very
end.

Having separate functions for the two main use cases of a possibly
allocated string makes the calling code simpler.  This is a preparatory
commit for making the memory allocation in ApplyModifiers easier to
understand.
2020-12-20 00:57:29 +00:00
rillig
e0de850d21 make(1): extract string functions from ApplyModifier_To 2020-12-20 00:47:21 +00:00
rillig
ab975bef9f make(1): fix error message for .info/.warning/.error without argument
Previously, the error message was "Unknown directive", which was
obviously wrong.  The new error message is "Missing argument".
2020-12-19 22:33:11 +00:00
rillig
7772d52765 make(1): error out if .undef has not exactly 1 argument 2020-12-19 22:10:17 +00:00
rillig
715d1d3bec make(1): extract Var_DeleteVar from Var_Delete 2020-12-19 20:47:24 +00:00
rillig
f11ec78a23 make(1): add tests for undefining variables with exotic names 2020-12-19 20:35:39 +00:00
rillig
a4d0870803 make(1): extract Var_Undef from ParseDirective 2020-12-19 20:16:36 +00:00
rillig
863c2319ae make(1): rewrite tests for misspelled .elif directive
Put the simple tests at the top, demonstrating that there are already
some cases in which the misspelled directive is detected.  It's not
detected though if the surrounding conditional branch is skipped.
2020-12-19 19:49:01 +00:00