Commit Graph

284326 Commits

Author SHA1 Message Date
rillig
6c2a2c1402 lint: document and demonstrate the bug in check_precedence_confusion
It took quite a while to get to the correct interpretation of this small
piece of code and to draw the right conclusions from it.  Now the bug is
finally ready to be fixed, as already announced in the test.
2021-01-04 23:47:26 +00:00
rillig
fb2d84bf80 lint: add more rationale for removing effect-less code 2021-01-04 23:17:03 +00:00
rillig
8f3340157a lint: finish the comments in check_precedence_confusion 2021-01-04 22:41:56 +00:00
rillig
796f8d840b lint: replace LERROR with lint_assert in check_expr_misc
This reduces the visual clutter.  There is no reason for anyone to
modify the code around the CALL operator, therefore the assertion is not
expected to fail anytime soon.
2021-01-04 22:33:47 +00:00
rillig
4c2e526843 lint: reduce comment for xgetblk to the actually interesting part 2021-01-04 22:29:00 +00:00
rillig
0935430d9a lint: fix typos and other minor stylistic issues 2021-01-04 22:26:50 +00:00
thorpej
614805fdc6 Rename tsl256x.c -> tsllux.c. No other changes are made by this commit. 2021-01-04 22:09:35 +00:00
thorpej
08733279a9 Tweak register bit names, in preparation for supporting younger siblings
of this chip.
2021-01-04 21:59:48 +00:00
rillig
c48d8a0ff1 lint: fix bugs in dprint_node in debug mode (since today)
The node was dereferenced before the null check.  GCC 5.5 didn't warn
about this obvious bug, not even with -Wall -Wextra -O2.  Such a case
didn't occur though in the few tests that this function was used in.

The indentation for the nested nodes only needs to be set for a few
lines of code, make this region as small as possible.

There are nodes that use both tn_left and tn_right, even though they are
not defined as binary operators.  An example is CALL, for which tn_left
is the address of the function name and tn_right, which are the
arguments, linked via PUSH nodes.  CALL is not a binary operator since
it doesn't do any calculations with its arguments.
2021-01-04 21:30:06 +00:00
rillig
4f7d5d5f25 lint: move dprint_node to the top of the file
It now resides right below dumpnode, which implements the same idea but
uses a fixed-size output buffer and prints everything in a single line,
which quickly gets hard to read.  Maybe that's the reason why it had
been commented out since it got added in 2014.
2021-01-04 21:17:31 +00:00
pgoyette
b5cd926b3f Better grammar. 2021-01-04 18:27:46 +00:00
riastradh
3b80deb3da dev/ic/tpm: Take advantage of entropy source if available.
If the tpm is deactivated, though, detach the entropy source so we
don't continue to try polling it -- it can't be activated without a
reboot anyway.
2021-01-04 18:26:59 +00:00
riastradh
49305377a6 dev/ic/tpm: Add missing line break in attach output. 2021-01-04 18:26:08 +00:00
thorpej
32841112b8 malloc(9) -> kmem(9) 2021-01-04 18:23:10 +00:00
riastradh
e05111c27e dev/ic/tpm: Tidy up headers.
- Add include guards.
- Add necessary includes.
- Sort includes.
- Use _BYTE_ORDER, not BYTE_ORDER, for public header.
2021-01-04 18:22:19 +00:00
thorpej
983a72cbb8 malloc(9) -> kmem(9) 2021-01-04 18:19:53 +00:00
thorpej
33d87a86d4 malloc(9) -> kmem(9) 2021-01-04 18:09:01 +00:00
thorpej
9e26d3f35b malloc(9) -> kmem(9) 2021-01-04 17:35:12 +00:00
thorpej
46d1333eda malloc(9) -> kmem(9) 2021-01-04 17:22:59 +00:00
rillig
8c672c9179 lint: in debug mode, print node tree for precedence
From the code alone, it is too difficult to see how the various internal
operators are combined and what properties they have.  A simple tree
visualization helps to see all the details.

This is used to track down the typo in check_precedence_confusion, to
see whether it could have possibly had any influence at all.
2021-01-04 17:06:20 +00:00
mlelstv
359dabd9dc Fix calculation of cylinder count from medium size.
Pullups needed.
2021-01-04 16:17:26 +00:00
thorpej
f62c8323d9 malloc(9) -> kmem(9) 2021-01-04 15:56:24 +00:00
rillig
d2a5bcaf42 lint: add test for "precedence confusion possible [169]" 2021-01-04 15:52:51 +00:00
thorpej
10ec075e09 Use sel{record,remove}_knote(). 2021-01-04 15:29:34 +00:00
skrll
c52d7a8efb KNF 2021-01-04 15:14:32 +00:00
skrll
5c2516e35f Trailing whitespace 2021-01-04 15:13:50 +00:00
skrll
47ebd00ca7 Spell interrupts correctly 2021-01-04 15:13:06 +00:00
thorpej
fc256c4a39 malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now. 2021-01-04 14:48:51 +00:00
ryo
ea9fe086ae sync cpuids[] of sys/arch/aarch64/aarch64/cpu.c r1.43 2021-01-04 05:35:14 +00:00
rillig
e76f008448 lint: revert previous commit, except for the typo 2021-01-04 01:12:20 +00:00
rillig
ceea60cf1e lint: fix typo in comment 2021-01-04 01:11:01 +00:00
rillig
1044039bbe lint: use consistent indentation for C grammar 2021-01-03 21:33:50 +00:00
rillig
a5bfcb8bf5 make(1): remove anonymous union from struct ListNode
Anonymous structs and unions have been introduced in C11.  The code of
make is supposed to be compatible with C90 though.

The additional members were intended to be used during an interactive
debugging session only and were thus not relevant to running the actual
code.
2021-01-03 21:12:03 +00:00
rillig
7e95331a3d lint: fix code generation from err.c
That file does not need to be in the current directory.
2021-01-03 20:44:54 +00:00
rillig
eebb776c7b lint: rename funcarg and funccall to longer names
From the previous short names, it was no obvious that these functions
create a new tree node.

The function named funccall in lint2 has been left as-is, since it has a
completely different prototype.
2021-01-03 20:38:26 +00:00
rillig
78ea2303a8 lint: rename functions that create nodes 2021-01-03 20:31:08 +00:00
rillig
84a4b4d862 lint: add test for 265 "c89 C does not support 'long long'" 2021-01-03 20:20:01 +00:00
rillig
ef3ab72165 lint: rename prflstrg to printflike_argnum, likewise for scflstrg 2021-01-03 20:14:38 +00:00
rillig
225eb1e1c3 lint: rename cstk to cstmt
Most of the code that deals with control statements is only interested
in the innermost control statement, and not if that is a stack or not.
Therefore, emphasize that part in the variable name.

The member c_next was confusing since the "direction" of this "next
element" was ambiguous.  In a sequence of if statements, the "next"
element could have equally been the following one, not the surrounding
one.
2021-01-03 20:04:08 +00:00
rillig
9fdfd4f3b3 lint: rename t_ispacked to t_packed and d_ispacked to d_packed
It's shorter, and the other flags of the type or declaration also don't
have "is" in their names.  Except for t_isenum, but that's because there
is a macro named t_enum that would interfere with that name.
2021-01-03 19:15:36 +00:00
rillig
6a419e12c6 lint: rename type.t_isfield to t_bitfield 2021-01-03 19:10:47 +00:00
rillig
2c6ed6826b lint: in DEBUG mode, verify printf parameters for messages
Since several years GCC validates printf-style strings, and there is no
reason not to let GCC do that work.  This prevents bugs like the
segmentation fault that was fixed in tree.c 1.109 from 2021-01-01.

By default, lint is compiled with DEBUG off, but it's easy enough to
compile it in debug mode once in a while.
2021-01-03 18:48:37 +00:00
rillig
df33f93fa1 lint: remove redundant include of externs1.h
It is already included by lint1.h.
2021-01-03 18:35:51 +00:00
rillig
90901a1bb9 lint: let gnuism and c99ism return void instead of int
The return value was only used in a single case.  Duplicating the
condition for printing a message is ok in that case, since it makes all
other places in the code simpler.

The occasional "(void)" or "msg = " before the function call had hidden
the calls from check-msgs.lua, which didn't check the message texts in
such cases.
2021-01-03 17:42:45 +00:00
thorpej
eaa9b27a7c malloc(9) -> kmem(9) 2021-01-03 17:42:10 +00:00
thorpej
3ae509dff6 Use sel{record,remove}_knote(). 2021-01-03 17:28:33 +00:00
rillig
6eb357b43e lint: separate error and warning for 27 and 58
Even though this results in more lines of code, the benefit is that the
message text in the comment is verified by check-msgs.lua.  The code is
also easier to read, the parentheses and asterisk were not needed.
2021-01-03 17:11:19 +00:00
rillig
bd792b2822 lint: fix spelling of message 308
All other messages are lowercase as well.
2021-01-03 16:59:59 +00:00
rillig
87ac1cfc83 lint: add detailed type information for functions 2021-01-03 15:55:18 +00:00
rillig
6add3c2232 lint: add type information to message 124 "illegal pointer combination" 2021-01-03 15:51:16 +00:00