Commit Graph

17803 Commits

Author SHA1 Message Date
rillig
962abf967a make: use consistent variable names, types and braces in DebugFailedJob
No functional change.
2021-04-27 16:25:46 +00:00
rillig
565f4473b9 make: remove stray space in -de output in jobs mode
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.
2021-04-27 16:23:21 +00:00
rillig
132c9f6004 tests/make: test the combination of -de with -j1
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.
2021-04-27 16:20:06 +00:00
christos
495cc5cbc3 Print -de error information when running multiple jobs
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
2021-04-27 15:21:42 +00:00
christos
88ab0eac35 add const 2021-04-27 15:19:25 +00:00
christos
ef96cd7f1c Handle mipsn64 2021-04-25 23:52:59 +00:00
rillig
2bf1c0cbcf tests/make: add tests for ${...} without operator in conditions
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.
2021-04-25 21:05:38 +00:00
lukem
9f8e2c9192 ftp(1): consistently use FTP for protocol use. 2021-04-25 09:09:55 +00:00
lukem
094f09734d ftp(1): consistent Ic (not Nm) for commands 2021-04-25 08:46:19 +00:00
lukem
4f096ae03f better XXX comment for buggy ftp server 2021-04-25 08:26:35 +00:00
rillig
5bd0234249 lint: merge duplicate code in grammar for GCC compound expressions
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.
2021-04-23 20:26:43 +00:00
christos
38e22eb187 Add common attribute 2021-04-20 21:48:39 +00:00
rillig
24fb524bea make: do not complain when skipping the condition 'no >= 10'
Seen in external/bsd/tmux when building with Clang.  See
varmod-ifelse.mk for the detailed story.
2021-04-19 23:51:42 +00:00
rillig
a12d67d575 tests/make: add another example for parsing of the modifier ':?' 2021-04-19 23:43:14 +00:00
rillig
2427b79c7f tests/make: add detailed explanation for error message in conditional 2021-04-19 23:27:17 +00:00
rillig
97e91d60e6 make: use straight quotes for error 'Bad conditional 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.
2021-04-19 22:22:27 +00:00
rillig
d23762c055 tests/make: demonstrate unexpected behavior of the modifier ':?' 2021-04-19 22:05:29 +00:00
christos
f1b2d7493d Fix weekday parsing; only reset the string when parsing fail and only set
the weekday when parsing succeeds (Steffen Nurpmeso)
2021-04-19 17:49:28 +00:00
rillig
9c24f7ff27 make: avoid double slash in name of temporary directory
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 '/'.
2021-04-19 16:35:11 +00:00
rillig
d6126ccc75 lint: add debug logging for reachability 2021-04-19 13:18:43 +00:00
rillig
5bf56b009b lint: remove WARNS=3, falling back to the default WARNS=5
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.
2021-04-18 22:51:24 +00:00
rillig
4b2703ba02 lint: fix strict bool mode errors in cgram.y
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.
2021-04-18 21:53:37 +00:00
rillig
063d68d52b lint: reduce duplicate code for parsing .ln files 2021-04-18 21:12:50 +00:00
rillig
8edef9ff6a lint: fix error message in lint2 for missing record type in .ln file 2021-04-18 20:40:51 +00:00
rillig
fd674c8ffb lint: clean up option parsing 2021-04-18 20:15:17 +00:00
rillig
3f5e7494f3 lint: test emitting of symbol information in the .ln files
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.
2021-04-18 20:02:56 +00:00
rillig
9941f15572 lint: rename parameter to expr
That parameter used to be used for a single purpose, later it got used
for checking the reachability as well, which made the name misleading.
2021-04-18 17:54:33 +00:00
rillig
dd5ca14fc1 lint: remove redundant CONSTCOND
In do-while-0 loops, these are no longer needed since tree.c 1.202 from
2021-01-31.
2021-04-18 17:47:32 +00:00
rillig
6de49ab08a lint: pass pos_t via const pointer
Thanks for the suggestion, christos@.
2021-04-18 17:36:18 +00:00
rillig
e87d5ae6f7 lint: rename parameter to diagnostic functions and macros
The first parameter is not just an arbitrary number, it's a message ID.
2021-04-18 10:09:49 +00:00
rillig
bc66c81fb4 lint: align the member access macros for tnode_t 2021-04-18 10:04:23 +00:00
rillig
2e8075d978 lint: flip parameters in verror_at, vwarning_at, vmessage_at
The parameters are in the same order now as in the corresponding macros.
2021-04-18 10:02:16 +00:00
rillig
06b9102e6b lint: extend documentation about handling initializations 2021-04-18 09:53:03 +00:00
rillig
0fa816d74c lint: remove redundant test for tflag in initialization handling 2021-04-18 09:50:00 +00:00
rillig
1afc787893 lint: migrate global_clean_up_decl to warning_at 2021-04-18 09:39:53 +00:00
rillig
381fecf673 lint: preserve curr_pos when checking whether a symbol is used
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.
2021-04-18 09:37:18 +00:00
rillig
7dcdec7722 lint: do not modify curr_pos in check_global_symbols
No functional change.
2021-04-18 09:20:43 +00:00
rillig
4dc66409e9 lint: in check_global_variable_size, restore curr_pos
This affects only calls to lint_assert, all other code stays
functionally the same.
2021-04-18 09:15:16 +00:00
rillig
b9784b3ffa lint: migrate check_tag_usage to warning_at
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.
2021-04-18 09:07:36 +00:00
rillig
ef084fd475 lint: migrate print_previous_declaration to message_at 2021-04-18 08:57:57 +00:00
rillig
152aae6b2f lint: migrate the getopt check to warning_at 2021-04-18 08:53:35 +00:00
rillig
1052a4a017 lint: add error_at, warning_at, message_at
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.
2021-04-18 08:52:04 +00:00
rillig
48ee035ba0 lint: do not allow the diagnostics to be modified 2021-04-18 08:07:04 +00:00
rillig
1cf5b1560c lint: fix storage class of compound literal in initializer
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.
2021-04-18 08:00:13 +00:00
rillig
73b70e7b0b lint: document wrong location information in diagnostics 2021-04-18 07:31:47 +00:00
rillig
0580bd7587 lint: fix assertion failure for temporary objects in initialization 2021-04-17 21:20:08 +00:00
rillig
c322b8c5b5 lint: do not warn about alignment when casting from incomplete struct
This removes a bunch of technically correct but practically useless
warnings from the regular NetBSD build.
2021-04-17 16:58:04 +00:00
rillig
3c425c406d lint1: remove redundant dependency
This is already handled by "make depend".
2021-04-17 11:01:34 +00:00
maya
5858bd6b8c Remove SCCS workarounds. No binary change. 2021-04-17 08:34:27 +00:00
maya
d8cc1107df Remove SCCS workarounds. No binary change. 2021-04-17 06:14:15 +00:00