The NetBSD Project

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

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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.19 / (download) - annotate - [select for diffs], Sun Aug 6 19:44:50 2023 UTC (6 months, 2 weeks ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.18: +4 -3 lines
Diff to previous 1.18 (colored)

lint: since C99, a non-void function must return a value

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jul 9 11:18:55 2023 UTC (7 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)

lint: clean up wording in diagnostics

Use the term 'parameter' as defined in C99 3.15.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jul 7 19:45:22 2023 UTC (7 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.16: +3 -2 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Fri Jul 7 00:20:39 2023 UTC (7 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.15: +3 -2 lines
Diff to previous 1.15 (colored)

tests/lint: merge duplicate tests for C11 _Atomic

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

lint: warn about extern declarations outside headers

https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jan 4 05:32:01 2023 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

tests/lint: fix typo in comment

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jun 22 19:23:18 2022 UTC (20 months ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Fri Jun 17 18:54:53 2022 UTC (20 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.11: +6 -6 lines
Diff to previous 1.11 (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.11 / (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.10: +3 -2 lines
Diff to previous 1.10 (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.10 / (download) - annotate - [select for diffs], Sun Aug 1 21:12:31 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

tests/lint: fix test c11_generic_expression on ILP32

These platforms don't provide __uint128_t, at least not in lint.

The exact data type does not matter in this test, it just has to be
different from 'int'.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Aug 1 13:09:38 2021 UTC (2 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.8: +11 -1 lines
Diff to previous 1.8 (colored)

tests/lint: document why lint does not check _Generic selections

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

lint: make _Generic a primary-expression

C11 says so, and unless the _Generic expression was wrapped in
parentheses, it was not possible before to use it as a function call
expression.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jul 11 20:34:05 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.6: +9 -1 lines
Diff to previous 1.6 (colored)

tests/lint: demonstrate that _Generic must be a primary_expression

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jun 28 07:55:05 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.5: +14 -1 lines
Diff to previous 1.5 (colored)

lint: only accept assignment-expression in _Generic

That's what C11 says.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jun 27 21:30:46 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

lint: fix parsing of _Generic selection expressions

Previously, lint accepted comma-expressions where only
assignment-expressions are allowed.

This change does not make a difference in practice though since lint is
usually only run on source code that properly compiles.  Nevertheless,
rather be precise and accurate since the grammar might some day be
reused on less reliable input.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 27 21:16:40 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.3: +17 -1 lines
Diff to previous 1.3 (colored)

lint: fix type comparison in _Generic selection expressions

In the newly added test comma_expression, there were two distinct type
objects for the tspec DOUBLE.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jun 27 20:47:13 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.2: +8 -6 lines
Diff to previous 1.2 (colored)

lint: fix result type of _Generic expressions

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 27 19:59:23 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.1: +16 -3 lines
Diff to previous 1.1 (colored)

tests/lint: add test for _Generic with incompatible return types

Revision 1.1 / (download) - annotate - [select for diffs], Sun Jun 27 18:48:45 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN

lint: fix option -Ac11, add test for _Generic

Previously, selecting the option -Ac11 allowed features from C11 but at
the same time prohibited 'long long', which was added in C99.  This was
caused by the option -s, which is interpreted as "allow features from
C90, but no later".

The test for _Generic, which has been added in C11, demonstrates that
the current implementation is broken.  Lint currently thinks that the
return type of a _Generic selection is the type of the expression, but
it really is the type of the selected expression.  In the current tests,
this is always 'const char *', but C11 does not require that the types
of a generic selection are compatible.

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>