Commit Graph

284443 Commits

Author SHA1 Message Date
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
rillig
5ba1c48094 lint: add test for message 124 "illegal pointer combination"
The message may be correct, but it is not helpful in any way.  There are
just too many function pointers that may differ in a very small detail.

Before tyname.c 1.20 from 2021-01-02, the string representation of type
names was often limited to only 63 characters.  Because of this, it made
sense to omit any detail that could need more space than this.  Now that
this limitation is gone, it's reasonable to add more detail to the type
information, especially since that information is readily available.
2021-01-03 15:44:35 +00:00
rillig
8a6c8bc42b lint: add tests for some of the messages 2021-01-03 15:35:00 +00:00
roy
a391b1d3f3 ntp: respect user's wishes to disable interface scanning
While here, disable periodic scanning by default on NetBSD as it's
no longer needed.
The user can still enable it though with a positive number to the -U
option.

kardel@ So far I see no other issues from the pitfalls I know of
2021-01-03 15:33:05 +00:00
skrll
49cd85942c Misc whitespace 2021-01-03 10:31:37 +00:00
ginsbach
f40edf74af df: add grand total option
Add a grand total option, -c, similar to the du(1) -c option. Adapted from
the same option (-c) in FreeBSD df(1).
2021-01-03 01:43:12 +00:00
uwe
4c353c3815 route(8): group RTF_GATEWAY and ~RTF_GATEWAY (-iface).
While here, tweak RTF_GATEWAY description.  Passive voice elsewhere in
this table is used to talk about the routes themselves, while here
it's about packets.
2021-01-02 22:02:27 +00:00
uwe
ba49a14327 route(8): be consistent about capitalization. 2021-01-02 20:36:02 +00:00
rillig
7035fe6a59 make(1): add a few remarks to JobOutput
That function is not used in practice.  Still, there are a lot of subtle
details that can get wrong in that code.
2021-01-02 20:09:06 +00:00
uwe
ea20573539 route(8): don't split -blackhole and -noblackhole. 2021-01-02 19:50:42 +00:00
rillig
e201064a7a lint: fix integration test
The body of an ATF test must never return 1 but instead report failure
via atf_fail.  Otherwise the following error message appears:

    Failed: Test case body returned a non-ok exit code, but this is
    not allowed

The test program t_integration intentionally bypasses the official ATF
API for performance reasons.  But even then, it should stick to the API
as close as possible.
2021-01-02 19:22:42 +00:00
rillig
297061dc12 lint: convert bitfieldtype_ok from int to bool
No functional change intended, except for the output in debug mode.
2021-01-02 18:44:58 +00:00
rillig
1046aa5d34 lint: fix lint warning 161 "constant in conditional context" 2021-01-02 18:26:44 +00:00
rillig
ad4fbc2570 lint: add a few more tests
No serious bugs found this time.
2021-01-02 18:06:01 +00:00
rillig
5827a84bf2 lint: fix message 308 "Invalid type for _Complex"
Previously, lint aborted since it didn't expect tspec_name to be called
with NOTSPEC, which at that point was the only possible value of
dcs->d_cmod.
2021-01-02 17:17:00 +00:00
rillig
4b1f579b14 lint: add test for message 308 "Invalid type %s for _Complex" 2021-01-02 16:55:45 +00:00
rillig
a52e33d19b lint: allow _Bool for bit-fields 2021-01-02 16:33:39 +00:00
rillig
0eb1390092 lint: fix and document test for illegal bit-fields
The _Complex bit-field should have been commented out.
2021-01-02 16:12:39 +00:00
rillig
9a83ddef77 lint: add test for message 35: illegal bit-field type
Bug: _Bool is not accepted as a bit-field, but it should be.

Bug: lint aborts in a controlled manner with message "common/tyname.c,
190: tspec_name(0)" when it sees a declaration of a _Complex bit-field.
(Not that a _Complex bit-field would make any sense.)
2021-01-02 15:55:54 +00:00
jmcneill
588c4b5800 Use USBMALLOC_ZERO to ensure that all DMA memory is zero initialized. 2021-01-02 12:39:33 +00:00
jmcneill
af3c884e20 Add USBMALLOC_ZERO flag for requesting zero initialized DMA memory. 2021-01-02 12:39:03 +00:00
jmcneill
8582796087 set the cursor to invisible 2021-01-02 12:12:26 +00:00
jmcneill
b7ebe3f39d trailing whitespace 2021-01-02 12:10:17 +00:00
ryo
7c39e4802c add dts for odroid-N2 plus 2021-01-02 11:36:36 +00:00
rillig
5281bfe656 lint: demonstrate that -t mode is practically unusable
Since main1.c from 2014-04-18, running lint in -t mode produces strange
warnings in lines 1 to 3 of no file at all.

This is caused by the builtins that are parsed in main().  These
builtins are incompatible with traditional mode because they use long
double, which had not been known at that time.
2021-01-02 11:12:34 +00:00
rillig
a0a15c1464 lint: add a test for each message produced by lint1
Having a test for each message ensures that upcoming refactorings don't
break the basic functionality.  Adding the tests will also discover
previously unknown bugs in lint.

The tests ensure that every lint message can actually be triggered, and
they demonstrate how to do so.  Having a separate file for each test
leaves enough space for documenting historical anecdotes, rationale or
edge cases, keeping them away from the source code.

The interesting details of this commit are in Makefile and
t_integration.sh.  All other files are just auto-generated.

When running the tests as part of ATF, they are packed together as a
single test case.  Conceptually, it would have been better to have each
test as a separate test case, but ATF quickly becomes very slow as soon
as a test program defines too many test cases, and 50 is already too
many.  The time complexity is O(n^2), not O(n) as one would expect.
It's the same problem as in tests/usr.bin/make, which has over 300 test
cases as well.
2021-01-02 10:22:42 +00:00
wiz
a2a2d948d4 Markup/typo fixes. 2021-01-02 08:55:51 +00:00
ryo
891e9034bd revert http://mail-index.netbsd.org/source-changes/2021/01/01/msg125648.html
FYI: http://mail-index.netbsd.org/source-changes-d/2021/01/01/msg013085.html
2021-01-02 08:38:55 +00:00
rillig
3ea7d2a77a lint: fix buffer truncation for type names
Previously, most type names had been cut off after 63 significant
characters.  In some cases, 127 characters survived, or 255.  And for
the debugging messages, sometimes even 1023.  This inconsistency was
useless.

It was wrong in the first place to make the caller of the function
tyname responsible for handling the buffer.  That's not something a
caller of such a simple function should do.  These callers have better
things to do.

The API of the new function type_name is as simple as possible.

In the implementation, the name of the type is generated anew each time.
I just didn't know whether the type details could change, once the type
is initialized, and I didn't want to find out.  To be on the safe side,
the resulting type name is cached, independently of the type it was
generated for.  Using a trivial, unbalanced binary tree should be good
enough for now.

All this work is necessary to support adding new debug logging, without
being distracted by irrelevant implementation details such as these
buffer sizes.  Adding new debug messages should be fun and easy; up to
now, it was overly bureaucratic.
2021-01-02 03:49:25 +00:00
nat
bfa1e92456 Update the debug set for testpat(6). 2021-01-02 03:41:06 +00:00
nat
268f30338f Add testpat(6) to the games set. 2021-01-02 03:24:01 +00:00
nat
ad733c96b3 Add testpat(6) to games.
Testpat displays a test pattern in curses(3).
2021-01-02 03:21:39 +00:00
macallan
7003c5c68f be more careful when optimizing stretches of blanks into erasecols()
now testpat's output is redrawn properly
2021-01-02 03:00:56 +00:00
rin
f2c339bc51 Use <compat/netbsd32/netbsd32.h> instead of <machine/netbsd32_machdep.h>,
which is not intended for standalone use.

Compile tested for all ports with their own COMPAT_NETBSD32 codes:
aarch64, amd64, arm, mips64, sparc64, and algor64.

Should fix build failure for mips64 in netbsd-9, where netbsd32.h is not
included by other header files.
2021-01-02 02:13:42 +00:00