Commit Graph

19354 Commits

Author SHA1 Message Date
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
rillig 8e7e0d4a25 lint: remove unused enumeration details from symbol type
No functional change.
2022-02-27 10:49:15 +00:00
rillig 608bf41933 lint: unabbreviate some fields in sym_t
No functional change.
2022-02-27 10:44:45 +00:00
rillig 6bd0b7583f lint: encode lifetime of allocated memory in function names
No functional change.
2022-02-27 10:31:58 +00:00
rillig fa4dd0e745 lint: encode lifetime of allocated memory in the function names
No functional change.
2022-02-27 08:31:26 +00:00
rillig baa5e17b5f lint: clean up memory management for string buffers
There is no reason to duplicate all the work that is already done by the
memory allocator.

No functional change.
2022-02-27 07:50:09 +00:00
rillig ae25203d65 lint: clean up memory allocation
No functional change.
2022-02-27 07:38:54 +00:00
rillig 1de34d13b5 lint: remove custom free list for memory blocks
Trust the system memory allocator to do its thing, including marking the
memory as fresh or freed.  One less thing to worry about.
2022-02-27 06:55:13 +00:00
rillig 6c3c49443e lint: rename ARG to OLD_STYLE_ARG
Pre-C90 argument declarations have been old for more than 30 years now,
so mention that fact in the constant name.  This reduces potential
confusion with other occurrences of the words 'arg' or 'argument'.

No functional change.
2022-02-27 01:47:28 +00:00
rillig 0220fee323 lint: improve debug logging for symbol kinds 2022-02-26 23:07:28 +00:00
rillig 1887ef10af lint: fix memory corruption in statement expressions (since 2021-12-17)
The commit that introduced the assertion failure looks innocent, it only
adds a few predefined functions for GCC mode.  Nevertheless, before that
commit, lint consistently complained about 'error: void type illegal in
expression [109]', which doesn't make sense either.

This fix also removes the creative use of the initialization stack to
store the type of the statement expression.  Having a separate stack for
these statement expressions makes the code easier to understand.
2022-02-26 20:36:11 +00:00
rillig 785a291ff6 lint: extract code for handling statement expressions from the grammar
This prepares the fix of the memory corruption bug that is demonstrated
in t_integration.sh, test case assertion_failures.

No functional change.
2022-02-26 19:01:09 +00:00
rillig 5454c52f6f lint: enable memory debugging
Filling deallocated memory with 0x00 may hide errors, so rather fill
with 0xA5.

While this doesn't change anything about the test about the assertion
failure after a do-while loop (see t_integration.sh, test case
assertion_failures), it may detect other similar bugs earlier.
2022-02-26 18:35:01 +00:00
rillig 74533c0f60 make: fix memory leak in Lst_Remove (since 2020-10-23)
The code to free the list node (as opposed to the node data) was
accidentally removed in lst.c 1.83 from 2020-10-23 as part of cleaning
up an unnecessarily complicated function for traversing linked lists.

The memory leak only affected a few lists that actually used Lst_Remove.
Most lists are append-only and are freed using Lst_Done or Lst_Free at
the end, which correctly free the memory.
2022-02-26 11:57:21 +00:00
jakllsch bf04c5e74f Define becquerels in base units (like curies and rutherfords already are),
rather than in terms of curies.

Add symbol Bq for becquerel.
2022-02-15 16:21:35 +00:00