Home | History | Annotate | Download | only in lint1
History log of /src/tests/usr.bin/xlint/lint1/decl.c
RevisionDateAuthorComments
 1.36  14-Sep-2025  rillig lint: fix integer overflow in '<<' evaluation

Just in case that -ftrapv will someday cover '<<' as well, in addition
to the classic arithmetic operators.
 1.35  12-Apr-2025  rillig lint: s/illegal/invalid/g

Lint does not provide legal advice.
 1.34  05-Mar-2025  rillig tests/lint: demonstrate missing warning about non-prototype
 1.33  30-Nov-2024  rillig tests/lint: add a few more tests to increase code coverage
 1.32  30-Nov-2024  rillig lint: add back optimization for non-query mode

The main point of the optimization is to skip the expensive calls to
type_name when preparing the message details. This was not spelled out
explicitly in the comment.

While here, fix the stray 'previous declaration' message that occurred
whenever a function was first declared as 'static' and later defined
without 'static', see query 16.
 1.31  08-Jun-2024  rillig branches: 1.31.2;
tests/lint: reorganize tests

Tests for a single working language construct don't usually need a
separate file, they can be grouped together, like in expr.c or gcc.c.
 1.30  01-May-2024  rillig lint: make 'offsetof(t, array-member)' a constant expression

The macro 'offsetof(t, m)' already expanded to a constant expression for
scalar members but not for arrays. This was because the macro expanded
to '(size_t)(((t *)0)->m)', which lint internally represents as
'addr(indir(ptr(0) + offset(m)))', and build_address simplifies
'addr(indir(x))' to 'x' if the types match. The types only match for
scalar types though, but not for arrays.

When build_address happens, the type information is incomplete,
therefore 'offsetof(t, array)' has to be simplified at a later point.
 1.29  01-May-2024  rillig tests/lint: test large enum constants and offsetof with array members
 1.28  28-Jan-2024  rillig tests/lint: sort multiple diagnostics per line chronologically

For now, the chronologic order is not enforced but has to be established
manually, for example by removing all 'expect' comment lines and
regenerating them with 'accept.sh -u'.

While here, clean up a few instances that came up when regenerating the
'expect' comments, such as wrong indentation or needless deviation from
the 'expect+1' form.
 1.27  23-Jan-2024  rillig lint: rename symt_t to symbol_kind

It was confusing to have two kinds of "symbol type" (s_type and s_symt),
so rename all related identifiers to be more distinctive.

No functional change.
 1.26  01-Aug-2023  rillig tests/lint: test packed and in-parameter declarations
 1.25  31-Jul-2023  rillig tests/lint: test symbol lookup in unnamed bit-field member declaration
 1.24  31-Jul-2023  rillig lint: fix assertion failure after unnamed bit-field member

Since 2023-07-15.
 1.23  13-Jul-2023  rillig tests/lint: test duplicate type qualifiers in pointer types
 1.22  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.21  28-Mar-2023  rillig lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
 1.20  01-Oct-2022  rillig lint: add hyphen to adjective 'old-style'
 1.19  28-Aug-2022  rillig lint: rename dcs manipulation functions to be clearer

No functional change.
 1.18  22-Jun-2022  rillig lint: add quotes around placeholders for the remaining messages

Reword some of the messages slightly, exchanging brevity for clarity.

Message 138 is kept as-is, as it is not yet covered by any tests.

Message 240 is kep as-is, as it is unreachable.
 1.17  17-Jun-2022  rillig tests/lint: make 'expect+-' comments stricter

Previously, the expectations from these comments were already satisfied
if the expectation occurred somewhere in the actual message from lint.
This meant that the prefix 'error:' or 'warning:' could be omitted from
the 'expect' comment. These omissions were hard to see in a manual
review. Now any omissions must be visually marked with '...'.

The test msg_342 now reports its messages properly as being in the file
msg_342.c, rather than msg_341.c. This had been a copy-and-paste
mistake.
 1.16  11-Jun-2022  rillig lint: add quotes around a few more placeholders in messages
 1.15  24-Apr-2022  rillig lint: error out on declarations with implicit int type
 1.14  24-Apr-2022  rillig lint: error out on missing type in declarations
 1.13  03-Apr-2022  rillig lint: fix crash after syntax error in array declaration
 1.12  25-Jul-2021  rillig tests/lint: cover every code line in the grammar
 1.11  25-Jul-2021  rillig tests/lint: test parsing of type_name
 1.10  23-Jul-2021  rillig tests/lint: test lexer for the GCC extension __thread
 1.9  15-Jul-2021  rillig lint: extract dcs_merge_declaration_specifiers from end_type

No functional change.
 1.8  15-Jul-2021  rillig lint: fix internal error for sizeof(typeof)
 1.7  15-Jul-2021  rillig tests/lint: cover abstract_declaration, discover internal error
 1.6  15-Jul-2021  rillig tests/lint: cover more edge cases in the parser
 1.5  14-Jul-2021  rillig tests/lint: add several tests for edge cases in the grammar
 1.4  11-Jul-2021  rillig lint: fix bug when parsing unused variable (since 2021-07-10)

Partially revert to cgram.y 1.248 from 2021-06-29.

This fixes the parse error for variables whose declaration starts with
__attribute__((unused)). In the many refactorings of the last days this
bug has slipped in, and since there were several refactorings in that
area, there may be have been further bugs that are not caught by the
current test suite. Revert for now and maybe apply them later again
when there are more tests.

Things kept from the current version are:

The names of most of the rules, as they correspond more closely to C99
and do not affect the behavior in any way.

In type_direct_decl, the replacement of type_attribute_list with
type_attribute since that nonterminal is already part of a repetition
(saves 4 conflicts).

In block_item, the order of the rules corresponds to C99. This has no
influence on the generated parser, except for the rule numbers, which
are informative.

The merge of the duplicate code for struct_tag, enum_tag and
enum_constant, as they all contained exactly the same code.
 1.3  11-Jul-2021  rillig tests/lint: parse error for unused variable (since 2021-07-10)

Since cgram.y 1.294 from 2021-07-10.
 1.2  10-Jul-2021  rillig tests/lint: test error handling in enum-specifier
 1.1  10-Jul-2021  rillig tests/lint: test declarations
 1.31.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed