Commit Graph

19368 Commits

Author SHA1 Message Date
rillig b75bb0457b lint: replace crash with assertion failure
Triggered by 'sizeof(int())'.

GCC evaluates this expression to 1, without any warning.

Clang warns about an "invalid application of 'sizeof' to a function
type".
2022-04-01 01:06:26 +00:00
rillig 3b385e4c9c make: fix spacing, and a typo in a test 2022-03-27 18:39:01 +00:00
sjg bac1316949 Mention 'make -r' with .POSIX 2022-03-26 15:39:58 +00:00
rillig 2ee28bb4b2 make: avoid trailing whitespace in debug log for variables
Since trailing whitespace is invisible, describe the variable value in
words to make it visible.
2022-03-26 14:34:07 +00:00
rillig 7d32eabdae make: add space after colon in debug logging for variables
These log messages are intended for human interpretation, so don't make
them unnecessarily hard to read.
2022-03-26 14:17:46 +00:00
rillig 302298bffd make: prefer 'long long' over 'long' on 32-bit C99 platforms
When sorting the words of an expression numerically using the modifier
':On' (added on 2021-07-30), use 64-bit numbers even on 32-bit
platforms.  A typical use case is comparing file sizes.

When tracing the execution of jobs, fix an integer overflow after 2038.
32-bit platforms that use a pre-C99 compiler still have this problem.

No change to the test suite since most tests simply skip any potential
differences between 32-bit platforms and 64-bit platforms (see
varmod-order-numeric.mk) or already account for both variants (see
varmod-localtime.mk).
2022-03-26 14:02:40 +00:00
rillig cab1987a93 make: clean up comments 2022-03-26 13:32:31 +00:00
rillig ae5c0d120f make: fix crash on .undef of an environment variable (since 2020-10-06) 2022-03-26 12:44:57 +00:00
rillig db6c2e72bd tests/make: test .undef for exported global variables 2022-03-25 23:03:47 +00:00
rillig a3654be969 tests/make: suppress -DCLEANUP output in test deptgt-phony 2022-03-25 22:38:39 +00:00
sjg 3db3ca139b Include posix.mk when .POSIX: first encountered
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
2022-03-25 21:16:04 +00:00
andvar adbc140349 fix few typos in comments, mainly s/paramenters/parameters/. 2022-03-23 11:08:27 +00:00
rillig fa858d4c6e make: clean up comments and code for setting debug flags
No binary change.
2022-03-22 23:37:09 +00:00
rillig 5cb183c368 lint: be more specific in comment about <ctype.h> check
No binary change.
2022-03-19 14:48:31 +00:00
rillig 2e6995096b lint: add braces around multi-line loop body
No functional change.
2022-03-13 15:26:54 +00:00
rillig a661a10289 lint: clean up comments, explain assertion in inssym 2022-03-13 15:20:50 +00:00
rillig 25651e882e lint: use an unsigned counter for temporary variable names
No functional change.
2022-03-13 15:17:08 +00:00
rillig fb81512c26 lint: improve debug logging for the symbol table
Only print the heading for the symbol table level if there is actually a
symbol on that level.

Ensure that no symbol with block level -1 is ever in the symbol table
(see rmsym).
2022-03-13 15:08:41 +00:00
rillig f22a14729a lint: fix off-by-one error in symbol table
No functional change since the error was in the "safe" direction.
2022-03-13 14:49:18 +00:00
rillig 0fa3e2f835 lint: rename function 'cleanup' to be more expressive
No functional change.
2022-03-13 14:40:36 +00:00
rillig 6fd02fc319 lint: fix indentation in C grammar
No functional change.
2022-03-09 00:20:48 +00:00
rillig a57d5f3aac lint: fix typo in comment
No binary change.
2022-03-08 23:24:20 +00:00
rillig 08cb0b9a96 man: remove unused global variable 'instype' (since yesterday)
No functional change.
2022-03-08 23:13:05 +00:00
rillig 464029217b man: remove trailing whitespace
No binary change.
2022-03-08 23:09:36 +00:00
rillig d834ba5cf2 man: fix type mismatch between enum and int (since yesterday)
No binary change.
2022-03-08 23:05:32 +00:00
gutteridge ce25000ddd man.c: fix -m option so it works as documented
Refactoring work in man.c r. 1.40 from twelve years ago introduced a
regression where input from the -m option was appended rather than
prepended to the search paths. Problem reported by C. Chapman on
netbsd-users.
2022-03-07 22:43:39 +00:00
sjg e56a2ae17f Fix some unused warnings 2022-03-04 23:17:16 +00:00
andvar 634b965029 fix few typos in comments for word "because". 2022-03-04 21:12:03 +00:00
rillig c847be418a tests/make: add more comprehensive tests for ':M' and ':N' 2022-03-03 20:20:23 +00:00
rillig a656d49069 tests/make: test variant without filemon 2022-03-03 20:03:19 +00:00
rillig 4f4e6f996b make: improve comments and a parameter name
No binary change.
2022-03-03 19:55:27 +00:00
rillig 596f3fa4ad make: simplify ParseModifier_Match
No functional change.
2022-03-03 19:52:41 +00:00
rillig 7406716069 make: make code for string matching syntactically more consistent
No functional change.
2022-03-03 19:50:01 +00:00
rillig 08b9f8c715 make: improve comments about parsing and evaluating conditions
No binary change.
2022-03-03 19:46:31 +00:00
rillig fbd956607a make: improve local variable name in ParseWord in conditions
That function not only parses function arguments but also bare words, so
the name argBuf didn't match anymore.

No binary change.
2022-03-03 19:40:54 +00:00
rillig 78e6536c6f make: make debug logging for comparisons less technical 2022-03-03 19:36:35 +00:00
sjg 57865d3c11 Add nofilemon to meta mode tests
The unit-tests for meta mode do not depend on filemon.
Adding nofilemon to .MAKE.MODE allows these to pass on
a system that would use filemon_dev but does not have
the module loaded.
2022-03-02 19:32:15 +00:00
rillig e186a41835 lint: remove redundant assignments to string buffer length
No functional change.
2022-03-01 20:00:47 +00:00
rillig b8eac53e2f lint: add debug logging for symbols and the symbol table
This logging is not active by default, the functions debug_sym and
debug_symtab can be called as needed during a debug session.
2022-03-01 00:17:12 +00:00
rillig 79ea65346a lint: constify lexer keywords
No functional change.
2022-02-28 22:41:07 +00:00
wiz 9bc9835ae0 seq(1): add more examples, improve wording
From OpenBSD via jmc@OpenBSD
2022-02-28 13:49:50 +00:00
rillig 8aa297ebd7 lint: reorganize lexer functions
Move the keywords table to the top, reduce forward declarations.

No functional change.
2022-02-27 22:46:04 +00:00
rillig 148d047bc2 lint: group symbol table functions
No functional change.
2022-02-27 22:26:12 +00:00
rillig fddd84be4f tests/lint: add tests for messages about old-style functions 2022-02-27 20:02:43 +00:00
rillig ab0cea4ce1 lint: concatenate string literals from left to right
Previously, the string literals "1" "2" "3" "4" were concatenated in the
order "23", "234", "1234".  This influenced the location of the
diagnostics for traditional C (which doesn't know concatenation at all)
and for mixing regular strings and wide strings.

Now the diagnostics occur exactly where they are expected.  The first
string literal defines whether the whole string is regular or wide, and
any further string literals must match it.

In traditional C mode, there are more diagnostics than before, but that
doesn't hurt since they are still correct and nobody uses lint in
traditional C mode anyway.
2022-02-27 19:32:51 +00:00
rillig 0eb316d78b vmstat: unexport file-scope variable numdisks
There is no need to make this variable externally visible.  There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.
2022-02-27 19:00:46 +00:00
rillig 900cc20080 lint: merge duplicate code for handling plain and wide strings
No functional change.  As before, the string literals "1" "2" "3" are
not concatenated from left to right, instead concatenation starts with
"23" and then proceeds to "123".
2022-02-27 18:29:14 +00:00
rillig e3262a2e12 lint: clean up code for handling filenames
No functional change.
2022-02-27 17:12:06 +00:00
rillig 0a781eec83 lint: C99 has been released, so refer to it by its proper name 2022-02-27 11:40:29 +00:00
rillig 90900cebb7 lint: unabbreviate two more members of sym_t
No functional change.
2022-02-27 11:14:42 +00:00