The NetBSD Project

CVS log for src/tests/usr.bin/xlint/Attic/check-expect.lua

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.24, Fri Jun 17 20:31:56 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.23: +1 -1 lines
FILE REMOVED

tests/lint: move check-expect.lua to tests/lint1

It is only used for testing lint1, not for lint2 or xlint.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jun 17 20:23:58 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.22: +7 -4 lines
Diff to previous 1.22 (colored)

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.22 / (download) - annotate - [select for diffs], Fri Jun 17 19:01:01 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.21: +2 -3 lines
Diff to previous 1.21 (colored)

tests/lint: treat a missing .exp file like an empty one

Previously, a missing .exp file skipped all the checks, that is, the
tests wouldn't fail if there were some unexpected new message.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jun 17 18:54:53 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.20: +62 -4 lines
Diff to previous 1.20 (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
mistake.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jun 17 16:10:10 2022 UTC (21 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.19: +39 -22 lines
Diff to previous 1.19 (colored)

tests/lint: rename local variables in check-expect.lua

Enough time has passed since I wrote that little program to make me
forget the naming scheme I had in mind back then.  Prefix the variable
names with the source of their data, 'c_' or 'exp_', to provide a bit of
orientation.

No functional change.

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jun 17 07:06:50 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.18: +2 -11 lines
Diff to previous 1.18 (colored)

tests/lint: do not interpret 'expect:' comments, only 'expect+-n:'

Only the tests in msg_*.c had used the short form of the 'expect:'
comments.  The other tests used the more detailed variant 'expect+n:' or
'expect-n:'.

Revision 1.18 / (download) - annotate - [select for diffs], Fri Jun 17 06:59:16 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

tests/lint: add more details to tests from msg_300 until msg_343

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jun 16 21:24:41 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

tests/lint: add more details to messages in msg_200 until msg_299

Add some tests that were previously empty.  Some other tests are still
empty.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Jun 16 16:58:36 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

tests/lint: make expectation lines in the tests more detailed

This commit migrates msg_100 until msg_199.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 15 20:18:31 2022 UTC (22 months ago) by rillig
Branch: MAIN
Changes since 1.14: +7 -2 lines
Diff to previous 1.14 (colored)

tests/lint: replace 'expect' comments with 'expect+-' comments

The 'expect+-' comments provide more context, which makes it easier to
read the .c files on their own, without having to look up the actual
diagnostics in the .exp files.

Add tests for messages 105 and 106, which were about the obscure feature
of some traditional C compilers that allowed the expression 'x->member'
to access a struct member, even if 'x' had integer type.

The remaining tests will be migrated in a future commit.

Revision 1.14 / (download) - annotate - [select for diffs], Tue Dec 7 07:09:12 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.13: +20 -20 lines
Diff to previous 1.13 (colored)

tests/lint: make error handling simpler

The previous form was better suited for integrated unit tests (as in
distrib/sets/fmt-list).  These small validation programs are easy enough
to be tested from the command line though.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Sep 5 19:16:37 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.12: +4 -3 lines
Diff to previous 1.12 (colored)

tests/lint: document placement of lint comments

Revision 1.12 / (download) - annotate - [select for diffs], Sat Aug 21 07:49:48 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

tests/lint: suggest better quickfix for expected lint diagnostics

The /* expect */ comments are usually so detailed that they are placed
in a line of their own, referring to the following line.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Aug 19 20:32:33 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

tests/lint: test folding of constant expressions

Since November 2001, there is a comment above the function 'fold' that
suggests there are a few bugs concerning overflow detection.  Add some
first 'proper regression tests' to prove these bugs.

Revision 1.10 / (download) - annotate - [select for diffs], Mon Jul 5 19:02:14 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

tests/lint: fix check-expect.lua for empty .exp file

An absent .exp file is equivalent to an empty .exp file.  In neither of
these cases must the corresponding .c file declare any expected
diagnostics.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jul 5 18:55:14 2021 UTC (2 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.8: +4 -5 lines
Diff to previous 1.8 (colored)

tests/lint: remove unused variables

Revision 1.8 / (download) - annotate - [select for diffs], Thu Apr 8 22:18:27 2021 UTC (3 years 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.7: +46 -37 lines
Diff to previous 1.7 (colored)

lint: in code from included files, print stack trace

Previously, the standard NetBSD build generated several lint warnings in
lhash.h from OpenSSL, without providing any hint as to which file
actually included that header.  In cases like these, lint now interprets
the line number information in the preprocessor output from GCC to
reconstruct the exact include path to the file in question.

The program check-expect.lua had to be rewritten almost completely since
it assumed that all diagnostics would come from the main file.  In all
existing tests, this was true, but these tests did not cover all cases
that occurred in practice.  Now it records the complete location of the
diagnostic instead of just the line number.

Revision 1.7 / (download) - annotate - [select for diffs], Mon Apr 5 01:35:34 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.6: +5 -9 lines
Diff to previous 1.6 (colored)

tests/lint: one comment per expected diagnostic

This makes it possible to check for diagnostics that contain commas.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Feb 28 01:20:54 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.5: +4 -2 lines
Diff to previous 1.5 (colored)

tests/lint: force 'expect' annotations

Revision 1.5 / (download) - annotate - [select for diffs], Sat Feb 27 17:16:48 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.4: +31 -28 lines
Diff to previous 1.4 (colored)

tests/lint: allow 'expect' comments to refer to other lines

This allows /* expect+1: ... */ to refer to the following line, as well
as /* expect-1: ... */ to refer to the previous line.  This avoids
horizontal scrolling to see the expectations, it also allows these
expectations comments to be more verbose, mentioning the whole
diagnostic in many cases.

The 'expect' comments don't need to be at the end of a line anymore
since that was rather surprising.  The one 'expect' comment that had not
been at the end of the line was in d_c99_bool_strict.c and was not
intended to be ignored.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Feb 21 09:07:58 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

lint: force each test to declare the expected diagnostics

By listing the expected diagnostics directly at the code that triggers
the diagnostics, it is easier to cross-check whether the diagnostics
make sense.

No functional change to lint itself.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Feb 20 22:18:32 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.2: +11 -3 lines
Diff to previous 1.2 (colored)

lint: ensure that '# line' directives in tests are correct

It's too easy to forget one of them when adding or removing some lines.
This would make it more difficult to locate the lines referenced in the
error messages.

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jan 16 15:02:11 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

lint: prepare to make strict bool mode even stricter

Currently, strict bool mode still allows integer constant expressions to
be converted implicitly to bool.  This is something that other languages
such as Go, Java, C#, Pascal don't allow.

By providing a custom implementation of <stdbool.h> that defines false
and true to custom bool constant identifiers, lint will cover these
cases as well.

To prepare for this, reword the rules and restructure the tests in
d_c99_bool_strict.c.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jan 12 20:42:01 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN

lint: add new check for strict bool mode

In strict bool mode, bool is considered incompatible with all other
scalar types, just as in Java, C#, Pascal.

The controlling expressions in if statements, while loops, for loops and
the '?:' operator must be of type bool.  The logical operators work on
bool instead of int, the bitwise operators accept both integer and bool.
The arithmetic operators don't accept bool.

Since <stdbool.h> implements bool using C preprocessor macros instead of
predefining the identifiers "true" and "false", the integer constants 0
and 1 may be used in all contexts that require a bool expression.
Except from these, no implicit conversion between bool and scalar types
is allowed.

See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.

The command line option -T has been chosen because all obvious choices
(-b or -B for bool, -s or -S for strict) are already in use.  The -T may
stand for "types are checked strictly".

The default behavior of lint doesn't change.  The strict bool check is
purely optional.

An example program for strict bool mode is usr.bin/make, which has been
using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in
most places for a long time now, even before the refactoring in 2020.

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 <webmaster@jp.NetBSD.org>