The NetBSD Project

CVS log for src/tests/usr.bin/xlint/lint1/d_init_pop_member.c

[BACK] Up to [] / src / tests / usr.bin / xlint / lint1

Request diff between arbitrary revisions

Default branch: MAIN

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jul 7 19:45:22 2023 UTC (7 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

lint: warn about function definitions without header declaration

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.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jan 15 14:22:03 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.8: +3 -2 lines
Diff to previous 1.8 (colored)

tests/lint: expect complete messages in feature tests

Previously, the tests contained many comments like /* expect: 123 */,
which were useless to a casual reader since nobody is expected to learn
lint's message IDs by heart.  Replace these with the complete
diagnostics, to show what lint is complaining about.

The tests named msg_*.c have been left unmodified since they mention the
full message text in their header comment.

No functional change.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jun 20 18:11:21 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

tests/lint: document disappearance of bug in pop_member

Revision 1.7 / (download) - annotate - [select for diffs], Tue Mar 30 14:25:28 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

lint: rewrite handling of initializations, fixing several bugs

The previous implementation had a wrong model of how initialization
happens in C99, its assertions failed in all kind of edge cases and it
was not possible to fix the remaining bugs one at a time without running
into even more obscure assertion failures.

The debug logging was detailed but did not help to clarify the
situation.  After about 20 failed attempts at fixing the small details I
decided to start all over and rewrite the initialization code from
scratch.  I left the low-level parts of handling designators, the code
that is independent of brace_level and the high-level parts of how the
parser calls into this module.  Everything else is completely new.

The concept of a brace level stays since that is how C99 describes
initialization.  The previous code could not handle multi-level
designations (see d_init_pop_member.c).  There are no more assertion
failures in the initialization code.

Some TODO comments have been left in the tests to keep the line numbers
the same in this commit.  These will be cleaned up in a follow-up

The new implementation does not handle initialization with "missing"
braces.  This is an edge case that both GCC and Clang warn about, so it
is not widely used.  If necessary, it may be added later.

The new implementation does not use any global variables in the vast
majority of the functions, to make all dependencies and possible
modifications obvious.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Mar 19 17:40:37 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

tests/lint: add comma to struct initialization

This places the error marker one line up, where it is expected.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Feb 20 16:55:32 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

lint: add machine-readable expectations to test for initializer

Revision 1.4 / (download) - annotate - [select for diffs], Sat Feb 20 16:51:18 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.3: +5 -5 lines
Diff to previous 1.3 (colored)

lint: fix typo in test for pop_member

The leader of a city should rather be a mayor than a major.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jan 31 14:39:31 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

lint: add common header for all tests

For those tests that didn't use GCC-style line markers such as "# 2",
the line numbers of the diagnostics stay the same.  This is purely
conincidental.  Before, the 3 lines came from lint's built-in
definitions (see 'builtins' in main1.c), and line number counting
continued as if nothing had happened, making the first line of the
actual file line 4.  These 3 built-in lines are now replaced with 3
lines of file header.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Jan 1 19:11:20 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.1: +5 -5 lines
Diff to previous 1.1 (colored)

lint: fix wrong warning about bitfield in C99 structure initialization

The variable namemem is supposed to be a circular list, which is
"documented" implicitly in push_member.

The implementation was buggy though.  In pop_member, the circular list
was destroyed though.  Given the list (capital, major, favorite_color,
green), removing capital made major point to itself in the forward
direction, even though it should not have been modified at all.

In the test, I had been too optimistic to quickly understand the code
around variable initialization.  I was wrong though, so I had to adjust
the comments there to reality.

Revision 1.1 / (download) - annotate - [select for diffs], Fri Jan 1 16:50:47 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN

lint: demonstrate bug in handling of nested C9X struct initializers

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

CVSweb <>