The NetBSD Project

CVS log for src/tests/usr.bin/xlint/lint1/Attic/d_c99_init.exp

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

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.31
Fri Jun 17 20:23:58 2022 UTC (2 years, 7 months ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
FILE REMOVED
Changes since revision 1.30: +0 -0 lines
tests/lint: remove .exp files, as they have become redundant

Now that each lint1 test lists all generated diagnostics as 'expect'
comments, the information from the .exp files is no longer needed.  The
only information that gets lost is the order of the diagnostics, which
is mostly relevant for paired messages like 'inconsistent definition' +
'previous definition was here'.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Sat Jan 15 14:22:03 2022 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +28 -28 lines
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.29: download - view: text, markup, annotated - select for diffs
Tue Dec 28 22:54:08 2021 UTC (3 years ago) by rillig
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +24 -24 lines
tests/lint: extend documentation for omitted braces in initializer

Revision 1.28: download - view: text, markup, annotated - select for diffs
Wed Dec 22 00:45:53 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +9 -8 lines
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/Makefile.inc.  This commit fixes the bugs
mentioned there.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Fri Dec 17 15:52:30 2021 UTC (3 years, 1 month ago) by rillig
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +28 -25 lines
tests/lint: add more examples for initialization, from C99

Revision 1.26: download - view: text, markup, annotated - select for diffs
Fri Apr 9 23:03:26 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
CVS tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +0 -2 lines
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.25: download - view: text, markup, annotated - select for diffs
Fri Apr 9 22:08:14 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +1 -0 lines
tests/lint: demonstrate wrong warning when initializing a string

Revision 1.24: download - view: text, markup, annotated - select for diffs
Thu Apr 1 14:20:30 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +0 -1 lines
lint: do not error out of a struct is initialized without braces

This allows to process lib/libc/gen/sysctl.c 1.38 from 2021-03-30, as
well as its precedessor 1.37, which had a workaround just for lint.

While unusual, C99 allows these.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Tue Mar 30 19:45:04 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +3 -0 lines
tests/lint: test 'scalar type cannot use designator'

Revision 1.22: download - view: text, markup, annotated - select for diffs
Tue Mar 30 16:09:30 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +21 -21 lines
tests/lint: remove unnecessary empty lines from test

In a separate commit to not cause an unnecessarily large diff in the
previous commit.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Tue Mar 30 16:07:07 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +3 -0 lines
lint: add error about out-of-bounds array subscripts

This check is not strictly necessary since any C99 compiler must
diagnose them as well, it is rather meant for demonstrating how to do
the check in lint, and for symmetry with the 'unknown member' error
message.  These provide insight into how the data structures in init.c
are meant to be accessed.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Tue Mar 30 15:18:19 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +6 -6 lines
lint: add type information for message about unknown member name

Revision 1.19: download - view: text, markup, annotated - select for diffs
Tue Mar 30 15:10:46 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +1 -1 lines
lint: reword message for very unlikely .member in array initialization

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Mar 30 15:05:05 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +13 -13 lines
tests/lint: remove outdated comments

Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Mar 30 14:25:28 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +12 -1 lines
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
commit.

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.16: download - view: text, markup, annotated - select for diffs
Mon Mar 29 22:36:31 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -0 lines
tests/lint: test unknown member name in struct

I had not expected to trigger another assertion, I just wanted to make
sure my latest ongoing refactoring will not break this case.  Apparently
there is no need to worry about that.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Mon Mar 29 22:07:00 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +1 -0 lines
tests/lint: ensure initialization does not modify shared type

In my not yet published rewrite of lint's init.c, I forgot to copy the
array type. Guard against this bug, which would have been hard to find.

Given that in C, the declaration 'int a[], b[]' creates two different
type objects anyway, it's not easy to come up with a test case that
actually triggers this possible bug.  I'm not sure whether this test
indeed catches this bug.  If not, I'll add another test.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sun Mar 28 18:48:32 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +6 -4 lines
tests/lint: add tests for initialization

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun Mar 28 14:01:50 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +0 -2 lines
lint: remove wrong warning about wrong initializer type

The following code is valid:

	int valid = {{{ 3 }}};

C90 3.5.7 and C99 6.7.8 both say that the "initializer for a scalar
shall be a single expression, optionally enclosed in braces".  They
don't put any upper bound on the amount of braces, not even in the
"Translation limits" section.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Mar 27 23:13:48 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +1 -0 lines
tests/lint: test initializing a struct ending with unnamed bit-field

Revision 1.11: download - view: text, markup, annotated - select for diffs
Tue Mar 23 23:12:21 2021 UTC (3 years, 9 months ago) by rillig
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +3 -3 lines
tests/lint: fix outdated comments

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sun Mar 21 20:44:59 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +6 -6 lines
lint: prefix error messages with 'error:'

This makes it easier to find these errors in the build logs.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sat Mar 20 08:54:27 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +1 -0 lines
lint: fix assertion failure after error in designation

In d_c99_init.c, the initialization of array_with_designator failed.
The designator '.member' from that initialization was not cleaned up
before starting the next initialization.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Fri Mar 19 01:02:52 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +1 -0 lines
lint: replace assertion in initialization with proper error message

Revision 1.7: download - view: text, markup, annotated - select for diffs
Thu Mar 18 21:26:56 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +1 -1 lines
lint: reword message about type mismatch in initialization

Using parentheses for quotes is unusual, furthermore the previous
message didn't follow proper grammar rules, sacrificing clarity for
brevity.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu Mar 18 20:20:55 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1 -0 lines
tests/lint: add more examples for initialization

Revision 1.5: download - view: text, markup, annotated - select for diffs
Mon Feb 22 15:09:50 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +1 -1 lines
lint: change spelling of initialisation to initialization

That's the wording from the ISO C99 standard.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Feb 21 13:10:57 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +1 -1 lines
lint: add test for initializing a character array using a string

The previous attempt took another code path than expected.  The
initialization of static_duration actually calls initstack_string.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun Feb 21 12:49:05 2021 UTC (3 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -2 lines
lint: add more tests for C99 initialization

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Feb 21 09:19:53 2021 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +1 -0 lines
lint: add another test case for initializing an object

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Feb 21 08:05:51 2021 UTC (3 years, 11 months ago) by rillig
Branches: MAIN
lint: add another test for C99 initializers

Diff request

This form allows you to request diffs 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.

Log view options

CVSweb <webmaster@jp.NetBSD.org>