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


Keyword substitution: kv
Default branch: MAIN


Revision 1.19: download - view: text, markup, annotated - select for diffs
Sun Aug 6 19:44:50 2023 UTC (15 months, 4 weeks ago) by rillig
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +4 -3 lines
lint: since C99, a non-void function must return a value

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Jul 9 11:18:55 2023 UTC (16 months, 3 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +4 -4 lines
lint: clean up wording in diagnostics

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

Revision 1.17: download - view: text, markup, annotated - select for diffs
Fri Jul 7 19:45:22 2023 UTC (16 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +3 -2 lines
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 - view: text, markup, annotated - select for diffs
Fri Jul 7 00:20:39 2023 UTC (16 months, 4 weeks ago) by rillig
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +3 -2 lines
tests/lint: merge duplicate tests for C11 _Atomic

Revision 1.15: download - view: text, markup, annotated - select for diffs
Tue Mar 28 14:44:34 2023 UTC (20 months, 1 week ago) by rillig
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +2 -2 lines
lint: warn about extern declarations outside headers

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

Revision 1.14: download - view: text, markup, annotated - select for diffs
Wed Jan 4 05:32:01 2023 UTC (23 months ago) by rillig
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +2 -2 lines
tests/lint: fix typo in comment

Revision 1.13: download - view: text, markup, annotated - select for diffs
Wed Jun 22 19:23:18 2022 UTC (2 years, 5 months ago) by rillig
Branches: MAIN
CVS tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +2 -2 lines
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 - view: text, markup, annotated - select for diffs
Fri Jun 17 18:54:53 2022 UTC (2 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +6 -6 lines
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 - view: text, markup, annotated - select for diffs
Sat Jan 15 14:22:03 2022 UTC (2 years, 10 months ago) by rillig
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +3 -2 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.10: download - view: text, markup, annotated - select for diffs
Sun Aug 1 21:12:31 2021 UTC (3 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +2 -2 lines
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 - view: text, markup, annotated - select for diffs
Sun Aug 1 13:09:38 2021 UTC (3 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +11 -1 lines
tests/lint: document why lint does not check _Generic selections

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sun Jul 11 20:37:21 2021 UTC (3 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +1 -3 lines
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 - view: text, markup, annotated - select for diffs
Sun Jul 11 20:34:05 2021 UTC (3 years, 4 months ago) by rillig
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +9 -1 lines
tests/lint: demonstrate that _Generic must be a primary_expression

Revision 1.6: download - view: text, markup, annotated - select for diffs
Mon Jun 28 07:55:05 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +14 -1 lines
lint: only accept assignment-expression in _Generic

That's what C11 says.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Jun 27 21:30:46 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +3 -3 lines
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 - view: text, markup, annotated - select for diffs
Sun Jun 27 21:16:40 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +17 -1 lines
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 - view: text, markup, annotated - select for diffs
Sun Jun 27 20:47:13 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +8 -6 lines
lint: fix result type of _Generic expressions

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sun Jun 27 19:59:23 2021 UTC (3 years, 5 months ago) by rillig
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +16 -3 lines
tests/lint: add test for _Generic with incompatible return types

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Jun 27 18:48:45 2021 UTC (3 years, 5 months ago) by rillig
Branches: 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.

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>