Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lint warnings



In article <20220624201621.EF2AFFB1B%cvs.NetBSD.org@localhost>,
Roland Illig <source-changes-d%NetBSD.org@localhost> wrote:
-=-=-=-=-=-

Module Name:    src
Committed By:   rillig
Date:       Fri Jun 24 20:16:21 UTC 2022

Modified Files:
     src/tests/usr.bin/xlint/lint1: msg_247.c
     src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: do not warn about pointer cast between sockaddr variants

Am 28.06.2022 um 15:28 schrieb Christos Zoulas:
I meant that I don't want to lose all those warnings in pedantic mode, but
I was not planning to add it. It seems useful to still have a way for lint
report the cases where they are usage-specific correct, but not
linguistically correct.

I agree on this use case. On the same scheme, I'd have a few more use
cases, and eventually this might lead to a query language for inspecting
C code. I'm thinking of queries like:

* implicit conversions from floating to integer types
* implicit conversions that change the signedness
* usual arithmetic conversions that change one of the operands
* casts from floating to integer types
* binary + with operand types 'integer' and 'pointer'
* no-op pointer casts
* pointer casts between types that are not strictly compatible
* pointer casts after function calls to 'malloc'
* conversion from array to pointer

Short of having this runtime query language, these questions might be
implemented as lint warnings that are disabled by default and could be
enabled by their message ID or a descriptive name. All current lint
warnings are enabled by default, it's just that some branches are
guarded by command line flags, especially in cases where several places
in lint's code generate the same warning.

And maybe there are already tools out there that support this kind of
queries, in a simpler language than C.

Roland


Home | Main Index | Thread Index | Old Index