| Age | Commit message (Collapse) | Author |
|
No binary change.
|
|
In practice, the common situation is that a file is first included,
defines its multiple-inclusion guard and is then skipped instead of
being included again.
The other way round is that the multiple-inclusion guard is defined when
the file is included first. In that case, the file is now regarded as
guarded as well.
|
|
This style is used by FreeBSD, among others.
|
|
No functional change.
|
|
"looks reasonable" sjg@
|
|
|
|
~~~makefile
!= printf '%s\n' '.include "2.mk"' > 1.mk
!= printf '%s\n' '!= rm 1.mk' '.info message' > 2.mk
.MAKEFLAGS: -dp
.include "1.mk"
.MAKEFLAGS: -d0
all:
~~~
|
|
|
|
The variable name '.MAKEOVERRIDES' was already used in the non-macro
form.
No binary change.
|
|
The variable name is distinctive enough to be searched directly in the
code instead of having a named constant for it.
No binary change.
|
|
None of the calls to Var_Subst used the return value, and the return
value was always VPR_OK.
No functional change.
|
|
No functional change.
|
|
.SYSPATH: with no sources will clear sysIncPath
otherwise sources are added
Reviewed by: rillig
|
|
Reviewed by: rillig
|
|
Seen in binutils/zlib/Makefile.in:1283, which defines both '.MAKE' and
'.PHONY' in the same line.
|
|
No functional change.
|
|
No binary change on x86_64.
|
|
The variable cond_min_depth was redundant. It was only accessed while
parsing the makefiles. Merging it into struct IncludedFile removes the
possible confusion between cond_min_depth and including_cond_min_depth.
No functional change.
|
|
|
|
The previous names were confusing since they suggested that cond_depth
instead of cond_min_depth would be saved and restored.
No functional change.
|
|
To avoid errors from unclosed conditionals on .break
it is sufficient to just set cond_depth = cond_min_depth.
Patch from rillig
|
|
Move For_Break further up, as the functions in that file are sorted from
small to big. The cast from size_t to unsigned int is required by lint.
In parse.c, move the code into a separate function to keep
ParseDirective small. Its only job is to parse the directive and then
delegate to another function doing the actual work.
In the manual page, remove empty lines.
In the test, ensure that .break stops processing of the .for loop
immediately; anything after the .break is not processed anymore.
Replace ':=' with '=', as there is no need to evaluate '$i' early.
Check the expected value in the .mk file instead of the .exp file, to
keep the reading scope as small as possible.
|
|
When .break is encountered within a .for loop
it causes immediate termination.
Outside of a .for loop .break causes a parse error.
Reviewed by: christos
|
|
Reported by Robert Morris in https://bugs.freebsd.org/265119.
Since 2021-12-14.
|
|
Determining the location where the error occurred is now done by
ParseVErrorInternal. This frees the remaining code from keeping the
filename and the line number together. It also makes Parse_Error short
enough that it might be worth providing a separate function for each of
the 3 log levels.
No functional change.
|
|
$ cat <<'EOF' > glob-leak.mk
all:
@pid=$$$$; \
ppid=$$(ps -o ppid -p "$$pid" | sed 1d); \
ps -o vsz,rsz -p $$ppid | sed 1d
.for _ in ${:U:${:Urange=$n}}
bin/*: source
.endfor
EOF
$ make.before -r -f glob-leak.mk n=1
19424 5280
$ make.before -r -f glob-leak.mk n=10
24220 10208
$ make.before -r -f glob-leak.mk n=100
71280 58504
$ make.before -r -f glob-leak.mk n=1000
556356 541620
$ make.after -r -f glob-leak.mk n=1
19208 5040
$ make.after -r -f glob-leak.mk n=10
22132 8092
$ make.after -r -f glob-leak.mk n=100
49040 35940
$ make.after -r -f glob-leak.mk n=1000
324160 314400
That's a saving of 40% already. The remaining 60% are suspicious as
well since after the first iteration of the .for loop, make's internal
state doesn't change conceptually, so there's no need to throw more
memory at it.
|
|
Most targets do not use wildcards, so there is no need to put the single
item into a list.
No functional change.
|
|
No functional change.
|
|
No functional change.
|
|
It was the only function in parse.c that had a lowercase name.
No functional change.
|
|
No functional change.
|
|
No functional change.
|
|
No functional change.
|
|
Strangely, GCC didn't warn about this error. For the buffer overflow to
actually happen, there would have to be a billion .WAIT nodes.
|
|
|
|
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
says that in order to make a makefile POSIX-conforming, its first
non-comment line must be the special dependency line '.POSIX:' without
any source dependencies.
Previously, make switched to POSIX mode even if such a line occurred
anywhere else, which was allowed by POSIX but was deep in the
"unspecified behavior" area. For NetBSD make, there is no big
difference since it doesn't ship any <posix.mk> file, this change mainly
affects the bmake distribution.
Previously, makefiles that contain '.POSIX:' somewhere in the middle
could fail due to <posix.mk> resetting .SUFFIXES, among other things.
Suggested by Simon J. Gerraty, who also reviewed an earlier version of
this change.
|
|
Since .POSIX: is required to be the first non-comment line
in a Makefile, including ${MAKE_POSIX_MK} or whatever _PATH_POSIX_MK is
set to at this point is equivalent to an extension of sys.mk
This is a minimal change that can allow a better approximation of
POSIX compliance
Reviewed by: rillig
|
|
No binary change.
|
|
A line starting with '======' is parsed as a variable assignment, with
an empty variable name and a value starting with '=====', making that
condition unreachable.
No functional change.
|
|
No binary change for -DNDEBUG.
|
|
No binary change.
|
|
No functional change.
|
|
|
|
Previously, some line numbers were stored as signed int while others
were stored as size_t. Since line numbers are never negative, use an
unsigned type. Since the maximum file size for makefiles is 1 GB (see
loadfile), unsigned int is large enough even on 64-bit platforms.
Using a single data types reduces the number of type conversions. Using
unsigned int improves compatibility with C90 (printf %u instead of %zu),
which is needed by bmake, which is derived from usr.bin/make.
No functional change.
|
|
Print the approximate location based on the last command that has been
defined for the target. It would be possible to get more detailed
location information by counting the number of commands of the target,
but that would get messy due to .USEBEFORE, .USE and .DEFAULT, and
still, this is an edge case, so don't waste too much code for it now.
Having this hint about the location is more helpful than just a plain
"Variable X is recursive" without any further details.
|
|
The only fatal error that occurs while the makefiles are read in is the
one about recursive variables, which didn't give any hint about the
location before.
If a recursive variable is detected while evaluating the commands of a
target to be made, there is no location information, as before.
|
|
No functional change.
|
|
No binary change, except for assertion line numbers.
|
|
The variable is set in the context of the target.
This syntax has been supported by gmake for ~ever.
If necessary a makefile can set .MAKE.TARGET_LOCAL_VARIABLES=false
to disable this.
Expose GetBooleanExpr so parse.c can use it.
|
|
It was wrong of Parse_File to output an unfinished line and hope for
some other code to finish it. As demonstrated in the test, PrintOnError
did not do that in the case of additional debug output.
To keep the overall behavior as close as possible to before, the other
callers of PrintOnError now have to pass the newline themselves. Passing
strings that start with newlines but don't end with them looked
suspicious anyway.
|