The NetBSD Project

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

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.8 / (download) - annotate - [select for diffs], Sat Jan 14 11:15:07 2023 UTC (3 weeks, 1 day ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +49 -1 lines
Diff to previous 1.7 (colored)

tests/lint: add more tests for array/enum mismatch

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jan 8 15:22:33 2023 UTC (3 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.6: +1 -5 lines
Diff to previous 1.6 (colored)

lint: recognize enum constant named 'max' as a count of values

Seen in external/bsd/mdocml/dist/mdoc.h(50).

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jan 8 15:18:02 2023 UTC (3 weeks, 6 days ago) by rillig
Branch: MAIN
Changes since 1.5: +46 -5 lines
Diff to previous 1.5 (colored)

tests/lint: add more tests for enum/array mismatch

Revision 1.5 / (download) - annotate - [select for diffs], Sat Jun 11 11:52:13 2022 UTC (7 months, 3 weeks ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

lint: add quotes around a few more placeholders in messages

Revision 1.4 / (download) - annotate - [select for diffs], Mon Nov 1 18:11:26 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.3: +2 -3 lines
Diff to previous 1.3 (colored)

lint: do not warn about array size mismatch in array[(int)enum]

The cast to 'int' explicitly converts the type away from being an enum.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Nov 1 11:46:50 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.2: +49 -1 lines
Diff to previous 1.2 (colored)

lint: in the check for array[enum], allow enum constant NUM

When an enum type defines a constant NUM_VALUES, this constant is
usually not part of the enum values available to the application but
rather a handy place for defining the number of other enum values. Don't
warn about this case.

Seen in openpam_impl.h and several other places.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Oct 31 23:15:44 2021 UTC (15 months ago) by rillig
Branch: MAIN
Changes since 1.1: +12 -1 lines
Diff to previous 1.1 (colored)

lint: fix invalid memory access in array[enum] check

Lint checks whether in an expression 'array[enum]', the array size
matches the value of the maximum enum constant.

The previous tests for this check were missing the case where an enum
name was explicitly cast to an integer type and then used as an array
index. In this situation, the resulting type of the array index is a
plain 'int' without any information about its previous 'enum' history.

An entirely different case is when the 'enum' is implicitly converted to
an integer type, as in the test color_name_too_many. There, for the
final type of the array index, rn->tn_type->t_is_enum is true, which
means that rn->tn_type->t_enum is properly filled.

The bug was a simple typo, I had forgotten a tn_left indirection, which
is necessary to get the type before the implicit conversion.

Found and reported by Christos, triggered by src/lib/libperfuse/ops.c
1.89 line 1226 expression 'VTTOIF(vap->va_type)'.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Oct 30 22:04:42 2021 UTC (15 months ago) by rillig
Branch: MAIN

lint: warn if an enum name is used for mismatched array access

This helps to keep the enum definition and the straight-forward
implementation of a to_string or name function in sync.

The test for message 241 had to be adjusted because of exactly this bug.
That test defined a bit mask enum but accessed it like a value enum
type.

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>