| Age | Commit message (Collapse) | Author |
|
|
|
Pointer casts from an integer type to a floating-point type and vice
versa get a 'maybe troublesome' warning now. The previous assumption
that all types of the same bit-size are convertible may have been valid
from a technical point of view, but still such code should get more
attention.
The rules for struct and union types could be made more fine-grained
later, if the need arises. To suppress this warning, it's always
possible to cast to an intermediate 'void *'.
|
|
This reverts the change from tree.c 1.547 from 2023-07-03. Back then, I
didn't know that the actual value from a type's 'portable size in bits'
was not supposed to be used.
|
|
|
|
|
|
|
|
|
|
|
|
The existing warning was only issued for function declarations, not for
function definitions.
The interesting change in the tests is in msg_351.c. Many other tests
use non-static functions due to their syntactic brevity. In these
tests, the warning is disabled individually, to allow new functions to
be added without generating warning 351.
|
|
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.
|
|
For a non-static function definition that is not declared in a header,
lint doesn't currently warn. The previous test didn't notice this.
|
|
|
|
The deviations often happen when copying or renaming tests.
|
|
The test file names don't have a hyphen, so the identifiers shouldn't
have one either.
|
|
|
|
Since tree.c 1.546 from 2023-07-03, lint no longer warned about possible
loss of accuracy when converting from 'long' to 'int' on an ILP32
platform that uses 'unsigned long' for size_t, when run in portable mode
(-p), which is enabled by default in the NetBSD build.
The integer constraints avoid false-positive warnings by looking at the
actual values an expression can take. The function can_represent is
guarded by a condition that uses the portable_size_in_bits, but then
internally used the opposite size_in_bits, which led to inconsistent
results.
The warning looks confusing though, as on an ILP32 platform, 'int' and
'long' have the same size and representation, therefore there cannot be
an actual loss of accuracy. The warning may need to be reworded to
explicitly mention the portability mode, in which sizeof(int) is assumed
to be 3 instead of 4, to catch possible loss of accuracy on other
platforms.
|
|
This fixes the tests on 'unsigned char' platforms.
Thanks martin@ for the notification.
|
|
|
|
|
|
No binary change.
|
|
|
|
Required by xsrc/external/mit/MesaLib.old, brw_eu_validate.c, which
initializes a struct using empty braces: 'return (struct string){};'.
|
|
|
|
Seen in external/mit/xorg/lib/dri.old.
|
|
No functional change.
|
|
|
|
|
|
|
|
|
|
The previous prefix 'DK_' (declaration level kind) had a conflict with
the 'DK_' (designator kind) in init.c, so change the prefix to 'DLK_'.
The new name for dinfo_t is decl_level, which is more expressive.
No functional change.
|
|
The support for unnamed struct/union members that was added in decl.c
1.60 from 2015-10-13 was simple but wrong. It didn't cover initializers
of these structures and computed wrong sizes for structures containing
anonymous unions. At that time, the handling of initializers was broken
as well, it was fixed 6 years later in init.c 1.229 from 2021-12-22.
Real-life examples for code that lint couldn't handle are:
* external/bsd/jemalloc/dist/src/jemalloc.c
* external/mit/xorg/lib/dri.old/Makefile
|
|
No functional change.
|
|
|
|
When bit-fields in packed structs were added on 2009-10-02, lint assumed
that they would only use 'signed int' or 'unsigned int' as storage unit,
even though C99 also allows _Bool.
The cleanup commit for decl.c 1.225 from 2021-08-28 accidentally changed
the rounding mode for bit-field storage units from round-up to
round-down.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When running the tests via ATF, the filename was an absolute filename,
while the preprocessing line in the test file uses a relative filename.
These two didn't match.
|
|
Seen in external/bsd/jemalloc/dist/src/jemalloc.c, init_lock.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|