History log of /src/tests/usr.bin/xlint/lint1/queries.c |
Revision | | Date | Author | Comments |
1.36 |
| 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.35 |
| 12-Apr-2025 |
rillig | lint: s/illegal/invalid/g
Lint does not provide legal advice.
|
1.34 |
| 20-Feb-2025 |
rillig | lint: mention the assignment operator in 'illegal combination'
In source lines that contain both a 'return' statement as well as a function-like macro, such as the C11 atomics, seeing the word 'init' in the diagnostic helps to see that the type conflict is not in the 'return' statement but instead in some initializer.
Seen in userspace-rcu/wfcqueue.h:147.
|
1.33 |
| 30-Nov-2024 |
rillig | tests/lint: add a few more tests to increase code coverage
|
1.32 |
| 29-Nov-2024 |
rillig | lint: in a query, treat 00 as an octal integer constant
Even though the value of the constant is 0 and thus the same as in the decimal interpretation, it is syntactically an octal number and contains a redundant leading digit, which may be interesting to detect.
|
1.31 |
| 28-Nov-2024 |
rillig | lint: add queries for typedefs to struct/union and their pointers
As suggested in share/misc/style since 1.75 from August 2023.
These are queries instead of warnings as the number of false positives or historical practice is too high; these queries are only intended for detecting these typedefs on newly added types.
|
1.30 |
| 23-Nov-2024 |
rillig | lint: add details to messages about discarding qualifiers
The related message 153 is left as-is, as it is used in two places, and the second place is not only about discarded qualifiers.
|
1.29 |
| 27-Apr-2024 |
rillig | branches: 1.29.2; lint: converting a null pointer to another pointer type is not narrowing
|
1.28 |
| 27-Apr-2024 |
rillig | lint: add query for conversion from void pointer to other pointer
|
1.27 |
| 30-Mar-2024 |
rillig | lint: in the query about implicit conversions, ignore casts
|
1.26 |
| 30-Mar-2024 |
rillig | lint: add query for implicit integer-to-floating conversion
|
1.25 |
| 30-Mar-2024 |
rillig | lint: do not convert array subscripts from size_t to ptrdiff_t
The C standards do not specify a fixed type for an array subscript, it just has to be an integer type. Previously, query 4 fired for the ubiquitous expression 'ptr[sz]' when sz had type 'size_t'.
The test platform_ilp32_long is unaffected by this change, as the integer constant 0x80000000 has type 'unsigned int', while size_t is 'unsigned long' on those platforms, and even though the types 'unsigned int' and 'unsigned long' have the same value space, there's still a conversion, at least for now.
|
1.24 |
| 02-Feb-2024 |
rillig | tests/lint: test lexing of characters and strings
|
1.23 |
| 28-Jan-2024 |
rillig | tests/lint: enforce diagnostics to be listed in chronologic order
While here, fix the tests on uchar platforms.
|
1.22 |
| 20-Jan-2024 |
rillig | lint: add query for const automatic variables
|
1.21 |
| 07-Jan-2024 |
rillig | lint: allow querying for invisible characters in literals and constants
|
1.20 |
| 10-Dec-2023 |
rillig | lint: allow querying for 'static' followed by non-'static' declaration
|
1.19 |
| 03-Jul-2023 |
rillig | tests/lint: move platform-specific query tests to separate files
This fixes the tests on 'unsigned char' platforms.
Thanks martin@ for the notification.
|
1.18 |
| 30-Jun-2023 |
rillig | lint: add query for assigning an integer 0 to a pointer
|
1.17 |
| 24-Jun-2023 |
rillig | lint: add query for comparing 'char' with plain integers
|
1.16 |
| 24-Jun-2023 |
rillig | lint: add query for redundant 'extern' in function declaration
|
1.15 |
| 22-Jun-2023 |
rillig | lint: add query for comma operator
|
1.14 |
| 03-Jun-2023 |
rillig | lint: add query for static variables in functions
This query allows finding hidden global variables, as an easier-to-read alternative to 'objdump -t'.
|
1.13 |
| 13-May-2023 |
rillig | lint: add query for chained assignments
|
1.12 |
| 15-Apr-2023 |
rillig | lint: add query for parenthesized return value
|
1.11 |
| 31-Mar-2023 |
rillig | lint: allow querying for octal integer constants
|
1.10 |
| 28-Mar-2023 |
rillig | lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
|
1.9 |
| 15-Jan-2023 |
rillig | tests/lint: document conversion from void pointer
|
1.8 |
| 08-Jan-2023 |
rillig | lint: do not report usual arithmetic conversions for constants
|
1.7 |
| 08-Jan-2023 |
rillig | lint/tests: test query for usual arithmetic conversions
|
1.6 |
| 24-Sep-2022 |
rillig | 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] */
|
1.5 |
| 10-Sep-2022 |
rillig | 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.
|
1.4 |
| 28-Aug-2022 |
rillig | lint: rename dcs manipulation functions to be clearer
No functional change.
|
1.3 |
| 08-Jul-2022 |
rillig | 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.
|
1.2 |
| 08-Jul-2022 |
rillig | lint: fix query for redundant cast before assignment
Previously, 'i = (int)dbl' was marked as redundant, even though it performs a value conversion.
|
1.1 |
| 05-Jul-2022 |
rillig | 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@
|
1.29.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|