Commit Graph

4832 Commits

Author SHA1 Message Date
thorpej
799aab805f config_found_ia() -> config_found(). 2021-04-25 05:33:20 +00:00
rillig
cd38323370 tests/lint: test GCC compound expression without declaration 2021-04-23 20:13:29 +00:00
yamaguchi
7c3ad1a224 Added a test case for MTU of pppoe(4) 2021-04-23 03:41:55 +00:00
yamaguchi
8fd0ecaa70 Make IFF_DEBUG enabled if $DEBUG is true 2021-04-23 03:40:05 +00:00
yamaguchi
4bb5023316 functionalize rump.ifconfig and pppoectl for clearer test code 2021-04-23 03:38:19 +00:00
yamaguchi
2d87bd9bd5 Added test cases for "pppoectl passiveauthproto" 2021-04-23 03:07:19 +00:00
rillig
66445508cf tests/lint: add test for typeof after statement
Found by christos@.
2021-04-22 22:43:26 +00:00
christos
a32fdb6548 Put things back, emit.ln it was meant to be there. 2021-04-21 14:04:26 +00:00
christos
2730ab42e6 remove emit.ln; looks like an accident and breaks the build. 2021-04-21 13:41:42 +00:00
rillig
be94027e4e tests/lint: fix the hack for emit.ln to also work if MKUPDATE != "no" 2021-04-21 13:26:16 +00:00
rillig
97ccd8d967 tests/lint: fix inconsistent operator for emit.ln
The build failed with:

	nbmake[8]: "/.../src/share/mk/bsd.files.mk" line 47:
	    Inconsistent operator for /.../emit.ln
2021-04-20 23:30:35 +00:00
rillig
105b25615a tests/lint1: fix build error "must name an existing directory"
The build failed with this error message:

	x86_64--netbsd-install: the last argument (/.../emit.ln) must
	name an existing directory

The cause for this message was that ${DESTDIR}/.../emit.ln has
${DESTDIR}/.../emit.c as implicit target, which is kind of correct but
unintended in this case.  Because of this, the command 'install' was run
like this:

	install ${NETBSDSRCDIR}/.../emit.ln ${DESTDIR}/.../emit.c \
	    ${DESTDIR}/.../emit.ln
2021-04-20 21:20:24 +00:00
rillig
f1cc514d7d tests/lint: record all files from FILES in distrib/sets/lists/tests/mi 2021-04-18 23:05:26 +00:00
rillig
34039a4026 tests/lint: add emit.ln to the release files 2021-04-18 23:02:16 +00:00
rillig
3f5e7494f3 lint: test emitting of symbol information in the .ln files
Even though the new test is quite large, it didn't find any bugs in the
code.  The only thing I'm unsure about is why static functions are
exported as well, since they are supposed to be local to the translation
unit.
2021-04-18 20:02:56 +00:00
rillig
fb2cd55871 tests/lint: remove work-in-progress code
The only purpose of the additional initializers was to generate an error
message, to make the .exp file non-empty.  This is no longer needed.
2021-04-18 08:03:56 +00:00
rillig
73b70e7b0b lint: document wrong location information in diagnostics 2021-04-18 07:31:47 +00:00
rillig
0580bd7587 lint: fix assertion failure for temporary objects in initialization 2021-04-17 21:20:08 +00:00
rillig
d39373331c tests/lint: fix analysis from previous commit, add another example
This is not a GCC feature, it's required by C99 already.
2021-04-17 20:57:18 +00:00
rillig
80be8043c5 tests/lint: demonstrate assertion failure in initialization 2021-04-17 20:36:17 +00:00
rillig
c322b8c5b5 lint: do not warn about alignment when casting from incomplete struct
This removes a bunch of technically correct but practically useless
warnings from the regular NetBSD build.
2021-04-17 16:58:04 +00:00
rillig
814d2d428a tests/lint: add test for pointer cast from incomplete struct 2021-04-17 16:52:09 +00:00
rillig
3737a339ac tests/make: remove ATF descr
The description of the tests is not going to be added anytime soon, as
that would either create redundancy or additional run-time cost.
Parsing and evaluating unit-tests/Makefile is already O(n^2) with regard
to the number of tests, and there are quite a few tests.  Therefore don't
add any overhead for now.
2021-04-17 11:36:34 +00:00
rillig
11173f1b80 tests/make: indent consistently 2021-04-17 11:31:25 +00:00
rillig
eefa5d1cf5 tests/make: simplify selection of the files to be copied
No functional change.
2021-04-17 11:21:17 +00:00
rillig
63eed110a6 tests/lint: adjust test for C11 to the change in grammar and options 2021-04-14 22:06:38 +00:00
rillig
3874a90eb6 lint: add option to accept C11 features
The list of available letters for the command line options gets shorter
and shorter.  Most of the interesting letters are already used for some
warning categories.  Curiously, -A, -W and -E were all still available.

The option -A nicely matches the intention of the option, which is to
allow a certain set of language features.  To keep the option available
for further extensions, define -Ac11 as the currently only valid option
of that kind.  This allows straight-forward extension for C17 and future
language standards, as well as independent feature-sets.  The options -W
and -E may someday complement the -A option, using the allow/warn/error
categories.
2021-04-14 20:06:40 +00:00
rillig
67509c5839 lint: add support for C11-isms such as int[static 3] 2021-04-14 18:35:40 +00:00
rillig
6aa88d9625 lint: add test for newly added message about static array size 2021-04-14 18:27:11 +00:00
christos
f7e8f455fd add a test for a type attribute after a param function pointer 2021-04-13 22:21:19 +00:00
christos
8396636f1d Add an example of attribute fallthrough 2021-04-12 15:54:55 +00:00
mrg
7e5e03e2b7 new GCC_NO_* uses for warning issues. most of the users of the new
GCC_NO_RETURN_LOCAL_ADDR are bugs in GCC itself, not the code.
2021-04-12 06:08:30 +00:00
mrg
a2d1542565 add some new uses of existing GCC_NO_* variables for warning issues.
remove an no longer relevant for gcc7 workaround (works fine in both
gcc9 and gcc 10.)
2021-04-12 02:54:07 +00:00
mrg
bfab3a83f7 don't run the "offline" or "nointr" tests by default. they exercise
bugs that exist in the current code and leave the target machine in
a broken state, requiring ddb or hard reset.

setting ATF_USR_SBIN_CPUCTL_OFFLINE_ENABLE to any non-empty string
will enable these tests again.
2021-04-12 01:18:13 +00:00
rillig
8ffcb97a78 lint: fix initialization with brace-enclosed string literal
C99 allows this form in 6.7.8p14 and p15.

The previous lint tests did not cover the case of an array at the top
level of the object to be initialized, they only covered the error cases
(d_c99_init.c, variables 'prefixed_message' and 'message_with_suffix').

Lint is now more generous than strictly required by C99, but since GCC
and Clang already cover the case of 'message_with_suffix', this is ok.

The test d_init_array_using_string.c was wrong before in rejecting the
initializer for 'extra_braces'.  I had tested that Clang generated a
warning for this, but I had not inspected its warning carefully enough.
Clang had not warned about the extra braces but only about a type
mismatch since I tested on a platform where wchar_t was 16 bit.
2021-04-09 23:03:26 +00:00
rillig
d91573a6c8 tests/lint: demonstrate wrong warning when initializing a string 2021-04-09 22:08:14 +00:00
rillig
c1c59b2873 lint: fix wrong warning about uninitialized _Complex variable
Seen in divxc3.c.
2021-04-09 21:42:12 +00:00
rillig
80108d8526 tests/lint: demonstrate wrong lint warning about complex variables 2021-04-09 21:07:39 +00:00
rillig
18955dccde lint: quote placeholders in messages for unused variables 2021-04-09 20:12:00 +00:00
rillig
f9065e3b5b lint: do not warn about pointer conversion to or from incomplete type
This cuts down the warnings in a NetBSD release build by about 38,000.
2021-04-09 20:00:06 +00:00
rillig
9c458e1376 lint: for structs and unions, include incompleteness in the type name
This mainly helps to assess the situation where lint warns that a
pointer cast "may be troublesome", see msg_247.exp.
2021-04-09 19:37:39 +00:00
rillig
ca178aa822 tests/lint: document where the 38,000 lint warnings come from 2021-04-09 19:32:12 +00:00
rillig
1bed9f5334 tests/lint: test bit-shift amount equal to the type's width 2021-04-09 16:37:18 +00:00
rillig
ee726345e6 lint: in code from included files, print stack trace
Previously, the standard NetBSD build generated several lint warnings in
lhash.h from OpenSSL, without providing any hint as to which file
actually included that header.  In cases like these, lint now interprets
the line number information in the preprocessor output from GCC to
reconstruct the exact include path to the file in question.

The program check-expect.lua had to be rewritten almost completely since
it assumed that all diagnostics would come from the main file.  In all
existing tests, this was true, but these tests did not cover all cases
that occurred in practice.  Now it records the complete location of the
diagnostic instead of just the line number.
2021-04-08 22:18:26 +00:00
rillig
d1643c2c38 tests/lint: refine comment and function name in test for pointer cast
In a typical NetBSD build, there are about 100,000 lint warnings.  About
50,000 of them are warning 247.  About 38,000 of these are from OpenSSL
and may be fixed by now.
2021-04-08 19:31:51 +00:00
rillig
50e0ad27e4 lint: don't warn about cast between pointers to compatible structs 2021-04-08 19:20:54 +00:00
rillig
3f8fd7950d tests/lint: add test for struct pointer cast 2021-04-08 19:08:17 +00:00
rillig
b4b7f28d0e lint: for shift in C99 mode, do not warn about difference to pre-C90
C99 is too far away from traditional C to make this warning useful.
There are 3 different situations in which this warning is generated:

For '1 << (unsigned char)1', the result type is 'unsigned int' in
traditional C.  The result type is unsigned because at least 1 of the
operators is unsigned, and it is 'unsigned int' because the usual
arithmetic promotions are applied.

For '1 >> (long)1', as well as for '1 << (long)1', the result type is
'long' in traditional C since the usual arithmetic promotions are
applied.

Omitting this warning in C99 mode reduces the amount of lint warnings in
a typical NetBSD release build by approximately 6800 of 107000 total.
2021-04-06 21:59:58 +00:00
rillig
6e93208e35 lint: test what happens for 'int << double'
I just wanted to see whether typeok_shift would be reached in this case,
to ensure that is_uinteger applies as expected.  It does.
2021-04-06 21:44:12 +00:00
rillig
4148550ebb lint: add details to warning about too large shift amount
The previous message 'shift greater than size of object' was too short
to give reasonable hints, especially when the expressions involve
typedefs or macros.
2021-04-06 21:32:57 +00:00