Home | History | Annotate | Download | only in lint1
History log of /src/tests/usr.bin/xlint/lint1/msg_247.c
RevisionDateAuthorComments
 1.35  12-Apr-2025  rillig lint: s/illegal/invalid/g

Lint does not provide legal advice.
 1.34  28-Sep-2024  rillig lint: reword warning about cast between unrelated pointer types

The phrase "may be troublesome" was too unspecific to be useful.
 1.33  07-Aug-2023  rillig tests/lint: show that portable mode depends on PTRDIFF_TSPEC

Since 2023.07.08.12.45.43, lint warns in lib/libkvm on i386.
 1.32  14-Jul-2023  rillig lint: clean up comments, add a test for the '?:' operator
 1.31  07-Jul-2023  rillig lint: only skip 'unused' warnings after errors, not other warnings

Previously, in -w mode, any warning suppressed further 'unused'
warnings, even though there was no need to do that. This can be seen in
the test gcc_attribute_var.c, where only the last unused variable from a
function was marked as unused, the others slipped through.

Fixed by counting the errors and the warnings separately and only
combining them if actually desired.
 1.30  05-Jul-2023  rillig tests/lint: add platform-specific tests for troublesome pointer casts
 1.29  22-Apr-2023  rillig lint: don't warn about cast between union and one of its member types

Seen in src/sbin/newfs_udf/udf_core.c for context.anchors.
 1.28  22-Apr-2023  rillig tests/lint: add test for conversions to and from a union type

Additionally, fix the line numbers in another test.
 1.27  28-Mar-2023  rillig lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
 1.26  24-Jun-2022  rillig 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.
 1.25  24-Jun-2022  rillig tests/lint: demonstrate another warning about pointer casts
 1.24  24-Jun-2022  rillig 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.
 1.23  24-Jun-2022  rillig tests/lint: demonstrate warning for cast between compatible structs
 1.22  24-Jun-2022  rillig lint: do not warn about pointer cast between sockaddr variants
 1.21  24-Jun-2022  rillig tests/lint: demonstrate pointer casts between sockaddr variants
 1.20  24-Jun-2022  rillig lint: allow pointer cast from char to struct/union
 1.19  24-Jun-2022  rillig 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'.
 1.18  16-Jun-2022  rillig 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.
 1.17  11-Jun-2022  rillig lint: add quotes around a few more placeholders in messages
 1.16  15-Jul-2021  rillig lint: allow pointer casts from 'char *' and 'unsigned char *'

For the sake of traditional code that did not yet migrate to using 'void
*' for arbitrary pointers.

In the standard NetBSD build, this reduces the number of lint warnings
by around 7000, of 57000 total.
 1.15  15-Jul-2021  rillig tests/lint: demonstrate questionable warnings for pointer casts
 1.14  10-Jul-2021  rillig lint: rename clrtyp/deftyp to begin_type/end_type

The abbreviations clr/def did not make it obvious that these two
functions or grammar rules form pairs.

No functional change.
 1.13  09-Apr-2021  rillig 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.
 1.12  09-Apr-2021  rillig tests/lint: document where the 38,000 lint warnings come from
 1.11  08-Apr-2021  rillig 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.
 1.10  08-Apr-2021  rillig lint: don't warn about cast between pointers to compatible structs
 1.9  08-Apr-2021  rillig tests/lint: add test for struct pointer cast
 1.8  30-Mar-2021  rillig tests/lint: remove outdated comments
 1.7  26-Mar-2021  rillig lint: allow pointer cast to 'char *' and 'unsigned char *'

This reduces the number of warnings in the regular NetBSD build by 5560.
 1.6  26-Mar-2021  rillig tests/lint: add tests for warning about cast to character types
 1.5  14-Mar-2021  rillig tests/lint: document how lint discards the typedef name in 247
 1.4  14-Mar-2021  rillig tests/lint: add test for message 247 for pointer to unnamed struct
 1.3  28-Feb-2021  rillig tests/lint: keep messages in test files in sync with actual messages

Each of the tests named msg_*.c repeats the template of the message, to
make the test somewhat self-contained when viewed in isolation.

This creates a redundancy, and keeping track of this manually is next to
impossible. I tried it and failed in 9 cases, even though it has just
been 2 months since I myself created the initial files and I knew all
the time that this redundancy exists.

Be fool-proof for the future by checking this automatically.
 1.2  21-Feb-2021  rillig lint: force each test to declare the expected diagnostics

By listing the expected diagnostics directly at the code that triggers
the diagnostics, it is easier to cross-check whether the diagnostics
make sense.

No functional change to lint itself.
 1.1  02-Jan-2021  rillig 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.

RSS XML Feed