Commit Graph

2231 Commits

Author SHA1 Message Date
rillig
6d5d05ff0f make(1): reduce code size in CondGetString
The pattern is now the usual "test the character, then increment the
pointer", throughout the whole function.
2020-09-10 23:37:54 +00:00
rillig
6ddbc03f29 make(1): skip redundant condExpr-- in CondGetString 2020-09-10 23:27:27 +00:00
rillig
2bf492c8b8 make(1): reduce code size for parsing the || or && operators
On x86_64, accessing [0] generates less code than [1].
2020-09-10 22:47:22 +00:00
rillig
949eb7fd83 make(1): add tests for the |, ||, ||| operators 2020-09-10 22:44:08 +00:00
rillig
89d5f8aeda make(1): add test for the &, && and &&& operators 2020-09-10 22:38:57 +00:00
rillig
1aa23ac7b9 make(1): add test for .SILENT 2020-09-10 21:40:50 +00:00
rillig
fb492da4a2 make(1): add test for .MAKEFLAGS 2020-09-10 21:22:07 +00:00
rillig
aa448ea91d make(1): clean up comments in cond.c 2020-09-08 18:51:23 +00:00
rillig
76c80899be make(1): add CondLexer_SkipWhitespace 2020-09-08 18:10:34 +00:00
rillig
9b7d994754 make(1): rename CondLexer.condPushBack to curr
This variable has some context information from the struct now,
therefore its name can be shorter.
2020-09-08 18:06:27 +00:00
rillig
be4d8db544 make(1): group the condition parsing state into a struct
Instead of having 3 global variables, the struct clearly communicates
that the 3 variables belong together. During debugging, it's easy to
just "p *lex" instead of remembering the names of the 3 former global
variables.

Converting the global variables into a local variable makes it
immediately clear that the functions in this file operate on this
struct.  Keeping the global variables in mind is more difficult.  Having
a local variable also gets rid of the 3 sv_* variables in
Cond_EvalExpression, which were also a sign that these "global
variables" were not that global at all.

This commit only contains the minimal code changes for converting the
variables into a local struct.  It was tempting to add functions like
CondLexer_SkipWhitespace, but this is better left for a follow-up
commit.
2020-09-08 17:55:23 +00:00
rillig
9f6b7470f7 make(1): in CondGetString, replace repeated Buf_Add with Buf_AddStr 2020-09-08 14:51:43 +00:00
rillig
d8bc78b637 make(1): add test for wildcards in dependency declarations 2020-09-08 05:33:05 +00:00
rillig
112c95a538 make(1): fix off-by-one error in SuffExpandChildren
In suff.c r1.144 from yesterday, in the line "cp += nested_p - cp", I
accidentally removed the "- 1".  Since these "- 1" lines lead to slow
execution, each branch now increments the pointer separately by the
actually needed amount.

Fixing this bug posed way more new questions than it answered, and it
revealed an inconsistency in the parser about how characters are to be
escaped, and missing details in the documentation of Var_Parse, as well
as a parse error that unexpectedly doesn't stop make from continuing.
2020-09-08 05:26:21 +00:00
rillig
3bb127c1bf make(1): document that nested braces work as expected now 2020-09-07 19:48:08 +00:00
rillig
db958a8ce2 make(1): extend and explain the test for comments 2020-09-07 19:17:36 +00:00
rillig
107d144dad make(1): explain why each test is run in a sub-make 2020-09-07 18:49:15 +00:00
rillig
1d8529b09b make(1): use consistent spelling for postprocessing 2020-09-07 18:43:59 +00:00
rillig
4144affb22 make(1): add test for the .WAIT dependency source 2020-09-07 18:40:32 +00:00
rillig
cf16582094 make(1): with -dp, print name of the function instead of its address
This makes the output a bit more reproducible.  There are still the file
descriptors, which may differ between different runs, but at least the
nextbuf function is printed using a symbolic name instead of a meaningless address.
Besides loadedfile_nextbuf, the only other function is ForIterate.
2020-09-07 18:37:09 +00:00
rillig
c7c417c4f1 make(1): migrate SuffExpandChildren to Var_ParsePP 2020-09-07 07:15:26 +00:00
rillig
11dcb9bdaf make(1): migrate to Var_ParsePP in Var_Parse and Var_Subst 2020-09-07 07:10:56 +00:00
rillig
11af043635 make(1): migrate ApplyModifiers to Var_ParsePP 2020-09-07 07:04:30 +00:00
rillig
193b2ca5f4 make(1): migrate Var_Parse to Var_ParsePP in ParseDoDependency 2020-09-07 06:58:02 +00:00
rillig
163aaa9b04 make(1): migrate Var_Parse to Var_ParsePP in archive handling 2020-09-07 06:51:05 +00:00
rillig
a41c30d038 make(1): remove unnecessary cp-- from Arch_ParseArchive 2020-09-07 06:44:53 +00:00
rillig
40b40038da make(1): save a strlen call in ForIterate 2020-09-07 06:28:22 +00:00
rillig
83915ab45f make(1): constify local variables in ForIterate 2020-09-07 06:27:29 +00:00
rillig
ae6eb8a7cc make(1): split local variable in ForIterate 2020-09-07 06:26:18 +00:00
rillig
953112797d make(1): remove redundant includes 2020-09-07 06:20:07 +00:00
rillig
28d4e7745c make(1): convert ForEscapes from #define to enum 2020-09-07 06:01:11 +00:00
rillig
ca751b452a make(1): add local variable for escapes to for_substitute
Just for debugging.  No change in code size.
2020-09-07 05:58:08 +00:00
rillig
4186926f7b make(1): clean up comments in job.c 2020-09-07 05:32:12 +00:00
rillig
3f25d2876e make(1): fix archive test when .CURDIR != .PARSEDIR 2020-09-07 05:16:32 +00:00
rillig
fa00c797c6 make(1): add const for Parse_IsVar 2020-09-06 19:34:36 +00:00
rillig
78cc09048b make(1): add const to For_Eval and For_Accum 2020-09-06 19:30:53 +00:00
rillig
2d9413362f make(1): clean up For_Eval
* Reduce scope of local variables.
* Remove unnecessary null character test before positive isspace call.
2020-09-06 19:28:49 +00:00
rillig
44d49322ad make(1): properly initialize For structure in For_Eval
Initializing a Buffer or a strlist_t with zero-valued bytes only works
by conincidence, but because it would be the correct way.  In the code
path "missing `in' in for", that zero-filled Buffer is freed using
Buf_Destroy, which could have invoked undefined behavior.
2020-09-06 19:24:12 +00:00
rillig
0244d862b4 make(1): improve documentation in For_Eval 2020-09-06 19:19:49 +00:00
rillig
47ba525800 make(1): fix type of For.short_var 2020-09-06 19:18:16 +00:00
rillig
d2ef6c55f3 make(1): add test for the -de option 2020-09-06 04:35:03 +00:00
rillig
000f3267b7 make(1): replay the changes from v1.283
I accidentally reverted them in v1.284.
2020-09-05 19:11:16 +00:00
rillig
f31746d78f make(1): clean up comments about parsing 2020-09-05 19:07:25 +00:00
rillig
c058562d66 make(1): fix comments about setting .PARSEDIR and .PARSEFILE 2020-09-05 18:41:59 +00:00
rillig
568c2fcd37 make(1): make GetActuallyIncludingFile faster
In deeply nested includes, starting the search from the inner end is
faster since it needs fewer comparisons.
2020-09-05 18:31:03 +00:00
rillig
3dd79b1f4a make(1): fix .INCLUDEDFROMDIR/.INCLUDEDFROMFILE 2020-09-05 18:18:05 +00:00
rillig
118ec9dfc5 make(1): add test for .INCLUDEDFILE combined with .for loops
The .for loops are implemented as a special kind of .include, therefore
they affect the .INCLUDEDFROM variable.
2020-09-05 18:13:47 +00:00
rillig
8981885e47 make(1): make test for .INCLUDEDFROMDIR simpler
The .info and .warning directives provide exactly the early expansion
that this test needs.  No more .for for getting a snapshot of a
variable.
2020-09-05 16:59:19 +00:00
rillig
9378c3ad8d make(1): add tests for some of the special sources 2020-09-05 15:57:12 +00:00
rillig
613d864f26 make(1): fix local variable type in ParseIsEscaped 2020-09-05 15:12:03 +00:00