The NetBSD Project

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

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

Request diff between arbitrary revisions

Default branch: MAIN

Revision 1.14 / (download) - annotate - [select for diffs], Fri Jul 7 06:03:31 2023 UTC (7 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

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.

Revision 1.13 / (download) - annotate - [select for diffs], Tue Mar 28 14:44:34 2023 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.12: +3 -1 lines
Diff to previous 1.12 (colored)

lint: warn about extern declarations outside headers

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jun 22 19:23:18 2022 UTC (20 months, 1 week 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.11: +3 -3 lines
Diff to previous 1.11 (colored)

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.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jun 17 18:54:53 2022 UTC (20 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

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

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jan 15 14:22:03 2022 UTC (2 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.9: +5 -3 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Wed Dec 22 14:11:14 2021 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored)

tests/lint: fix space-tab indentation

Revision 1.8 / (download) - annotate - [select for diffs], Wed Dec 22 00:45:53 2021 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

lint: fix handling of initializations

The implementation from March 2021 added proper support for designators
but didn't model the brace levels correctly.  In particular, it could
not handle additional braces or omitted braces.  In such a case, lint
skipped the remaining initializers from the initialization.  Due to
this, type errors in the remaining initializers went unnoticed.  Another
effect was that arrays of unknown size were wrongly reported as having
size 0.

Both GCC and Clang recommend placing braces around each sub-type that is
initialized, such as a struct, union or array.  Postfix does not follow
these recommendations, therefore lint had to be disabled in
external/ibm-public/postfix/  This commit fixes the bugs
mentioned there.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Dec 21 22:21:11 2021 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.6: +5 -3 lines
Diff to previous 1.6 (colored)

lint: reword message 187 about too long string literal for initializer

The previous message was imprecise in that it didn't distinguish between
non-terminating and terminating null bytes.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Sep 10 20:02:51 2021 UTC (2 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.5: +14 -14 lines
Diff to previous 1.5 (colored)

lint: replace space followed by tab with simply tab

No functional change.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Aug 14 13:00:55 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.4: +9 -5 lines
Diff to previous 1.4 (colored)

lint: use standard quoting style for messages 124 and 184

Revision 1.4 / (download) - annotate - [select for diffs], Fri Apr 9 23:03:26 2021 UTC (2 years, 10 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.3: +1 -3 lines
Diff to previous 1.3 (colored)

lint: fix initialization with brace-enclosed string literal

C99 allows this form in 6.7.8p14 and p15.

The previous lint tests did not cover the case of an array at the top
level of the object to be initialized, they only covered the error cases
(d_c99_init.c, variables 'prefixed_message' and 'message_with_suffix').

Lint is now more generous than strictly required by C99, but since GCC
and Clang already cover the case of 'message_with_suffix', this is ok.

The test d_init_array_using_string.c was wrong before in rejecting the
initializer for 'extra_braces'.  I had tested that Clang generated a
warning for this, but I had not inspected its warning carefully enough.
Clang had not warned about the extra braces but only about a type
mismatch since I tested on a platform where wchar_t was 16 bit.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Mar 30 14:25:28 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.2: +5 -3 lines
Diff to previous 1.2 (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.2 / (download) - annotate - [select for diffs], Tue Mar 23 22:58:08 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

lint: fix wrong warning about initialization using string literal

Missing braces after 'if', since init.c 1.68 from 2021-02-20.

GCC 10 doesn't complain about this even with -Wmisleading-indentation
since at least one of the involved lines is a macro invocation (in this
case both lines).  GCC 11 will warn about this.

Clang warns about this, but the regular Clang build currently fails for
other reasons, so this problem didn't show up there either.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Mar 23 21:19:08 2021 UTC (2 years, 11 months ago) by rillig
Branch: MAIN

tests/lint: test initialization using string literals

The errors in line 74 and 75 of the test are wrong.  Everything is fine
there.  The bug lies in init_array_using_string, try to see if you can
spot it, neither GCC 9.3.0 nor Clang 8.0.1 could.

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 <>