In compat mode, having a space in this place makes sense to align the
target name with the command. In jobs mode, since each command is
listed in a separate line, there is no need for the double space.
The test cases are the same as in opt-debug-errors.mk. The output
differs in several details though.
Even though the option '-k' is given (which is the default for any tests
that don't override it in unit-tests/Makefile), there is no message
"(continuing)" anywhere.
The failed target is printed twice. Once before the failed commands,
once after. This redundancy is not necessary and may be removed in a
follow-up commit.
The printed commands are in their unexpanded form, which may or may not
be more helpful than the expanded and space-normalized form of compat
mode. Either way, this is an unnecessary inconsistency between compat
mode and jobs mode.
In jobs mode, the message "make: stopped in $dir" is printed for each
failure, which is helpful since each of the jobs may have started in a
separate directory.
Problem and patch description from https://reviews.freebsd.org/D29647:
When running `make -de` (without any -j flag) bmake prints which command
failed. However, when using the -j flag the -de flag is ignored. This can
make it rather difficult to determine which command failed in an very
parallel build (especially when combined with the -s flag to avoid
ridiculously large logfiles). For single-threaded builds we can combine
-s with -de to get the failed command but this does not work with -jN
(even with -j1). This patch prints the failed shell script with -de in the
multiple jobs mode as well.
From Alexander Richardson @ FreeBSD
These tests are already covered in cond-cmp-unary.mk, but my first guess
was to search for these tests in cond-token-var.mk, so keep them in both
tests.
This increases the number of shift/reduce conflicts, once again. I
don't know why since the previous two grammar rules only differed in a
single detail. One of them had a declaration_list while the other
didn't. This difference is exactly what declaration_list_opt is for.
Anyway, the tests for both cases (with and without declarations) work
exactly as before.
Merging this duplicate code will probably make it easier to fix the
current limitation in lint regarding GCC compound expressions that a
statement followed by a declaration generates a syntax error.
Fixing this is not trivial, my first attempt failed either with
segmentation faults or with sym->s_type becoming NOSPEC during the
expression.
This diagnostic was supposed to be an error, see ApplyModifier_IfElse.
When such an error occurs while the makefiles are read, make stops with
an error, as can be expected. But when such an error occurs later,
after all makefiles have been read, the message is printed but make does
not stop.
In lint mode (-dL), make stops in such a case. I didn't dare to make
this the default behavior, out of fear of breaking existing build
infrastructure, not only in NetBSD or pkgsrc, but also FreeBSD and other
operating systems that use the bmake distribution, generated from the
same source code.
If the environment variable TMPDIR is not set, make uses a default path
that includes a trailing '/'.
For extra correctness it always appended an extra '/', leading to paths
of the form '/tmp//makeXXXXXX'. This looked suspicious, as if there had
been a forgotten empty part between the two '/'. Avoid this ambiguity
by replacing '//' with '/'.
It's strange that GCC does not warn about the nonliteral format strings
in lint1/err.c, lint2/msg.c and lint2/read.c, despite -Wformat=2, but
Clang does.
The code generated by yacc already adheres to strict bool mode, in
default mode as well as in debug mode.
Running lint on the generated cgram.c as well avoids most of the
"declared but not used" warnings from lint2.
The code generated by lex does not adhere to strict bool mode though.
Suppressing the errors from strict bool mode works, but then lint1 runs
into an assertion failure:
assertion "tn != NULL || nerr != 0" failed
in expr at tree.c:3610 near scan.c:822
This leaves several warnings about "declared but not used" for the
functions from lex.c.
Even though the new test is quite large, it didn't find any bugs in the
code. The only thing I'm unsure about is why static functions are
exported as well, since they are supposed to be local to the translation
unit.
At the end of a function definition (funcend), curr_pos was not
restored, probably because the very next action is to read the next
token, which will then set curr_pos.
Again, this may affect the location reported in assertion failures,
everything else is unchanged.
This one is already a little trickier since it does not restore the
original curr_pos. This function is only called in a few places, and
these either restore curr_pos themselves or only call functions
afterwards that immediately overwrite curr_pos.
Except for lint_assert, which may now report a different location.
The call to check_global_variable that is related to check_tag_usage was
the function that started this whole refactoring since its lint_assert
reported a completely wrong location when using a compound literal in an
initializer expression at block level 0.
Right now there are several places in the code that use the global
variable curr_pos for passing a parameter to the diagnostic functions.
That's not what global variables are for.
Make it easy for the code to migrate to the parameter-passing style.
No functional change.
A compound literal that occurs at block_level 0 does not have storage
class AUTO. Instead, its storage class is either EXTERN or STATIC.
While removing the temporary objects from the symbol table had prevented
the assertion, it did not properly fix the underlying problem, which was
that since C99 the initializers can contain references to unnamed
objects that are created on-the-fly. For C90 it was correct to always
use AUTO as the storage class of a temporary symbol.