summaryrefslogtreecommitdiff
path: root/usr.bin/make/nonints.h
AgeCommit message (Collapse)Author
2022-01-23make: merge nonints.h into make.hrillig
No functional change.
2022-01-15make: remove unnecessary functions for expanding variable namesrillig
In meta mode, the affected variable patterns do not contain a '$'. Outside of meta mode, Global_SetExpand was only called a single time, so inline that call. No functional change.
2022-01-15make: merge duplicate code for expanding variable expressionsrillig
No functional change.
2022-01-09make: in Cmd_Exec, return error message instead of format stringrillig
This change leaves only literal format strings in parse.c. It allows for more detailed error messages than the current "non-zero status" or "exited on a signal". No functional change.
2022-01-09make: fix use-after-free in -dp mode (since yesterday)rillig
In a .for loop that contains an unclosed .if directive, Cond_restore_depth generates an error message. If stack traces are enabled using the option '-dp', the details of the .for loop are added to the stack trace, but at that point, the ForLoop had already been freed. To reproduce: make-2022.01.09.00.33.57 -r -f unit-tests/directive-for.mk -dp
2022-01-08make: add details about .for loop variables to stack tracesrillig
The stack traces are enabled with the debug logging option '-dp'.
2022-01-08make: fix reported line numbers of continuation lines (since 2002)rillig
Previously, multi-line directives like '.info' or '.error' reported the line number of their last line instead of their first line, which is more usual. This also affected the debug log from '-dp'.
2022-01-07make: remove redundant function parameter in suffix handlingrillig
Now that mainNode is globally visible, there is no need to pass it through function parameters. No functional change.
2022-01-07make: merge duplicate variables for the main targetrillig
No functional change.
2022-01-07make: eliminate file-scope variable forLevelrillig
No functional change.
2022-01-07make: rename and inline Targ_Preciousrillig
No functional change.
2022-01-02make: clean up handling of .for loops and .include directivesrillig
No functional change.
2022-01-01make: remove unused parameter from Parse_PushInputrillig
The parameter readMore was never NULL. No functional change.
2021-12-31make: unexport types VarAssignOp and VarAssignrillig
These types are only needed in the parsing module. No functional change.
2021-12-31make: list VarAssignOp in the same order as in the manual pagerillig
No functional change.
2021-12-29make: merge duplicate types CondEvalResult and CondResultrillig
No binary change.
2021-12-29make: remove redundant parameter for evaluating conditionsrillig
No functional change.
2021-12-28make: constify cached_realpathrillig
No binary change.
2021-12-27make: rename eunlink to unlink_filerillig
The name eunlink suggested a relation with the similarly named functions emalloc or esnprintf, but that was misleading. Instead, unlink_file works like unlink, except that it refuses to remove an empty directory. No functional change.
2021-12-15make: format comments according to /usr/share/misc/stylerillig
Assisted by indent(1), with manual corrections due to its many remaining bugs. No functional change.
2021-12-15make: change return type of Compat_RunCommand from int to boolrillig
The documentation was wrong before since status was not restricted to only 0 or 1. No functional change.
2021-12-15make: mark several functions whose result must be usedrillig
Suggested by sjg, to catch more bugs like the memory leak in cond.c 1.303 from 2021-12-13. No binary change.
2021-12-13make: fix memory leak when evaluating ${.SUFFIX} (since yesterday)rillig
2021-12-12Add .SUFFIXES as read-only variable.sjg
References to ${.SUFFIXES} are handled dynamically in ParseVarnameLong by calling Suff_NamesStr. The variable cannot be set normally. Reviewed by: rillig
2021-12-12make: rename Parse_SetInput to Parse_PushInputrillig
The word 'set' sounded too much like it would replace the current file, but instead the file is pushed to the stack, and the previous file is continued later. No functional change.
2021-09-12make: fix lint warnings for strict bool moderillig
In strict bool mode, lint does not consider 'x & y' as having type bool, if x and y have integer type, it only allows this for enums. No functional change.
2021-08-14make: rename variable and function for handling parse errorsrillig
The word 'fatals' was an unnecessary abbreviation. No functional change.
2021-04-11make: clean up remaining references to VarEvalFlagsrillig
VarEvalFlags has been replaced with VarEvalMode. There were some comments and tests that still referred to the old names. No functional change.
2021-04-11make: add types Substring and LazyBufrillig
These will be used for making the string handling more efficient, avoiding allocations, especially when evaluating variable expressions. Since the string handling has grown quite a bit in the last months, extract it into its own header file. No functional change.
2021-04-04make: convert VarEvalFlags back into an enum, but not a bit-setrillig
As was apparent in VarEvalFlags_ToString, a bit-set was not the best data type since most of the flags were not freely combinable. The two flags that could be combined were keepDollar and keepUndef, but even these have distinguished names in the debug log. The downside of struct bit-fields is that they need extra helper functions in C90 (see nonints.h). Exchange these for a few helper functions in var.c, to keep the code outside var.c simple. No functional change.
2021-04-04make: remove filler word 'Do' from function names for parsingrillig
No functional change, except for debug logging.
2021-04-04make: rename a few functions to be more descriptiverillig
No functional change.
2021-04-03make: backport to C90rillig
In the past few months I had accidentally used C99 features in the make code. According to tools/README, tools that are used in the build system should restrict themselves to C90. This allows make to build with GCC's options "-pedantic -Wno-system-headers -Dinline= -Wno-error=cast-qual". I didn't notice anyone actively complaining though, I just wanted to see how much work this backporting would be. The identifier __func__ is still used, as in other tools. No functional change.
2021-04-03make: use C99 bool type instead of defining its ownrillig
No functional change.
2021-03-15make: change debug log for variable evaluation flags to lowercaserillig
This makes them easier distinguishable from variable names since the latter are usually uppercase. No functional change outside debug mode.
2021-03-15make: replace enum bit-field with struct bit-field for VarEvalFlagsrillig
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-15make: rename VARE_NONE to VARE_PARSE_ONLYrillig
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-02-14make: clean up FStr and MFStr memory in cleanup moderillig
2021-02-05make: in the Var_ functions, move the scope to the frontrillig
This change provides for a more natural reading order in the code. Placing the scope first makes it immediately clear in which context the remaining parameters are interpreted. No functional change.
2021-02-05make: add shortcut Global_Delete for deleting a global variablerillig
2021-02-04make: rename Var_ValueDirect to GNode_ValueDirectrillig
2021-02-04make: group shortcuts for manipulating global variablesrillig
No functional change.
2021-02-04make: rename Var_SetWithFlags to Var_SetExpandWithFlagsrillig
Add back Var_SetWithFlags for the one call that doesn't need to expand the name. Now one of the flags is encoded in the function name while the others are encoded in VarSetFlags. This is inconsistent. Maybe there is a better way to model the different variants of setting a variable.
2021-02-04make: rename Var_Set to Var_SetExpandrillig
After doing the textual renaming across all files, I added a new function Var_Set that does not expand the variable name. I then undid the renaming for all calls where the variable name cannot ever contain a dollar sign. I omitted the word "Expand" from the textual references in the unit tests and in the debug logging messages since the focus is usually on the "Set" part, not on the "Expand". No functional change.
2021-02-03make: rename Var_Delete to Var_DeleteExpand, Var_DeleteVar to Var_Deleterillig
The function names now follow the naming scheme from the other functions that handle variables. There are several calls that remain syntactically unchanged but that omit the call to strchr('$') now. Since all these calls use constant variable names, there is no functional change.
2021-02-03make: split Var_Exists into plain Var_Exists and Var_ExistsExpandrillig
Most previous calls to Var_Exists use constant variable names. Only the two calls in parse.c need to expand the variable name. It may be a good idea to expand the variable name once in VarAssign_Eval instead of repeating the expansion in each of its special cases. No functional change.
2021-02-03make: replace Global_AppendExpand with Global_Appendrillig
All callers with a variable name that is guaranteed to not contain a dollar sign have been converted to call Global_Append instead of the previous Global_AppendExpand. After that, Global_AppendExpand was unused, therefore it was effectively just renamed.
2021-02-03make: split Var_Append into Var_Append and Var_AppendExpandrillig
The plain Var_Append now does not expand the variable name anymore. It is used in situations where the variable name is known to not contain a dollar sign. This is a preparation for adding Global_Append, corresponding to Global_AppendExpand.
2021-02-03make: replace Global_SetExpand with Global_Set for constant namesrillig
2021-02-03make: use shortcut functions Global_SetExpand and Global_AppendExpandrillig
There are many places where global variables are set or appended to. To reduce clutter and code size, encode the VAR_GLOBAL in the function name. The word Expand in the function names says that the variable name is expanded. In most of the cases, this is not necessary, but there are no corresponding functions Global_Set or Global_Append yet. Encoding the information whether the name is expanded or not in the function name will make inconsistencies obvious in future manual code reviews. Letting the compiler check this by using different types for unexpanded and expanded variable names is probably not worth the effort. There are still a few bugs to be fixed, such as in SetVar, which expands the variable name twice in a row.