Up to [cvs.NetBSD.org] / src / tests / usr.bin / xlint / lint1
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
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'.
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.
lint: add quotes around placeholder in message 214 function '%s' expects to return value
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.
tests/lint: demonstrate that _Generic must be a primary_expression
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.
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.
lint: fix result type of _Generic expressions
tests/lint: add test for _Generic with incompatible return types
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.