Commit Graph

284364 Commits

Author SHA1 Message Date
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
rillig cdbea9b3d8 lint: order tspec_name in the same way as the enum 2021-01-02 01:36:28 +00:00
rillig cf4174e436 lint: fix typo in check-msgs tool 2021-01-02 01:12:38 +00:00
rillig 11abe8f648 lint: use bool instead of u_int:1 in structures
Better late than never.
2021-01-02 01:06:15 +00:00
roy 40ce895ed2 libunbound: Enforce that mini_event isn't used by include/config.h
As I tire of fixing it to use libevent.
2021-01-01 23:24:31 +00:00
roy d362c81b92 Revert prior
With the correct #defines mini_event.c and winsock_event.c are
compiled but practically unused.

What is exposed is not part of the public API, but appease the
peanut gallery.
2021-01-01 23:17:15 +00:00
sjg 6ceffce7ae var-op-expand needs MAKE.SAVE_DOLLARS=yes 2021-01-01 23:07:48 +00:00
roy 5594672737 libunbound: Now we use libevent, don't build mini_event or winsock_event. 2021-01-01 20:38:36 +00:00
roy 45fc1a8d69 libunbound: actually use libevent as we link to it
Would appreciate if people modify this file to actually test what
polling mechanism unbound uses as select(2) is pretty poor.
2021-01-01 20:16:16 +00:00
rillig d82779b6ab lint: add debug logging for initialization using named members 2021-01-01 20:02:56 +00:00
rillig 2cd5c1a7b9 lint: document that C99-style initialization is necessarily buggy 2021-01-01 19:28:51 +00:00
rillig 5796421e62 lint: un-export struct istk 2021-01-01 19:15:58 +00:00
rillig c1c5b23632 lint: fix wrong warning about bitfield in C99 structure initialization
The variable namemem is supposed to be a circular list, which is
"documented" implicitly in push_member.

The implementation was buggy though.  In pop_member, the circular list
was destroyed though.  Given the list (capital, major, favorite_color,
green), removing capital made major point to itself in the forward
direction, even though it should not have been modified at all.

In the test, I had been too optimistic to quickly understand the code
around variable initialization.  I was wrong though, so I had to adjust
the comments there to reality.
2021-01-01 19:11:19 +00:00
roy ddf02b2602 ntpd: In the event of route(4) overflow, update the interfaces 2021-01-01 17:21:47 +00:00
rillig 59e2f0df9e lint: demonstrate bug in handling of nested C9X struct initializers 2021-01-01 16:50:47 +00:00
roy ec176a5418 wpa: If route socket overflows, sync drivers to system interfaces
Messages such as RTM_IFNFO or RTM_IFANNOUNCE could have been lost.
As such, sync the state of our internal driver to the state of the
system interfaces as reported by getifaddrs(2).

This change requires the routing socket be placed in non-blocking
mode. While here, set the routing and inet sockets to close on exec.
2021-01-01 14:57:14 +00:00
rillig 2839f6f6bd lint: remove custom LINTFLAGS
These flags are missing the options -g (GNUisms) and -S (C9X mode).
Without these flags, NetBSD's system headers cannot be compiled as they
make heavy use of __inline and __attribute__.
2021-01-01 14:51:44 +00:00
rillig 836dfa4dee lint: combine duplicate case branches in popdecl
This works around GCC 9, which didn't see that the following statement
cannot terminate normally, even though 0 is obviously a constant expression
and assert_failed is marked as __attribute__((__noreturn__)).

	do {
		if (!(0))
			assert_failed(...);
	} while (0)
2021-01-01 14:11:20 +00:00
riastradh f7a711185e Use printf, not printf_nolog, in lockdebug dumps.
Otherwise we get no diagnostic information in crash dumps or dmesg,
which really puts a damper on the utility of lockdebug.

(If there's a reason for printf_nolog instead of printf, it should be
documented in comments here, and it had better be a pretty good
reason for destroying the diagnostic information that is half the
point of lockdebug.)
2021-01-01 14:08:33 +00:00
riastradh ecec292739 Nix trailing whitespace. 2021-01-01 14:04:17 +00:00
kre d3bf6df7dc Build breakage fix (hopefully) - brain dead gcc. NFCI. 2021-01-01 13:43:34 +00:00
jmcneill cb08f90273 Use symbolic names for hwtype values. 2021-01-01 11:58:21 +00:00
rillig c4649232b6 lint: rename styp and utyp 2021-01-01 11:58:03 +00:00
jmcneill f1f55efcbf #define<tab> 2021-01-01 11:51:47 +00:00
rillig d7a1ba0dec lint: remove NTSPEC from enum tspec_t
The number of elements in an enumeration is not a valid enum constant of
that enumeration itself.
2021-01-01 11:51:15 +00:00
jmcneill 33a7d25ebe rk_i2s.c 2021-01-01 11:44:41 +00:00
rillig f78ee5c0ea lint: add missing redundant messages in source code 2021-01-01 11:41:01 +00:00
rillig cc7508a53e lint: complete message 203 for case labels 2021-01-01 11:14:06 +00:00
rillig ffe80b8ff2 lint: rename tokens for left and right parentheses 2021-01-01 11:09:40 +00:00
rillig 124253e8af lint: extract main part of case_label into separate function 2021-01-01 11:01:03 +00:00