Commit Graph

6280 Commits

Author SHA1 Message Date
andvar 95f94af301 fix various typos in documentation, comments and sysctl device description.
mainly aion -> ation and inlude -> include.
2023-03-26 19:10:32 +00:00
martin 9da6df7d4c PR 57284: rewrite test to extract all temperaturs from all local sensors
and test them (instead of only one temperature from a tiny list of hard
coded possible devices).
2023-03-23 11:32:49 +00:00
hannken 86c75e95c0 Adjust pc/npc before syscall allowing EJUSTRETURN to return
to the next instruction.  Only ERESTART should return to
the same instruction.  Differences to sparc64 reduced.

Test t_ptrace_wait:syscallemu1 now passes on sparc.

Fixes PR kern/52166 "syscallemu does not work on sparc (32-bit)"

Ok: Martin Husemann
2023-03-20 11:19:29 +00:00
kre 23edd9e279 Adjust the tilde expansion test to deal with (very) recent changes
to what the shell produces for tilde expansions, when the expansion
of the tilde prefix ends with '/' and the character immediately following
is another '/' - previously /bin/sh (and most other shells, but not all)
retained both slashes, and this test expected that behaviour.

No longer, now only one of the two will appear.  Adjust the expected
test results accordingly, and add an extra loop iteration to make sure
this is thoroughly tested (one more tilde expansion value).

Also, add two new test cases that test for the new (explicit - though
it was always stated this way, but not as explicitly) that if HOME is
an empty string (not unset - that remains an unspecified case, as it
was) then the expansion of ~ must generate "", and not nothing.
The current test was unable to distinguish those two, since it
simply looked for characters in the output, so add a new test cases
explicitly to test for this particular case.   This also means (also
previously in the standard, but not as explicitly) that shells are
not permitted to decide "The ~ expansion produces an empty string, that
is weird, let's generate something else instead" which some shells were
doing.
2023-03-06 05:54:54 +00:00
nia 188cf0e1a1 delete attribution per request of contributor 2023-03-01 21:06:41 +00:00
rillig eaf30a03e7 lint: split platform-specific test for loss of accuracy
Lint distinguishes between platforms where size_t is unsigned int and
platforms where size_t is unsigned long.
2023-02-27 23:07:53 +00:00
rillig 17f65f1e9a tests/lint: sync test for nonportable character comparisons
Message 230 was changed on 2023-02-22 but only tested on signed char
platforms.
2023-02-27 21:59:14 +00:00
sjg 68f52b2486 t_make skip varname-dot-make-meta-ignore_*
The meta-ignore tests will likely not work in this environment
so skip them.
2023-02-25 19:37:33 +00:00
rillig 6adfeb9415 lint: fix confusing message about nonportable character constants 2023-02-22 22:30:40 +00:00
rillig f29e29e219 tests/lint: add platform-specific tests 2023-02-22 22:12:35 +00:00
rillig 68d13a7aa7 lint: fix null pointer dereference in invalid case expression 2023-02-21 19:47:21 +00:00
christos 36c8de9256 New optval test from des @ FreeBSD 2023-02-20 15:47:56 +00:00
rillig 4995df0909 lint: do not warn about traditional C migration in C99 mode
For large integer constants, the resulting type could differ between
traditional C and C90. In C99 mode, this difference is no longer
relevant since it is too far away from traditional C.
2023-02-19 12:00:15 +00:00
rillig a44d0c3164 tests/lint: fix and extend tests for C90 migration warning 2023-02-19 11:50:29 +00:00
rillig 8ee241b006 lint: remove compat code for lexing hex floating point literals
Hex floating literals are required by C99.
2023-02-18 14:32:32 +00:00
andvar f231fa93bb s/plyaback/playback/ in comment. 2023-02-13 22:24:06 +00:00
rillig 15a1e93882 tests/lint: sync reference to platform properties generator 2023-02-06 21:20:58 +00:00
rillig 456342a5d0 lint: eliminate unnecessary indirection
No functional change.
2023-02-06 21:01:55 +00:00
rillig f1b2140bb8 tests/lint: fix source directory for looking up the .exp-ln files 2023-02-05 17:23:01 +00:00
rillig 6d1c4d2bf4 tests/lint1: the redundantly listed files contained .exp-ln as well 2023-02-05 16:11:56 +00:00
rillig d81c1a19b2 tests/lint: fix resolving of wildcards in builds from other directories 2023-02-05 15:11:19 +00:00
rillig cd59f013cc tests/lint: merge tests for initialization 2023-02-05 13:01:28 +00:00
rillig 6730036cf8 tests/lint: remove redundancy from Makefile
The list of test files is already kept in distrib/sets/lists/tests/mi.
2023-02-05 12:36:56 +00:00
rillig 134e5c5e76 tests/lint: remove redundant tests
The names of the tests were misleading: 'recursive' should have been
'nested', and the interesting topic in the 'cast' tests was not the cast
but the pointer dereference.
2023-02-05 12:25:11 +00:00
rillig 9de3085848 tests/lint: clean up
The .exp files are no longer kept under version control, so there's no
reason anymore to forcefully trigger a warning or an error.
2023-02-05 10:57:48 +00:00
christos e20f737644 PR/57205: Dag-Erling Smørgrav: Add tests strchrnul(3), fix strchr pasto
from strlen.
2023-01-30 19:49:49 +00:00
rillig e0bb9f7cf5 lint: properly clean up when leaving a function definition 2023-01-29 18:37:20 +00:00
rillig b5b35fa5a0 lint: fix definition of __func__ 2023-01-29 18:16:48 +00:00
rillig e80194217c lint: demonstrate wrong declaration of __func__ 2023-01-29 17:36:26 +00:00
rillig 2f05763014 lint: don't warn about negative '>>' when the actual value is positive 2023-01-29 17:13:10 +00:00
rillig 6b8b6837b1 tests/lint: merge tests for '>>' 2023-01-29 17:02:09 +00:00
rillig b4db8a2cd2 tests/lint: document how compilers promote bit-fields 2023-01-28 08:36:17 +00:00
rillig 93f3a70d97 tests/lint: investigate how compilers interpret bit-fields 2023-01-28 08:30:12 +00:00
rillig f25c712f32 tests/lint: merge tests for declaration after statement 2023-01-22 17:17:24 +00:00
rillig 0ad5a70976 lint: prevent undefined behavior for signed '<<'
Found by manual code inspection, verified by MKSANITIZER=yes
USE_SANITIZER=undefined.
2023-01-22 16:05:08 +00:00
rillig a695cd72f6 lint: add test for floating constant overflow 2023-01-21 17:48:29 +00:00
rillig 798c690d94 lint: add support for C11 '_Atomic' as atomic-type-specifier
Following the C11 grammar, the keyword '_Atomic' needs to be a separate
syntactic category, to avoid further conflicts in the grammar.

The two newly added conflicts in the grammar would come into play when
mixing traditional C with C11, in a type name without an implicit 'int'.
If the type '_Atomic(int)*' were parsed as '_Atomic int(int)*', the
trailing '*' would be a syntax error.
2023-01-21 13:48:40 +00:00
rillig e104b7676c lint: add support for the C11 type qualifier '_Atomic'
That keyword can be used as a type specifier as well, support for that
will be added later.
2023-01-21 13:07:21 +00:00
rillig 149d92727c tests/lint: test _Atomic, added in C11 2023-01-21 11:57:03 +00:00
rillig 5db76b35c9 lint: fix null pointer dereference on invalid argument to __typeof__ 2023-01-21 08:04:43 +00:00
rillig d67dd6957e tests/make: rename files that are not test cases 2023-01-19 23:26:14 +00:00
rillig f523563840 tests/lint: fix typo in comment 2023-01-16 00:37:59 +00:00
rillig 66827794fe tests/lint: add basic tests for lint (not lint1 or lint2) 2023-01-15 23:18:05 +00:00
rillig 8e78cfd5a6 tests/lint: document conversion from void pointer 2023-01-15 14:00:09 +00:00
rillig 687f4c966a tests/lint: fix test for sizeof with variable-length array 2023-01-15 13:55:06 +00:00
rillig f0df5ddf92 tests/lint: add more tests for sizeof 2023-01-15 13:30:04 +00:00
rillig 7997ddce85 tests/lint: add test for parsing sizeof expressions 2023-01-15 00:53:19 +00:00
rillig a5ae950d72 tests/lint: add more tests for array/enum mismatch 2023-01-14 11:15:07 +00:00
rillig 0f2ef2d80b lint: rename lint2 functions to be more expressive 2023-01-14 08:48:18 +00:00
rillig 872114d0db lint: do not report usual arithmetic conversions for constants 2023-01-08 18:37:12 +00:00
rillig 12c5dc767e lint/tests: test query for usual arithmetic conversions 2023-01-08 18:21:00 +00:00
rillig 8c46ae662d lint: recognize enum constant named 'max' as a count of values
Seen in external/bsd/mdocml/dist/mdoc.h(50).
2023-01-08 15:22:33 +00:00
rillig e39cd4feb0 tests/lint: add more tests for enum/array mismatch 2023-01-08 15:18:02 +00:00
rillig a89fe711df tests/lint: remove obsolete comments
The handling of initializers was completely rewritten in init.c 1.228
from 2021-12-21.
2023-01-04 06:04:07 +00:00
rillig e1fea1d661 tests/lint: document where to find the test results for promotions 2023-01-04 05:47:19 +00:00
rillig ce38ef24bf tests/lint: fix typo in comment 2023-01-04 05:32:01 +00:00
rillig 7c0153f0bf tests/lint: merge tests for ':?' with null pointer constant 2023-01-04 05:25:08 +00:00
rillig 391c34354a lint: fix the result type of '?:' for void pointers
The change from 2015-07-29 was wrong since that rule only applies to
null pointer constants but not to other void pointers.
2023-01-04 05:08:22 +00:00
rillig 6173d74cda tests/lint: demonstrate wrong type for '?:' expressions 2023-01-03 22:02:20 +00:00
riastradh ddb0a7e7a7 swab(3): Rewrite this to be understandable.
And make the tests work, and exercise all lengths up to 100.

Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141

XXX pullup-8
XXX pullup-9
XXX pullup-10
2022-12-28 15:34:19 +00:00
wiz c1acb3b3a5 adapt mbstowcs_basic test for unicode table update
reformat so it's easier to find which result data belongs to which input
2022-12-21 09:33:34 +00:00
kre 1cba94e3a4 This test makes (made) a false assumption about the way that
process scheduling works.   That a process (or in this case,
a thread) is no longer blocked at time T does not mean that it
will resume execution at time T.   The OS is free to devote
resources to other processes/threads instead - all we should
normally be able to expect is that if it is not unblocked before
time T, that it will not start running before then.

In general though, the pthread_cond_*wait() functions don't guarantee
even that - but for this test, the possibility of something else
randomly signalling the condvar isn't believable, so don't worry about
that possibility (but do fail without calling strerror(0) on the off
chance it does happen).

Once we cease testing that the process resumed running before some
particular time, we can stop dealing with qemu timekeeping issues,
it might (seem to) take qemu twice as long as was requested before
the thread resumes, but that's OK - the same thing could happen on
a loaded system for other reasons.

Beyond that, the test also has (had) a race condition.   When using
CLOCK_REALTIME though that clock needed to have advanced to T before
the ETIMEDOUT should happen, there is no guarantee that it will stay >T
(CLOCK_REALTIME is allowed to be reset backwards).   So, only test
that the current time (after ETIMEDOUT) >= T when we're using
CLOCK_MONOTONIC - for CLOCK_REALTIME the time might have stepped
back between when the ETIMEDOUT happened and when the thread
obtains the current clock reading.  For that case, all we can test
is that the ETIMEDOUT actually happens.

With much of what was there now gone, the code can be simplified,
we no longer need to do timespec arithmetic, just one comparison
(simpler to test that Tend >= Tstart+period than Tend-Tstart > period
as we need Tstart+period for the abstime value for the timeout anyway).

Note that this still tests for the issue reported in PR lib/47703
which is where the test came from in the first place.

ps: we seem to be missing pthread_cond_clockwait() which is the same
as pthread_cond_timedwait() except that the clock to use is passed
as a parameter, rather than as an attribute of the condition variable.
2022-12-11 10:02:53 +00:00
blymn c6e199d915 Update check files due to reversion of a libcurses change. 2022-12-05 21:15:07 +00:00
jschauma de630815c5 allow testing of files other than those in /etc
To test e.g., the file "/some/where/protocols" instead of "/etc/protocols",
set TEST_FILE=/some/where/protocols in your environment.

Note: this now compares the contents of the file you gave versus what
getprotoent(3)/getservent(3) uses (which still is /etc/protocols via
h_protoent.c / /etc/services or /var/db/services.cdb via h_servent.c).

When you have expected changes in the services or protocols file that
you're generating, this necessarily produces a difference.  To really
allow testing the file versus what the library function returns, you'd
have to install the file on the system running the test, but at least
with this change you can now generate the file and verify that it didn't
caused unexpected differences.
2022-12-04 02:53:17 +00:00
jschauma 76292795b2 whitespace 2022-12-04 02:42:39 +00:00
ozaki-r 9ac30c6562 tests: fix Makefile and lists for MKRUMP=no
Pointed out by Michael Scholz, thanks.
2022-12-01 04:24:37 +00:00
martin 062f53e0d1 Avoid explicitly naming the raw part device with a partition letter - use
the non-partition letter variant instead.
2022-11-30 17:49:59 +00:00
martin 8693f01d5f Unfortunately rump does not provide the same magic as MAKEDEV does
for native /dev and create an alias for disk devices w/o partition
latter pointing at the raw partition, so for rump based tests we
actually have to calculate the concrete device name.

Use an idiom suggested by kre for this which also works for ports that
have kern.rawpartition > 4.
2022-11-30 17:49:09 +00:00
ozaki-r 2c37112bef tests: restore a line removed accidentally 2022-11-30 07:48:43 +00:00
martin 2e1faf8f64 Simplify: avoid use of the explicit raw partition, MAKDEV does
all the needed magic for us already. Pointed out by kre
2022-11-30 07:20:36 +00:00
blymn 731bbb483f Update the check files due to bug fix in libcurses. 2022-11-30 06:20:17 +00:00
ozaki-r efcd8443e2 tests: build and install t_ip_reass.c 2022-11-30 06:07:51 +00:00
ozaki-r 67a880e0c1 tests: tweak t_ip_reass.c for NetBSD
The test is modified to run on rump kernels.
2022-11-30 06:06:36 +00:00
ozaki-r 34f02c31eb tests: import ip_reass_test.c from FreeBSD as t_ip_reass.c
As of:
	commit 9ed1e4ecd4e9eb3bde16f52a937a6fa86a971638
	Author: Mark Johnston <markj@FreeBSD.org>
	Date:   Tue Nov 20 18:13:18 2018 +0000

	    Plug a trivial memory leak.

	    CID:            1396911
	    MFC with:       r340485
2022-11-30 06:05:58 +00:00
martin e04aecab2f Avoid dependence on details of the MD synthesized disklabel for
the vnd after mounting the single filesystem image.
2022-11-29 20:06:24 +00:00
jschauma 0adaf508e8 whoops, we don't want an extra space here
(erroneously introduced in my previous commit)
2022-11-28 17:41:00 +00:00
jschauma a8b3b3348f whitespace 2022-11-28 17:09:52 +00:00
knakahara d432a9d987 Add ATF for unnumbered interfaces. 2022-11-25 08:43:15 +00:00
knakahara 708e59eb6f clean up 2022-11-24 02:58:28 +00:00
christos 902698381c fix vax 2022-11-23 18:18:57 +00:00
rin 867b834377 Sync style between Lua script and C source code.
Fix false positive for some tests.
2022-11-22 15:57:03 +00:00
christos ae082add65 lua libm API from Phil Rulon 2022-11-21 22:01:32 +00:00
martin f202639d6b vnconfig is used in this tests, so require user root. 2022-11-21 19:07:36 +00:00
kre c01cab9c1c Adapt to recent gpt(8) change which now issues a message when
the secondary GPT header is moved.   Do it this way rather than
just using -q to suppress the message, so the test verifies that
the appropriate action was taken.
2022-11-21 16:06:00 +00:00
ozaki-r a97d0b3002 tests: build and install added test files 2022-11-17 08:45:35 +00:00
ozaki-r 86fd57d8dd tests: add t_broadcast_bind.sh 2022-11-17 08:42:56 +00:00
ozaki-r eedb766f76 tests: tweak broadcast_bind.c for NetBSD 2022-11-17 08:42:06 +00:00
ozaki-r a86cd60e5f tests: import broadcast_bind.c from OpenBSD
As of $OpenBSD: broadcast_bind.c,v 1.2 2015/12/02 20:45:00 mpi Exp $
2022-11-17 08:41:16 +00:00
ozaki-r 3eb71caadc tests: add t_inpcb_bind.sh 2022-11-17 08:40:23 +00:00
ozaki-r ae0059cb30 tests: make inpcb_bind.c buildable 2022-11-17 08:38:58 +00:00
ozaki-r 0fca6c426e tests: import in_pcbbind/runtest.c from OpenBSD as inpcb_bind.c
As of $OpenBSD: runtest.c,v 1.7 2022/04/10 14:08:35 claudio Exp $
2022-11-17 08:38:08 +00:00
ozaki-r 87c661b6f4 tests: make t_tcp_connect_port.c run on rump kernel 2022-11-17 08:36:54 +00:00
ozaki-r ed458f0ba0 tests: import tcp_connect_port_test.c from FreeBSD as t_tcp_connect_port.c
As of:
	commit 36c52a52eecf1ed0232f9e138564009a85de76c2
	Author: Jonathan T. Looney <jtl@FreeBSD.org>
	Date:   Sat Nov 14 15:44:28 2020 +0000

	    Add a regression test for the port-selection behavior fixed in r367680.
2022-11-17 08:36:00 +00:00
ozaki-r 652168dc16 tests: make t_socket_afinet.c run on rump kernel 2022-11-17 08:34:39 +00:00
ozaki-r 7b795c7b93 tests: import socket_afinet.c from FreeBSD as t_socket_afinet.c
As of:
	commit 3aaaa2efde896e19d229ee2cf09fe7e6ab0fbf6e
	Author: Thomas Munro <tmunro@FreeBSD.org>
	Date:   Wed Apr 28 21:31:38 2021 +1200

	    poll(2): Add POLLRDHUP.
2022-11-17 08:33:27 +00:00
chs 87ba0e2a31 Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new	fsck_ffs operations "-c	ea" and	"-c no-ea" to convert file systems
from UFS2 to UFS2ea and	vice-versa (both of which delete all existing extended
attributes in the process).
2022-11-17 06:40:38 +00:00
blymn a90239df44 Uncomment the waddstr call that was returning ERR, this is actually
correct so make the expected return ERR then repeat the call with
scrollok set to true to validate.

Do refreshes on the window instead of stdscr so we get the window
contents reported and update the check files with the expected
output.
2022-11-10 06:13:29 +00:00
knakahara 9d1cf4af54 Add test for sys/netipsec/ipsec.c:r1.176. 2022-11-09 08:21:20 +00:00
blymn ea7ddd486e * Uncomment the slk_wset test which was previously commented out due
to incorrect output as this bug has been fixed.
* Added a check file to verify the slk_wset output.
2022-11-08 06:06:54 +00:00
msaitoh 175c89d22f Sync with if_dl.h rev. 1.31's change. 2022-11-07 08:34:30 +00:00
ozaki-r 3df6c9b812 tests: add tests for invalid extra operations on a shutdown socket
The tests cover some error paths that normally happen.
2022-11-04 08:01:42 +00:00
blymn a3f4239604 Update check files to allow for changes due to fixes to libcurses. 2022-11-04 06:17:58 +00:00
ozaki-r c3619612ae tests: add tests for TCP with nc 2022-11-02 09:37:56 +00:00
ozaki-r a18735eded tests: enable start_nc_server to have extra options for nc 2022-11-02 09:35:12 +00:00
msaitoh 838c32b638 Revert for if_dl.h's change. 2022-10-27 12:59:59 +00:00
msaitoh 5b130b9d06 Sync with if_dl.h rev. 1.29's change. 2022-10-24 13:42:55 +00:00
blymn 7adc35708b Updates to account for changes resulting from fixes to libcurses. 2022-10-19 06:10:43 +00:00
rillig ce87d2e53b tests/lint: add more examples for 'extra bits set to 0'
Seen in sys/external/bsd/compiler_rt/dist/lib/builtins/fp_lib.h:88.
2022-10-15 21:19:15 +00:00
knakahara ae6e8d4c4e Add test for sadb_x_policy->sadb_x_policy_flags. 2022-10-11 09:55:21 +00:00
ryo f5b5fa5b34 add tests for PR/57046. 2022-10-06 06:05:31 +00:00
rillig 55d487c96b lint: miscellaneous cleanup
No functional change.
2022-10-01 10:04:06 +00:00
rillig bb8d02713c lint: add hyphen to adjective 'old-style' 2022-10-01 09:42:40 +00:00
skrll d5bc748e3e toolchain/57033: usr.bin/c++/t_call_once2:call_once2_profile test case fails
Remove the -static flag I added because it doesn't fix anything and it
actually causes more problems.
2022-09-29 07:22:49 +00:00
skrll 745686120d toolchain/57033: usr.bin/c++/t_call_once2:call_once2_profile test case fails
Revive a missing space.
2022-09-28 11:09:59 +00:00
rillig 07d76dc41e tests/lint: fix test for queries on platforms where char is unsigned
error: queries.c(118): missing /* expect+1: implicit conversion
    changes sign from 'char' to 'int' [Q3] */
error: queries.c(122): missing /* expect+1: implicit conversion
    changes sign from 'char' to 'int' [Q3] */
2022-09-24 19:55:44 +00:00
knakahara 34a1a4b9aa tests: add tests for automatic route deletions on an address removal 2022-09-20 02:25:07 +00:00
rillig 0f43f630f1 tests/lint: fix test for queries on platforms where char is unsigned
These platforms reported an additional "implicit conversion changes
sign" in lines 105, 105, 118, 122.
2022-09-10 13:13:22 +00:00
rillig 6c259f3957 fix misspellings of 'available' and nearby typos 2022-09-10 12:14:17 +00:00
wiz ab1d953c71 grep: when -r is used, but no path argument provided, search the current dir
As discussed on tech-userlevel.
2022-09-09 22:14:28 +00:00
rillig 2676d01412 lint: rename dcs manipulation functions to be clearer
No functional change.
2022-08-28 08:41:06 +00:00
rillig c588212fb6 tests/lint: add more information to test for __attribute__((aligned))
Declaring an array type having a negative dimension is the simplest way
to embed an integer into a lint diagnostic, thereby revealing what size
and alignment lint has calculated for a struct.

While here, move these "compile-time assertions" closer to their
corresponding struct, to make reading easier.
2022-08-27 23:24:37 +00:00
rillig 68d3211991 tests/lint: add another test for aligned struct member
In the kernel, several structs have this attribute, and running lint on
them runs into a compile-time assertion.  Typical error messages are:

* error: illegal bit-field size: 255 [36]
* error: integral constant expression expected [55]
2022-08-27 21:59:41 +00:00
christos 5dd94c5e95 Add sincos{,f,l} from FreeBSD 2022-08-27 08:31:58 +00:00
rillig a649f3d0e9 lint: remove explicit list of known GCC attributes
Most GCC attributes consist of a single identifier.  Up to now, it was
necessary to list each of these identifiers in the grammar, even those
that only apply to a single target architecture.

Instead, parse the general form of attributes, matching the few
attributes that lint handles by name instead.  While here, rename the
grammar rules to use the GCC terms.

To avoid conflicts between the global function 'printf' and the GCC
attribute of the same name, do not add GCC attributes to the symbol
table, and don't make these symbols 'extern' either.

ok christos@.
2022-08-25 19:03:47 +00:00
mlelstv c0019d5261 requires pmap_private.h now. 2022-08-21 14:06:42 +00:00
rillig e8f3e4bdea lint: add more details to message about large bit-shifts 2022-08-19 19:40:39 +00:00
rillig a45115be53 tests/lint: demonstrate wrong warning about bit-shift 2022-08-19 19:13:04 +00:00
hannken e14a6c8694 When run from py-anita/amd64 this test fails with:
cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".
2022-08-13 17:46:26 +00:00
isaki aa3450bc70 audiotest: Add two tests for AUDIO_SETINFO after mmap.
These tests affect only standalone test, not atf.
2022-08-13 07:22:40 +00:00
isaki 248c923741 audiotest: Fix typo in comments. 2022-08-13 07:19:15 +00:00
isaki 00cd774dfc audiotest: Separate mmap_len test by parameters.
This change affects only standalone test, not atf.
2022-08-13 07:14:40 +00:00
riastradh fdfb7cab0e membar(3): Fix t_spinlock for machines with hash-locked atomics.
Regular stores don't participate in the hash-locking scheme, so use
atomic_swap instead of a regular store here.
2022-08-12 11:21:44 +00:00
riastradh 920e28df65 cgdconfig(8): Add support for shared keys.
New clause `shared <id> algorithm <alg> subkey <info>' in a keygen
block enables `cgdconfig -C' to reuse a key between different params
files, so you can, e.g., use a single password for multiple disks.
This is better than simply caching the password itself because:

- Hashing the password is expensive, so it should only be done once.

  Suppose your budget is time t before you get bored, and you
  calibrate password hash parameters to unlock n disks before you get
  bored waiting for `cgdconfig -C'.

  . With n password hashings the adversary's cost goes up only by a
    factor of t/n.
  . With one password hashing and n subkeys the adversary's cost goes
    up by a factor of n.

  And if you ever add a disk, rehashing it will make `cgdconfig -C'
  go over budget, whereas another subkey adds negligible cost to you.

- Subkeys work for other types of keygen blocks, like shell_cmd,
  which could be used to get a key from a hardware token that needs a
  button press.

The <info> parameter must be different for each params file;
everything else in the keygen block must be the same.  With this
clause, the keygen block determines a shared key used only to derive
keys; the actual key used by cgdconfig is derived from the shared key
by the specified algorithm.

The only supported algorithm is hkdf-hmac-sha256, which uses
HKDF-Expand of RFC 5869 instantiated with SHA-256.

Example:

	algorithm aes-cbc;
	iv-method encblkno1;
	keylength 128;
	verify_method none;
	keygen pkcs5_pbkdf2/sha1 {
		iterations 39361;
		salt AAAAgMoHiYonye6KogdYJAobCHE=;
		shared "pw" algorithm hkdf-hmac-sha256
		    subkey AAAAgFlw0BMQ5gY+haYkZ6JC+yY=;
	};

The key used for this disk will be derived by

	HKDF-HMAC-SHA256_k(WXDQExDmBj6FpiRnokL7Jg==),

where k is the outcome of PBKDF2-SHA1 with the given parameters.

Note that <info> encodes a four-byte prefix giving the big-endian
length in bits of the info argument to HKDF, just like all other bit
strings in cgdconfig parameters files.

If you have multiple disks configured using the same keygen block
except for the info parameter, `cgdconfig -C' will only prompt once
for your passphrase, generate a shared key k with PBKDF2 as usual,
and then reuse it for each of the disks.
2022-08-12 10:49:17 +00:00
riastradh 732db29a3c cgdconfig(8): New -T operation prints all generated keys in cgd.conf.
For testing purposes.
2022-08-12 10:48:44 +00:00
riastradh a7c16118d0 cgdconfig(8): New -t operation just prints the derived key in base64.
For testing purposes.
2022-08-12 10:48:27 +00:00
charlotte f5524c7c97 Add a TNF copyright statement in t_mixerctl.sh 2022-08-10 00:14:22 +00:00
andvar b117086304 fix some typos and grammar in comments. 2022-08-07 10:12:19 +00:00
andvar 6478b40555 s/blity/bility/ in various words, mainly in comments. 2022-08-06 18:26:41 +00:00
kre 52acc68675 Provide _GNU_SOURCE for t_clone now that is required to make clone()
visible.
2022-08-01 15:48:39 +00:00
andvar 4fe346050d s/fucntion/function/ in comments. 2022-07-26 19:49:32 +00:00
riastradh 9f0a763c4a t_sig_backtrace: Pacify vfork clobber warning with volatile. 2022-07-25 22:43:01 +00:00
riastradh 2edbbc6f32 execinfo(3): Mark sig_backtrace_jump test as xfail.
PR lib/56940
2022-07-25 22:37:37 +00:00
riastradh d14f9f0135 execinfo: Fix mistake in previous: match `the_loop*' as prefix.
Now that there are two functions we need to catch either one.
2022-07-25 11:02:41 +00:00
riastradh 03353bf482 execinfo: Test stack traces through null pointer jump too. 2022-07-25 10:38:17 +00:00
kre fa7d65a3b6 Add ATF tests for realpath(1)
Note that realpath can act differently for root than for other users
(where an ordinary user will see EACCESS root just barrels right through).

The tests adapt themselves, when run as root, less error cases can be
tested than when run as some other user.
2022-07-21 09:52:48 +00:00
thorpej 75d451f371 Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.
2022-07-18 04:30:30 +00:00
rillig d39a56301d lint: add more details to message about pointer alignment
The previous message 'may cause alignment problem' was not detailed
enough to be actionable, it didn't give the necessary insight to why
lint was complaining at all.

The new message 'increases alignment from 1 to 4' or 'from 2 to 8'
describes the potentially problematic conversion, and together with the
involved type names, it allows an informed decision about whether lint's
warning is warranted or not.

In a typical NetBSD build, this warning is in the top 10.  The number of
these warnings depends on the architecture, it is typically between 800
and 1600.
2022-07-16 22:36:06 +00:00
rillig 238d676f52 lint: fix edge cases in the query for redundant cast before assignment
Casting from and to _Bool is only allowed outside strict bool mode.
Outside strict bool mode, _Bool is an integer type, therefore return
early if any of the operands has type _Bool.  In strict bool mode, even
casting from _Bool to _Bool is not allowed, as it is not needed in
practice.

Handle _Complex types before real floating-point types.  Return early
for _Complex types, as these are floating-point types as well.

For pointer casts, not only flag casts to or from 'pointer to void', but
also casts between the same types.

In debug mode, when constructing the type '_Complex float', the type
name of '_Complex' occurs in the debug log.  Outside of debug mode,
printing this type name is an error since this type keyword only occurs
internally, when constructing a type.  At that point, it is not supposed
to occur in any user-visible message.
2022-07-08 21:19:06 +00:00
rillig 9db688f9b4 lint: fix query for redundant cast before assignment
Previously, 'i = (int)dbl' was marked as redundant, even though it
performs a value conversion.
2022-07-08 20:27:36 +00:00
rillig 881bc41253 tests/lint: document why in ic_expr, '&' does not need before_conversion 2022-07-07 18:11:29 +00:00
rillig 5158c3886d lint: do not warn about 'may lose accuracy' in safe cases of '%'
The possible values of the expression 'a % b' for unsigned integers lie
between 0 and (b - 1).  For signed integers, it's more complicated, so
ignore them for now.
2022-07-06 22:26:30 +00:00
rillig 41da170b98 tests/lint: test 'may lose accuracy' for '%'
For unsigned integers, the possible range of the result can be narrowed
down by looking at the right operand of the '%'.  Right now, lint
doesn't do this though.
2022-07-06 21:59:06 +00:00
rillig d9029d5695 tests/lint: add test for 'assignment in conditional context' 2022-07-06 21:13:13 +00:00
rillig 715e58e70b lint: add additional queries that are not enabled by default
In the last 18 months, several lint warnings have been made adjusted to
allow common usage patterns.  For example, lint no longer warns about a
constant condition in the statement 'do { ... } while (false)' (message
161), as this pattern is well-known in statement-like macros, making it
unlikely that the 'false' is a mistake.  Another example is casts
between unequal pointer types (message 247) for a few well-known
patterns that are unlikely to be bugs.

Occasionally, it is useful to query the code for patterns or events that
would not justify a warning.  These patterns are modeled as predefined
queries that can be selected individually, in addition to and
independently of the existing warnings and errors.

New queries can be added as needed, in the same way as new warnings.
Queries that are deemed no longer used can be deactivated in the same
way as warnings that are no longer used.

As long as none of the queries is enabled, they produce a minimal
overhead of querying a single global variable.  Computations that are
more expensive than a few machine instructions should be guarded by
any_query_enabled.

https://mail-index.netbsd.org/source-changes-d/2022/06/28/msg013716.html

ok christos@
2022-07-05 22:50:41 +00:00
rillig 1929095001 lint: include the width of bit-fields in the type name 2022-07-03 14:35:54 +00:00
rillig 28cc4da32f tests/lint: test bit shift with large integer types
build_bit_shift converts the right-hand operand to INT or UINT, even
though C11 6.5.7 doesn't say anything about narrowing conversions.

Traditional C says that the operators '<<' and '>>' perform the usual
arithmetic conversions.  This has been dropped in C90.

What lint actually does is something completely different.  In the
operators table in ops.def, the operators '<<' and '>>' are not marked
as performing the usual arithmetic conversions (column 'balance').  This
leaves all conversions to 'build_bit_shift', which converts the
right-hand side to INT or UINT.  There is no obvious reason for this
conversion, as the bounds checks need to be performed no matter whether
the type is INT or UINT128.
2022-07-02 09:48:18 +00:00
rillig 8d59a8c8e2 lint: add quotes around operator in message 138, remove message 240
Message 138 doesn't occur in practice, it was the last one that was
missing the quotes around the placeholder.

Message 240 was also missing the quotes, but it was not reachable. There
was also no apparent benefit in warning about 'assignment of different
structures' when the message about 'assignment type mismatch' serves the
same purpose.
2022-07-01 20:53:13 +00:00
rillig a01cec450c tests/lint: add tests for accessing incomplete types 2022-07-01 20:35:18 +00:00
rillig 87f7a17b45 lint: do not warn about pointer casts to array types
If the (recursive) element type of the array is compatible, that's good
enough.  Even after the previous commits, this warning is the one that
occurs most in a standard NetBSD build, and it is generally ignored.
For now, focus on reducing the number of false positives to an
acceptable level.
2022-06-24 21:22:11 +00:00
rillig 79312644ef tests/lint: demonstrate another warning about pointer casts 2022-06-24 21:02:10 +00:00
rillig b2f8c42322 lint: allow pointer cast between compatible structs
Lint already allowed pointer casts from 'struct counter' to 'struct
counter_impl'.  Now it also allows the other direction.
2022-06-24 20:44:53 +00:00
rillig 66b8d73a0e tests/lint: demonstrate warning for cast between compatible structs 2022-06-24 20:32:12 +00:00
rillig 0877aaac93 lint: do not warn about pointer cast between sockaddr variants 2022-06-24 20:16:21 +00:00
rillig 82c8f75d09 tests/lint: demonstrate pointer casts between sockaddr variants 2022-06-24 20:02:58 +00:00
rillig 28d4550ae5 lint: allow pointer cast from char to struct/union 2022-06-24 19:27:43 +00:00
rillig e3e24cb044 tests/lint: demonstrate dubious warnings for pointer casts
Casting a 'pointer to char' to a 'pointer to anything else' is already
allowed, except for 'pointer to struct/union'.  The cause for this
inconsistency is the wrong order of checks in
'should_warn_about_pointer_cast'.
2022-06-24 19:20:39 +00:00
wiz 3a171c57ac test: fix typo and improve wording 2022-06-22 21:11:41 +00:00
rillig 40a9b8fdca lint: add quotes around placeholders for the remaining messages
Reword some of the messages slightly, exchanging brevity for clarity.

Message 138 is kept as-is, as it is not yet covered by any tests.

Message 240 is kep as-is, as it is unreachable.
2022-06-22 19:23:17 +00:00
rillig 6d6723969c lint: add quotes and details to some more messages 2022-06-21 21:18:30 +00:00
christos 546ccfe0da sort; it is the same list as in h_ifunc_static.c; perhaps it should be
a HAVE_ something?
2022-06-21 16:24:37 +00:00
skrll f927c76aaf Support ifunc on aarch64. The tests pass at least. 2022-06-21 06:52:17 +00:00
skrll 810da4c4dd Wrap long #if defined(...) || ... and sort. NFCI. 2022-06-21 06:47:37 +00:00
rillig c9df6031e5 lint: add quotes around several placeholders in messages 2022-06-20 21:13:35 +00:00
rillig a89419496c lint: add quotes around placeholders in 4 messages 2022-06-19 12:14:33 +00:00
rillig 908cc94ba1 tests/lint: add quotes around placeholders in a few messages 2022-06-19 11:50:42 +00:00
rillig 6d39259094 tests/lint: move check-expect.lua to tests/lint1
It is only used for testing lint1, not for lint2 or xlint.
2022-06-17 20:31:56 +00:00
rillig 5716ac4baa tests/lint: remove .exp files, as they have become redundant
Now that each lint1 test lists all generated diagnostics as 'expect'
comments, the information from the .exp files is no longer needed.  The
only information that gets lost is the order of the diagnostics, which
is mostly relevant for paired messages like 'inconsistent definition' +
'previous definition was here'.
2022-06-17 20:23:58 +00:00
rillig a3ac6eeb54 tests/lint: treat a missing .exp file like an empty one
Previously, a missing .exp file skipped all the checks, that is, the
tests wouldn't fail if there were some unexpected new message.
2022-06-17 19:01:01 +00:00
rillig c83f7def18 tests/lint: make 'expect+-' comments stricter
Previously, the expectations from these comments were already satisfied
if the expectation occurred somewhere in the actual message from lint.
This meant that the prefix 'error:' or 'warning:' could be omitted from
the 'expect' comment.  These omissions were hard to see in a manual
review.  Now any omissions must be visually marked with '...'.

The test msg_342 now reports its messages properly as being in the file
msg_342.c, rather than msg_341.c.  This had been a copy-and-paste
mistake.
2022-06-17 18:54:53 +00:00
rillig f3175d9e07 tests/lint: rename local variables in check-expect.lua
Enough time has passed since I wrote that little program to make me
forget the naming scheme I had in mind back then.  Prefix the variable
names with the source of their data, 'c_' or 'exp_', to provide a bit of
orientation.

No functional change.
2022-06-17 16:10:10 +00:00
rillig e085e4c7b0 tests/lint: do not interpret 'expect:' comments, only 'expect+-n:'
Only the tests in msg_*.c had used the short form of the 'expect:'
comments.  The other tests used the more detailed variant 'expect+n:' or
'expect-n:'.
2022-06-17 07:06:50 +00:00
rillig ec42194bb1 tests/lint: add more details to tests from msg_300 until msg_343 2022-06-17 06:59:16 +00:00
rillig 36dcebf9e1 tests/lint: add more details to messages in msg_200 until msg_299
Add some tests that were previously empty.  Some other tests are still
empty.
2022-06-16 21:24:41 +00:00
rillig 65e5c21b37 tests/lint: make expectation lines in the tests more detailed
This commit migrates msg_100 until msg_199.
2022-06-16 16:58:35 +00:00
rillig aba9ec7202 tests/lint: replace 'expect' comments with 'expect+-' comments
The 'expect+-' comments provide more context, which makes it easier to
read the .c files on their own, without having to look up the actual
diagnostics in the .exp files.

Add tests for messages 105 and 106, which were about the obscure feature
of some traditional C compilers that allowed the expression 'x->member'
to access a struct member, even if 'x' had integer type.

The remaining tests will be migrated in a future commit.
2022-06-15 20:18:31 +00:00
rillig e04c94f40c lint: clean up an empty line and the documentation
No functional change.
2022-06-15 18:11:02 +00:00
skrll 95e95a0b5c Whitespace 2022-06-13 19:49:33 +00:00
martin c95185db45 Restore arm in the list of architectures supporting ifunc, accidently
lost in the OABI removal.
2022-06-13 12:55:06 +00:00
martin d9e5a99cb7 PR 56879: bump timeout for the wg_malformed test to 100 seconds,
as suggested by Tom Lane - the test takes ~32 seconds on my unloaded sh4
machine.
2022-06-13 07:59:15 +00:00
skrll ac615257a7 Put the sprinkled -static in the right place, i.e. fix up previous.
Thanks to rillig for spotting my mistake.
2022-06-12 15:08:38 +00:00
skrll 4bb9965c48 Sprinkle "-static" when using "-pg" as profiling only works with static and
the gcc specs are currently broken.

PR/56876: hppa: "cc -pg" fails with "undefined reference to `mprotect'"
2022-06-12 08:55:36 +00:00
rillig 27805af9ca tests/lint: demonstrate wrong syshdr check in strict bool mode 2022-06-11 14:17:33 +00:00
rillig abc4b681d4 lint: add quotes around placeholders for a few more messages 2022-06-11 12:23:59 +00:00
rillig 5d41e58a30 lint: add quotes around a few more placeholders in messages 2022-06-11 11:52:13 +00:00
rillig 12aa044455 tests/lint: add tests for messages that lack quotes 2022-06-11 11:20:40 +00:00
rillig 12366cf123 tests/lint: add test for 'previous definition' message 2022-06-11 10:46:38 +00:00
rillig b511067d09 tests/lint: fix test for loss of accuracy on ILP32 platforms
The test had been wrong since msg_132.c 1.14 from 2022-05-30.

Using 'unsigned long' in a test that was intended to behave the same on
ILP32 and LP64 was an accident.  Use 'unsigned long long' instead, which
is 64-bits wide on all platforms supported by lint.

Move the test about conversion from 'long' to 'int' to the
platform-specific test files.

Noticed by martin@ on powerpc.
2022-06-10 18:29:01 +00:00
martin ba6b10c46b PR 56875: Bump timeout for the bignumber test to 2h, as suggested
by Tom Lane to give slower architectures a chance to complete it.
2022-06-10 05:59:12 +00:00
skrll 1e0947f9a9 There are two hard problems in computer science cache invalidation, naming
and off-by-one errors.

Fix a naming and off-by-one bug... Thanks to Tom Lane for spotting my typo.
2022-06-09 17:39:21 +00:00
skrll a4e4e3ca93 PR/56865: hppa: t_ptrace_core_wait test doesn't know it must advance PC after breakpoint
Add __hppa__ to the list of architectures that need to advance to the instruction
after the breakpoint

Thanks to Tom Lane for the fix.
2022-06-07 05:39:16 +00:00
nia b7957d1677 build system: Revert all the recent additions of MK[...] knobs that
allow conditionally disabling the building of certain user space
programs in the 'base' set.

There is not enough consensus that this is the right way and a few
people had strong objections, see source-changes-d@.
2022-06-06 10:56:27 +00:00
skrll 390eeae316 Match explicit section names and not .{text,data}.* for example.
This test now passes on hppa.
2022-06-05 08:42:25 +00:00
riastradh d86c108395 tests/lib/libc: Test mmap(2) with bad hints. 2022-06-04 23:09:18 +00:00
pgoyette 36267b45c1 Fix syntax error 2022-06-04 20:32:49 +00:00
skrll db3cbfae74 Trailing whitespace 2022-06-02 07:31:35 +00:00
riastradh 2b5e567d9c libc: Reintroduce getentropy.
This was introduced two years ago when the getrandom/getentropy API
question was still open, and removed because the discussion was
ongoing.  Now getentropy is more widely adopted and soon to be in
POSIX.  So reintroduce the symbol into libc since we'll be keeping it
anyway.  Discussion of details of the semantics, as interpreted by
NetBSD, is ongoing, but the symbol needs to get in before the
netbsd-10 branch.  The draft POSIX text is
(https://www.opengroup.org/austin/docs/austin_1110.pdf):

    SYNOPSIS
        #include <unistd.h>

        int getentropy(void *buffer, size_t length);

    DESCRIPTION
        The getentropy() function shall write length bytes of data
        starting at the location pointed to by buffer. The output
        shall be unpredictable high quality random data, generated by
        a cryptographically secure pseudo-random number
        generator. The maximum permitted value for the length
        argument is given by the {GETENTROPY_MAX} symbolic constant
        defined in <limits.h>.

    RETURN VALUES
        Upon successful completion, getentropy() shall return 0;
        otherwise, -1 shall be retunred and errno set to indicate the
        error.

    ERRORS
        The getentropy() function shall fail if:

        [EINVAL]        The value of length is greater than
                        {GETENTROPY_MAX}.

        The getentropy() function may fail if:

        [ENOSYS]        The system does not provide the necessary
                        source of entropy.

    RATIONALE
        The getentropy() function is not a cancellation point.

Minor changes from the previous introduction of getentropy into libc:

- Return EINVAL, not EIO, on buflen > 256.
- Define GETENTROPY_MAX in limits.h.

The declaration of getentropy in unistd.h and definition of
GETENTROPY_MAX in limits.h are currently conditional on
_NETBSD_SOURCE.  When the next revision of POSIX is finalized, we can
expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this
can be done as a pullup without breaking existing compiled programs.
2022-05-31 13:42:58 +00:00
andvar bc2346d6b2 s/disbale/disable/ and s/enbale/enable/ in comments. also one more typo fix. 2022-05-31 11:22:33 +00:00
andvar ff23aff6ad fix various typos in comments, documentation and messages. 2022-05-31 08:43:13 +00:00
skrll 8279d5c63e Avoid plabels on hppa to make some tests not crash 2022-05-31 07:12:15 +00:00
skrll 3fed35fccd whitespace including space before delay slot instruction. 2022-05-31 07:10:50 +00:00
rillig 3851fec05f lint: fix null pointer dereference after syntax error
Found by afl, starting with the malformed input '/**/f=({;/**/};}' that
no longer crashes.  This input led to 'f=({L:;}', which is at least a
syntactically valid prefix of a translation unit, containing a GCC
statement expression with an unused label.  The error message for this
unused label assumed that it would always be inside a function
definition.

While here, document incomplete recovery after syntax errors, in
msg_249.c.
2022-05-31 00:35:18 +00:00
rillig d29c42aad7 lint: clean up comments
No binary change.
2022-05-30 23:27:45 +00:00
pgoyette 78744a3f2d More factoring of common code. NFCI 2022-05-30 14:28:31 +00:00
rillig f7a984ba6c tests/lint: explain how lint represents pointer addition 2022-05-30 08:51:08 +00:00
rillig ff18d53b3e lint: revert 'do not pre-multiply pointer expressions' from 2022-05-26
In tree.c 1.448, removing the pre-multiplication generated wrong
warnings about out-of-bounds array access.
2022-05-30 08:14:52 +00:00
rillig 354bb84e5e tests/lint: demonstrate wrong warning 'array subscript cannot be'
Since tree.c 1.448 from 2022-05-26.
2022-05-30 08:04:00 +00:00
rillig 844443fa07 lint: fix assertion failure in '(unsigned long)(ptr) >> 12'
Since tree.c 1.449 from 2022-05-26.
2022-05-30 07:19:28 +00:00
pgoyette 1e05f6937d Update test so all four combinations of update_{upper, lower} x
monitor_{upper, lower}} can be verified.  Currently update_upper
is expected to fail regardless of which file is being monitored.

PR kern/56713
2022-05-30 03:33:07 +00:00
rillig bad29c3ac0 lint: fix wrong errors about sizeof of a bit-field (since 2022-05-26) 2022-05-29 23:24:09 +00:00
rillig 38c4555700 tests/lint: demonstrate wrong errors 'size/alignment of bit-field'
Since tree.c 1.444 from 2022-05-26, which added range and bit checks for
integer expressions, not taking into account that querying for the size
of a bit-field type triggers an error message.
2022-05-29 23:09:43 +00:00
andvar 5fb5f516a8 fix various typos in comments and log messages. 2022-05-29 10:47:39 +00:00
nia cbb875961a mk: Add a MKLFS flag for excluding the log-structured filesystem userspace
tools from the build.
2022-05-27 07:28:20 +00:00
rillig 65a67c044c lint: do not warn about 'uint32_t = uint64_t >> 32'
If all possible values fit into the destination type, there is no
possibility of losing accuracy.

Enhances PR 36668.
2022-05-26 20:17:40 +00:00
rillig 77552b5db4 tests/lint: demonstrate wrong warnings about loss of accuracy 2022-05-26 19:55:57 +00:00
rillig b3f015e173 lint: do not warn about loss in accuracy if the actual value fits
The expression 'any & 0xff' can always be assigned to 'uint8_t' without
loss of any value bits.  In the same way, '(any & 0xff) << 8' can always
be assigned to 'uint16_t'.

Previously, lint warned about these cases.  Fix these wrong warnings by
tracking the possible values of integer expressions across a single
expression.

Fixes PR 36668, so that <sys/endian.h> does not need to be cluttered
with useless casts anymore.
2022-05-26 09:26:00 +00:00
rillig 975e35506f tests/lint: demonstrate wrong 'may lose accuracy' warning
Reported in PR 36668, fixed in sys/sys/endian.h 1.26 from 2007-07-20,
unfixed in sys/sys/endian.h 1.29 from 2014-03-18.
2022-05-26 07:03:03 +00:00
rillig 2776d394ae tests/dd: add more test cases for swapping bytes
To demonstrate that the fix from PR 56433 works as intended.
2022-05-24 21:42:37 +00:00
andvar cdc507f0d2 fix various typos in comment, documentation and log messages. 2022-05-24 20:50:17 +00:00
andvar 00831369bc s/estabilishing/establishing/ in copy pasted comment. 2022-05-24 20:08:38 +00:00
andvar 9f4a9600be fix various typos in comments, docs and log messages. 2022-05-24 06:27:59 +00:00
andvar 15fb77a86d s/changable/changeable/ in comments. 2022-05-24 06:18:34 +00:00
andvar 63264fc80c s/controll/control/ in comments. 2022-05-23 21:46:11 +00:00
rillig 33a964ec67 uncompress: if the source is broken, don't delete the target
Fixes the second half of PR bin/19722, reported by Giorgos Keramidas.
2022-05-22 21:39:44 +00:00
rillig 974afd5a88 uncompress: if the source doesn't exist, don't touch the target
Fixes part of PR bin/19722, reported by Giorgos Keramidas.
2022-05-22 21:16:50 +00:00
rillig 54cb77856b tests/compress: extend tests for compressing and uncompressing
For PR bin/19722.
2022-05-22 20:49:12 +00:00
rillig 345652c15e tests/compress: demonstrate truncation of target file
Reported by Giorgos Keramidas in PR#19722.
2022-05-22 17:55:08 +00:00
rillig 8b7380c153 lint: fix wrong warning about unhandled enum constants in switch 2022-05-22 13:58:59 +00:00
rillig cfd4dc4ff4 tests/lint: demonstrate wrong warning for switch on enum 2022-05-22 13:53:39 +00:00
andvar f42f89fd6f fix various small typos, mainly in comments. 2022-05-22 11:27:33 +00:00
riastradh 2043158f50 tests/crypto/opencrypto: Wait a bit for async results.
These may not be ready immediately.
2022-05-21 20:38:34 +00:00
riastradh 2efe87beed opencrypto/h_ioctl: Print error messages with warn.
Might help track down what's going on when this fails.
2022-05-21 13:31:29 +00:00
rillig 11e165cd50 tests/lint: sync comment with reality 2022-05-20 21:03:04 +00:00
rillig 597c015f3b lint: in strict bool mode, check function arguments more strictly
When a system header defined the constant FALSE = 0, that constant could
be passed as a bool argument.  On the other hand, the constant TRUE = 1
could not be passed in the same way.  Remove this inconsistency.
2022-05-19 17:24:14 +00:00
rillig 28a6c50b89 tests/lint: extend tests for type mismatch in strict bool mode
Seen in games/gomoku when calling curses functions.
2022-05-19 17:10:50 +00:00
rillig 0b6921c927 lint: do not warn about '==' on the right-hand side of ',' 2022-05-18 20:10:11 +00:00
rillig afeba29bb3 tests/lint: add more examples for warning in comma expression 2022-05-18 19:25:12 +00:00
andvar 47bd93c346 fix few typos in comments. 2022-05-17 05:05:20 +00:00
christos b47b148d83 PR/56831: Eric van Gyzen: race condition in tests/kernel/t_sysv.c
https://cgit.freebsd.org/src/commit/?id=20917cac7bcf216225a7b66f7b3a56f3764c5acc
2022-05-14 14:02:03 +00:00
rillig f95ee9f3cc lint: merge duplicate grammar rules for __alignof__ expr
This allows expressions like '__alignof__(ptr)->member', just as with
'sizeof'.

The upper rule in the grammar was preferred over the lower rule since it
shifted the T_LPAREN instead of reducing unary_expression.  Its
implementation invoked undefined behavior if the expression was NULL
since it didn't assign anything to $$.
2022-05-12 20:57:49 +00:00
rillig c1ebf8f4b6 tests/lint: add more tests for __alignof__ 2022-05-12 20:49:21 +00:00
rillig a59a352eb2 lint: add support for __alignof__ expr, a GCC extension
Seen in lib/libc/gmon/gmon.c:153.
2022-05-12 00:28:01 +00:00
rillig 6300d02a63 lint: fix support for __alignof__, add support for __alignof
Broken since lex.c 1.129 from yesterday.
2022-05-12 00:18:35 +00:00
rillig 91bf128de4 tests/lint: adjust tests to reflect missing support of __alignof__
The change in lex.c 1.129 attempted to add support for __alignof, in
addition to the existing support for __alignof__.  It failed by removing
support for __alignof__, while allowing the plain 'alignof' instead.
2022-05-12 00:09:44 +00:00
rin 1693f5dc09 Skip sigfpe_int also for sh3; integer division by zero is not trapped. 2022-05-07 13:14:16 +00:00
rin b73d7fb61c Bump timeout. 2022-05-07 05:14:09 +00:00
rin a2cd51fbde Bump timeout for slow machines. 2022-05-07 05:13:17 +00:00
blymn c395ca4a40 Add mutt_test to the test runs, this test tries to emulate a real
curses application to test the interaction of various curses calls.
2022-05-03 22:18:16 +00:00
blymn 2d82c97411 Update check files, changes due to bug fixes. 2022-05-03 22:01:13 +00:00
hannken dabbbd0d67 Lock vnode for VOP_LOOKUP(). 2022-05-03 07:36:20 +00:00
blymn 4690f5da75 Output changed due to bug fixes in curses. 2022-05-03 07:26:19 +00:00
christos 23ae5a70c4 explicitly set TZ=UTC so that we don't depend on the testing rig for it. 2022-05-02 19:57:50 +00:00
pgoyette ce6bd9a45b Rename variables to be more descriptive of their local meaning rather
than referring to external usage.
2022-05-01 03:18:41 +00:00
rillig 0d812cd9aa lint: document why C11 keywords are available in C99 mode as well 2022-04-30 20:24:57 +00:00
pgoyette ac6c59afb7 Don't put temporary files and directories into the atf_srcdir (that
might be read-only!).  Instead, put them in the test's working
directory what the atf framework will automatically clean up after
the test completes.
2022-04-30 17:09:44 +00:00
pgoyette 726aa68aee Add a new test for PR kern/56713 and set to expected_failure for now. 2022-04-29 22:17:49 +00:00
rillig 154b5ed632 lint: revert resolving grammar conflicts for labeled statements
Restore the grammar rule for labeled_statement as it was before cgram.y
1.400 from 2022-04-24.  This allows labels with attributes again.  Fix
the wrong interpretation in the tests; the attributes belong to the
label, not to the statement.

Today in the morning, when I thought that the change in cgram.y 1.400
were innocent, I accidentally ran lint only with the options '-Sw' but
forgot the option '-g' for GNU mode.  Without that option, the token
'__attribute__' is unknown, which unsurprisingly leads to lots of syntax
errors, and these didn't change with that commit.  The actual change was
only visible in GNU mode.
2022-04-28 21:38:38 +00:00
rillig 92985015bc tests/lint: add test for GCC unused statement
Seen in xsrc/LRGB.c:799.

Even though it looks like this lint error may have been introduced by
cgram.y 1.400 from 2022-04-24 (since LRGB.c has been unchanged for a
month), earlier versions of lint produce the same parse errors.
2022-04-28 07:10:39 +00:00
blymn 8c62b0094e Add test for wresize. 2022-04-26 22:48:36 +00:00
rillig e4ab72eabf lint: error out on declarations with implicit int type 2022-04-24 20:08:22 +00:00
rillig 8b1e52daed tests/lint: demonstrate missing check for missing type 2022-04-24 19:46:29 +00:00
rillig c73a3c445d lint: error out on missing type in declarations 2022-04-24 19:21:01 +00:00
rillig f918e87309 lint: warn about anonymous struct in struct, in plain C99 mode 2022-04-24 15:55:50 +00:00
rillig b60cb68fed tests/indent: migrate token tests to other tests
In indent.h 1.49 from 2021-10-25, the enumeration token_type was split
into lexer_symbol and parser_symbol to more clearly express that these
tokens fall into completely different classes of usage patterns.
2022-04-24 10:36:37 +00:00
rillig 47306038c7 tests/indent: change directive from '#' to '//'
Using a '//' instead of '#' turns the directives into well-formed C
code, resulting in fewer error markers in the editor.
2022-04-24 09:04:12 +00:00
rillig 36e939358a tests/indent: normalize amount of empty lines between test cases 2022-04-24 08:52:44 +00:00
rillig 15606711d7 tests/indent: migrate tests for parentheses, brackets, braces 2022-04-24 08:48:17 +00:00
rillig 19612de0ee tests/indent: add tests for unary and binary operators 2022-04-23 17:25:58 +00:00
christos 7b280d165b 1. add check for December in MM/DD/YYYY
2. unsetenv("TZ") since tests assume UTC (all relative tests and one date test
   fail otherwise)
2022-04-23 13:08:49 +00:00
rillig 173b4e090e tests/indent: migrate tests for the tokens '{' and '.' 2022-04-23 09:59:13 +00:00
rillig e1d123da59 tests/indent: migrate tests for unary and binary operators 2022-04-23 09:35:26 +00:00
rillig c91f4bf8dd tests/indent: migrate a few token tests to psym tests 2022-04-23 09:01:03 +00:00
isaki ab5d74dee7 tests: Add tests for AUDIO_GET[IO]OFFS ioctls.
- AUDIO_GETIOFFS_one_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_one_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_wrap_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_flush_{RDONLY,RDWR,WRONLY}
- AUDIO_GETOOFFS_set_{RDONLY,RDWR,WRONLY}
2022-04-23 07:47:42 +00:00
rillig c3f896e4dd indent: group global variables related to output control
No functional change.
2022-04-23 06:43:22 +00:00
rillig 53e024a772 indent: remove FreeBSD IDs
Most of the IDs were empty anyway.
2022-04-22 21:21:20 +00:00
rillig 02710ffe8e tests/lint: extend test for lossy integer conversion 2022-04-21 19:48:18 +00:00
blymn a4d66a9642 Actually add the bkgrndset test case so it runs plus fix a typo in
the bkgrndset test script.
2022-04-21 07:03:44 +00:00
rillig 65a6a5ed58 tests/lint: fix test for message 132 to be platform-independent
On i386, the test failed because the warning in line 101 was not
generated.  This was because size_t on i386 is unsigned int (see
arch/i386/targparam.h, SIZEOF_TSPEC). The result of the multiplication
had type unsigned int, and message 132 does not trigger for a conversion
from unsigned int to signed int because both types have the same size
(see check_integer_conversion, portable_size_in_bits).

Change the involved type from size_t (which the original code used) to
unsigned long long (which is uint64_t on all platforms supported by
lint), so that the warning is generated on all platforms in the same
way.
2022-04-20 22:50:56 +00:00
blymn 9a1e496d98 Add a test for the bkgrndset function 2022-04-20 07:43:05 +00:00
rillig 598b5fa387 lint: fix integer overflow on seeing -(uint64_t)INT64_MIN
Seen in external/cddl/osnet/dist/lib/libuutil/common/uu_strtoint.c,
which is protected by a NOLINT in ../Makefile.inc.
2022-04-19 23:16:14 +00:00
rillig 5242bed266 tests/lint: add test case for integer non-constant expression
Seen in sqlite3.c.
2022-04-19 22:40:13 +00:00
rillig 43941b9834 lint: only warn about unsigned constants in C90 migration mode
For C99 code, the difference between traditional C and C90 is not
relevant.

Seen in sqlite3.c line 30448.
2022-04-19 22:14:30 +00:00
rillig 86c56211f3 lint: do not warn about converting (1234567L & 0xFF) to unsigned char
Due to the '& 0xFF', there is no possible loss of accuracy.
2022-04-19 20:08:52 +00:00
rillig 889169b58b tests/lint: demonstrate wrong warnings for conversion from long to char 2022-04-19 19:56:29 +00:00
rillig 4ffab22634 lint: investigate why lint only warns about some constant conditions
Noticed in lex.c, in the macro kwdef, where lint complains about the
condition containing '||' but not about the conditions containing only
'>' or '=='.
2022-04-16 20:57:10 +00:00
rillig 82c1f72934 lint: fix instructions for adding a new test 2022-04-16 20:18:51 +00:00
rillig e22a01f54b tests/lint: fix tests on platforms other than x86_64
In msg_259_ilp32.c 1.6 from 2022-04-15, I removed the option -S from the
test in order to keep the message 259, but I forgot to fix the C99-style
comment as well.

In platform_int.c, the default lint option -S no longer generated
warning 259, so remove that option.
2022-04-16 18:41:21 +00:00
andvar f84252b461 fix various typos in comments and log messages. 2022-04-16 18:15:20 +00:00
rillig 4f5bc0bb10 lint: model C language levels in a future-compatible way
The options -t, -s and -S are confusing because they are used
inconsistently.  The option -S enables C99 features, but when using it
instead of -s, it also doesn't enable all checks required by C90 and
later.  Prepare fixing of these inconsistencies by replacing the flag
variables with language levels that can be extended in a
straight-forward way as new C standards arrive.

| option | allow_trad | allow_c90 | allow_c99 | allow_c11 |
|--------|------------|-----------|-----------|-----------|
| -t     | x          | -         | -         | -         |
| (none) | x          | x         | -         | -         |
| -s     | -          | x         | -         | -         |
| -S     | -          | x         | x         | -         |
| -Ac11  | -          | x         | x         | x         |

Each usage of the old flag variables will be inspected and migrated
individually, to clean up the subtle variations in the conditions and to
provide a simpler model.

When lint was created in 1995, its focus was migrating traditional C
code to C90 code.  Lint does not help in migrating from C90 to C99 or
from C99 to C11 since there are only few silent changes, and simply
because nobody took the time to implement these migration aids.  If
necessary, such migration modes could be added separately.

There is a small functional change: when the option -s is combined with
either -S or -Ac11, lint now only keeps the last of these options.
Previously, these options could be combined, leading to a mixture of
language levels, halfway between C90, C99 and C11.  Especially combining
traditional C with C11 doesn't make sense, but xlint currently allows
it.

The 3 tests that accidentally specified multiple language levels have
been adjusted to a single language level.
2022-04-16 13:25:27 +00:00
rillig f87e5fc974 lint: in C99 mode, allow trailing comma in enum declarations
Adjust the test to be run in C90 mode instead of traditional mode, since
traditional C didn't have enums.
2022-04-16 09:22:25 +00:00
rillig af7bf05501 tests/lint: refine test for varargs function 2022-04-16 09:20:01 +00:00
rillig 59915d96df lint: in C99 mode, do not warn about non-prototype conversions
Message 259 is "argument #%d is converted from '%s' to '%s' due to
prototype", and it is intended to warn about compatibility between
traditional C where functions had no prototypes and standard C where
functions have prototypes.

Running lint in C99 mode is further away from traditional C than running
lint in C90 mode, so that warning doesn't make sense for C99.  There are
still some inconsistencies in the 5 language version modes that lint
offers:

	-t		for traditional C
	(no option)	for migrating traditional C to C90
	-s		for C90 code
	-S		for C99 code
	-Ac11		for C11 code

By disabling warning 259 in C99 mode, a typical NetBSD build produces
14.500 fewer warnings than before, of about 100.000 total.

Message 259 overlaps with message 298 "conversion from '%s' to '%s' may
lose accuracy, arg #%d", and in some cases of potentially lossy
conversions, lint now produces none of these messages.  In some other
cases, these warnings were reported redundantly.  The cases where
message 298 makes sense will be added back later, as needed.
2022-04-15 21:50:07 +00:00
andvar de0a2812df s/sould/should/ and s/shoud/should/ 2022-04-12 21:05:36 +00:00
blymn 5cdd6bfe05 Update to account for default colour change in libcurses. 2022-04-12 07:04:19 +00:00
rillig 508315abb6 lint: fix assertion failure on duplicate qualifiers from __typeof__ 2022-04-10 12:14:10 +00:00
riastradh ea43e3d5a0 membar_ops(3): Simplify alarm handling in membar tests. 2022-04-10 11:36:32 +00:00
andvar 75d2abaeb1 fix various typos in comments and output/log messages. 2022-04-10 09:50:44 +00:00
riastradh 4f8ce3b31d Introduce membar_acquire/release. Deprecate membar_enter/exit.
The names membar_enter/exit were unclear, and the documentation of
membar_enter has disagreed with the implementations on sparc,
powerpc, and even x86(!) for the entire time it has been in NetBSD.

The terms `acquire' and `release' are ubiquitous in the literature
today, and have been adopted in the C and C++ standards to mean
load-before-load/store and load/store-before-store, respectively,
which are exactly the orderings required by acquiring and releasing a
mutex, as well as other useful applications like decrementing a
reference count and then freeing the underlying object if it went to
zero.

Originally I proposed changing one word in the documentation for
membar_enter to make it load-before-load/store instead of
store-before-load/store, i.e., to make it an acquire barrier.  I
proposed this on the grounds that

(a) all implementations guarantee load-before-load/store,
(b) some implementations fail to guarantee store-before-load/store,
and
(c) all uses in-tree assume load-before-load/store.

I verified parts (a) and (b) (except, for (a), powerpc didn't even
guarantee load-before-load/store -- isync isn't necessarily enough;
need lwsync in general -- but it _almost_ did, and it certainly didn't
guarantee store-before-load/store).

Part (c) might not be correct, however: under the mistaken assumption
that atomic-r/m/w then membar-w/rw is equivalent to atomic-r/m/w then
membar-r/rw, I only audited the cases of membar_enter that _aren't_
immediately after an atomic-r/m/w.  All of those cases assume
load-before-load/store.  But my assumption was wrong -- there are
cases of atomic-r/m/w then membar-w/rw that would be broken by
changing to atomic-r/m/w then membar-r/rw:

https://mail-index.netbsd.org/tech-kern/2022/03/29/msg028044.html

Furthermore, the name membar_enter has been adopted in other places
like OpenBSD where it actually does follow the documentation and
guarantee store-before-load/store, even if that order is not useful.
So the name membar_enter currently lives in a bad place where it
means either of two things -- r/rw or w/rw.

With this change, we deprecate membar_enter/exit, introduce
membar_acquire/release as better names for the useful pair (r/rw and
rw/w), and make sure the implementation of membar_enter guarantees
both what was documented _and_ what was implemented, making it an
alias for membar_sync.

While here, rework all of the membar_* definitions and aliases.  The
new logic follows a rule to make it easier to audit:

	membar_X is defined as an alias for membar_Y iff membar_X is
	guaranteed by membar_Y.

The `no stronger than' relation is (the transitive closure of):

- membar_consumer (r/r) is guaranteed by membar_acquire (r/rw)
- membar_producer (w/w) is guaranteed by membar_release (rw/w)
- membar_acquire (r/rw) is guaranteed by membar_sync (rw/rw)
- membar_release (rw/w) is guaranteed by membar_sync (rw/rw)

And, for the deprecated membars:

- membar_enter (whether r/rw, w/rw, or rw/rw) is guaranteed by
  membar_sync (rw/rw)
- membar_exit (rw/w) is guaranteed by membar_release (rw/w)

(membar_exit is identical to membar_release, but the name is
deprecated.)

Finally, while here, annotate some of the instructions with their
semantics.  For powerpc, leave an essay with citations on the
unfortunate but -- as far as I can tell -- necessary decision to use
lwsync, not isync, for membar_acquire and membar_consumer.

Also add membar(3) and atomic(3) man page links.
2022-04-09 23:32:51 +00:00
riastradh d49616184d membar_ops(3): Add some automatic tests.
These tests run two threads for five seconds each to try to trigger
races in the event of broken memory barriers.  They run only on
machines with at least two CPUs; on uniprocessor systems there's no
point -- the membars can correctly just be (instruction barrier)
no-ops.
2022-04-08 23:35:51 +00:00
rillig cbe246cc1b lint: fix undefined behavior on enum overflow (since 1995)
GCC had optimized the check away, due to the obvious integer overflow 'x
- 1 == INT_MAX'.  To prevent further bugs like this, compile with
-ftrapv.
2022-04-08 21:48:19 +00:00
rillig 321092b8ae lint: remove unused message 70, add some more tests 2022-04-08 21:29:29 +00:00
gson 49a41610de Add a regression test for PR kern/52239, "Changing protections of
already mmap'ed region can fail", based on the test program in the PR.
2022-04-06 10:02:55 +00:00
rillig e6d4541762 tests/lint: add tests for a few early messages 2022-04-05 23:09:19 +00:00
gson 7109944a00 In the mmap_err test case, mmap the address, not the address of the address.
Should fix PR kern/56780.
2022-04-05 15:59:22 +00:00
gson fdc1a24341 When the t_mmap:mmap_err test fails due to errno not having the expected
value of EINVAL, print the actual value.
2022-04-05 13:09:54 +00:00
andvar e82c4d9bb4 fix various typos, mainly in comments. 2022-04-04 19:33:44 +00:00
rillig d0d6249954 lint: fix crash after syntax error in array declaration 2022-04-03 10:05:22 +00:00
rillig dc0c5ce6ac tests/lint: make a few tests self-contained, add some others 2022-04-03 09:34:45 +00:00
rillig bbec5f69b6 lint: fix crash after syntax error in GCC statement expression
Since cgram.y 1.226 from 2021-05-03.
2022-04-03 00:39:32 +00:00
rillig 4d0a0200e3 lint: remove unreachable message 'compiler takes alignment of function' 2022-04-02 21:47:04 +00:00
rillig 953cc1178c lint: try harder to recover after syntax errors
lint: assertion "false" failed in declarator_name at decl.c:1596
    near msg_022.c:22
2022-04-02 20:12:45 +00:00
rillig 7c13327109 lint: add type details to message about 'sizeof(function)'
The code in add_function is severely broken, it mixes up the return type
of the function with the argument types.  For now, at least show the
guessed type in the diagnostic, to allow human readers quickly spot the
bug.

Extend the test cases in decl_direct_abstract.c to show that the
behavior differs unreasonably if the first parameter of the function is
equal to its return type.
2022-04-01 23:16:31 +00:00
rillig c902579041 lint: improve determination of abstract typename
Still not perfect, but at least a step in the right direction.  See
decl_direct_abstract.c for the missing edge cases.

See PR#22119.
2022-04-01 22:28:21 +00:00
rillig e5495b7249 lint: add details to message about illegal return type 2022-04-01 22:07:23 +00:00
rillig 96d2220fa5 tests/lint: fix comment about backslash-newline 2022-04-01 21:12:42 +00:00
rillig 614c592bd7 tests/lint2: add missing character in comment 2022-04-01 01:00:39 +00:00
yamaguchi 1c5c194e31 Add tests for MTU of lagg(4) 2022-03-31 03:26:33 +00:00
yamaguchi 9f8c3479a0 Added waiting for distributing state after attaching vlan
A lagg interface is reset on attaching vlan to enable
ETHERCAP_VLAN_MTU if the lagg I/F has it. Therefore,
it is necessary to wait for distributing.
2022-03-31 03:09:03 +00:00
christos 42c92eb5a7 remove zfs from the exception list; it now works like the other fs's. 2022-03-30 16:35:28 +00:00
christos 42f8118f95 update copyright. 2022-03-30 14:24:50 +00:00
christos 9d538b3985 skip userlevel filesystems that have their own rules (they depend on the
system setting of the sysctl on NetBSD) and zfs because it implements its
own rules for hardlinks to files (does its own permission checks).
2022-03-30 13:43:42 +00:00
christos f1d8378e1e ignore EOPNOTSUPP errors for fs's that don't support hard links. 2022-03-29 22:30:07 +00:00
christos 3c5909fb2a Add a test for hardlink sysctl limiting. 2022-03-28 20:51:04 +00:00
martin 37b043d21a Add sparc* to the list of architectures that need an explicit address
with PT_CONTINUE in this test.
2022-03-26 16:22:50 +00:00
riastradh 5901ceaa11 getrandom(2): Fix return value checks in automatic tests.
The syscall only guarantees up to 256 bytes in a single go -- if
interrupted, it might return short, but if the caller requested at
least 256 bytes it will definitely return 256 bytes.
2022-03-18 23:35:37 +00:00
rillig ca48e3c506 tests/lint: fix test about "non-portable character constant" on uchar
The warning is wrong, and it has been for a long time.  For now just fix
the test to match the actual output.  Seen on evbarm, which is one of
the platforms where a plain char is unsigned.

Noticed by Martin.
2022-03-14 20:25:26 +00:00
blymn f596e5447e Add the -F flag to the getopt string, it was there in the help and
in the arguments handling but getopt was not told about it.
2022-03-01 06:41:27 +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 6262bf18d3 tests/lint: test where exactly lint complains about concatenation
This only applies to traditional C and ensures that the behavior is
preserved when rearranging the C parser to evaluate string concatenation
from left to right.
2022-02-27 18:57:16 +00:00
rillig e970c8c0da tests/lint: demonstrate unexpected ordering of string concatenations
When lint concatenates the strings "1" "2" "3" "4", it first
concatenates "23", then "234" and finally "1234".
2022-02-27 18:51:21 +00:00
rillig a5dc812cd9 tests/lint: add tests for messages referring to C99 2022-02-27 12:00:27 +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 fa4dd0e745 lint: encode lifetime of allocated memory in the function names
No functional change.
2022-02-27 08:31:26 +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 292c0f5964 tests/lint: demonstrate assertion failure in GCC compound expression 2022-02-26 16:43:20 +00:00
gson cfc4b6e400 Mark randomly failing test cases as expected failures with a reference
to PR bin/56506.
2022-02-26 16:21:59 +00:00
rillig d6ea25cda3 tests/lint: sync tests for platform-dependent character comparisons 2022-02-26 11:13:01 +00:00
thorpej f92afe1eb4 Validate basic fcntl(2) behavior for eventfd and timerfd. 2022-02-20 15:21:14 +00:00
rillig 32b7a7ce5c tests/indent: test token '('
There are already some tests in token_lparen.c that need to be merged.
2022-02-13 12:04:37 +00:00
rillig dc5fc49783 tests/indent: demonstrate the poor handling of compound literals 2022-02-13 11:07:48 +00:00