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.
This commit is contained in:
rillig 2023-07-07 19:45:22 +00:00
parent e4c8179fca
commit e6298b924c
160 changed files with 459 additions and 207 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: c11_atomic.c,v 1.4 2023/07/07 00:20:39 rillig Exp $ */
/* $NetBSD: c11_atomic.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "c11_atomic.c"
/*
@ -11,7 +11,7 @@
* msg_350.c
*/
/* lint1-extra-flags: -Ac11 */
/* lint1-extra-flags: -Ac11 -X 351 */
/* C11 6.7.3 "Type qualifiers" */
typedef _Atomic int atomic_int;

View File

@ -1,6 +1,8 @@
/* $NetBSD: c11_generic_expression.c,v 1.16 2023/07/07 00:20:39 rillig Exp $ */
/* $NetBSD: c11_generic_expression.c,v 1.17 2023/07/07 19:45:22 rillig Exp $ */
# 3 "c11_generic_expression.c"
/* lint1-extra-flags: -X 351 */
/*
* C99 added support for type-generic macros, but these were limited to the
* header <tgmath.h>. C11 made this feature generally available.
@ -101,7 +103,6 @@ primary_expression(void)
* which is then silently ignored by init_expr. This situation is already
* covered by the compilers, so there is no need for lint to double-check it.
*/
/* expect+1: warning: missing 'extern' header declaration for 'x' [351] */
const char *x = _Generic(
1ULL + 1.0f,
int: 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: c99_bool_strict_suppressed.c,v 1.5 2022/06/19 12:14:34 rillig Exp $ */
/* $NetBSD: c99_bool_strict_suppressed.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "c99_bool_strict_suppressed.c"
/*
@ -18,7 +18,7 @@
* tree.c 1.305 from 2021-07-04.
*/
/* lint1-extra-flags: -T -X 107,330,331,332,333 */
/* lint1-extra-flags: -T -X 107,330,331,332,333 -X 351 */
/* ARGSUSED */
void

View File

@ -1,8 +1,10 @@
/* $NetBSD: d_alignof.c,v 1.11 2023/06/30 16:39:17 rillig Exp $ */
/* $NetBSD: d_alignof.c,v 1.12 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_alignof.c"
/* https://gcc.gnu.org/onlinedocs/gcc/Alignment.html */
/* lint1-extra-flags: -X 351 */
unsigned long
leading_and_trailing_alignof_type(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_c99_compound_literal_comma.c,v 1.3 2021/03/20 11:24:49 rillig Exp $ */
/* $NetBSD: d_c99_compound_literal_comma.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_c99_compound_literal_comma.c"
/*-
@ -8,6 +8,8 @@
* C99 6.5.2.5 "Compound literals" for the semantics.
*/
/* lint1-extra-flags: -X 351 */
struct point {
int x;
int y;

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_c99_decls_after_stmt.c,v 1.5 2023/01/22 17:17:25 rillig Exp $ */
/* $NetBSD: d_c99_decls_after_stmt.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_c99_decls_after_stmt.c"
/*
@ -8,6 +8,8 @@
* https://gnats.netbsd.org/45417
*/
/* lint1-extra-flags: -X 351 */
void
two_groups_of_decl_plus_stmt(void)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: d_c99_union_cast.c,v 1.7 2021/08/03 20:57:06 rillig Exp $ */
/* $NetBSD: d_c99_union_cast.c,v 1.8 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_c99_union_cast.c"
/* C99 does not define union cast, it is a GCC extension. */
/* lint1-flags: -Sw */
/* lint1-flags: -Sw -X 351 */
struct bar {
int a;

View File

@ -1,6 +1,8 @@
/* $NetBSD: d_cast_fun_array_param.c,v 1.3 2021/01/31 14:57:28 rillig Exp $ */
/* $NetBSD: d_cast_fun_array_param.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_cast_fun_array_param.c"
/* lint1-extra-flags: -X 351 */
static void
f(void *b[4])
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: d_compound_literals1.c,v 1.4 2022/04/24 20:08:23 rillig Exp $ */
/* $NetBSD: d_compound_literals1.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_compound_literals1.c"
/* compound literals */
/* lint1-extra-flags: -X 351 */
struct p {
short a, b, c, d;
};

View File

@ -1,8 +1,10 @@
/* $NetBSD: d_ellipsis_in_switch.c,v 1.4 2021/03/27 13:59:18 rillig Exp $ */
/* $NetBSD: d_ellipsis_in_switch.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_ellipsis_in_switch.c"
/* Using a range in a case label is a GCC extension. */
/* lint1-extra-flags: -X 351 */
int
x(void)
{

View File

@ -5,6 +5,8 @@
* truthiness, such as in the condition of an if statement.
*/
/* lint1-extra-flags: -X 351 */
struct s {
int member;
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_gcc_compound_statements2.c,v 1.5 2022/02/26 20:36:11 rillig Exp $ */
/* $NetBSD: d_gcc_compound_statements2.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_gcc_compound_statements2.c"
/*
@ -7,6 +7,8 @@
* https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
*/
/* lint1-extra-flags: -X 351 */
struct cpu_info {
int bar;
};

View File

@ -1,8 +1,10 @@
/* $NetBSD: d_gcc_func.c,v 1.3 2021/01/31 14:57:28 rillig Exp $ */
/* $NetBSD: d_gcc_func.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_gcc_func.c"
/* gcc __FUNCTION__ */
/* lint1-extra-flags: -X 351 */
void
foo(const char *p)
{

View File

@ -1,7 +1,10 @@
/* $NetBSD: d_gcc_variable_array_init.c,v 1.3 2021/01/31 14:57:28 rillig Exp $ */
/* $NetBSD: d_gcc_variable_array_init.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_gcc_variable_array_init.c"
/* gcc: variable array initializer */
/* lint1-extra-flags: -X 351 */
void
foo(int i)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_init_pop_member.c,v 1.9 2022/01/15 14:22:03 rillig Exp $ */
/* $NetBSD: d_init_pop_member.c,v 1.10 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_init_pop_member.c"
/*
@ -8,6 +8,8 @@
* named initializer.
*/
/* lint1-extra-flags: -X 351 */
struct rgb {
unsigned red;
unsigned green;

View File

@ -1,8 +1,10 @@
/* $NetBSD: d_long_double_int.c,v 1.5 2022/01/15 14:22:03 rillig Exp $ */
/* $NetBSD: d_long_double_int.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_long_double_int.c"
/* PR bin/39639: writing "long double" gave "long int" */
/* lint1-extra-flags: -X 351 */
int
fail(long double *a, long int *b)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_pr_22119.c,v 1.4 2022/04/01 22:28:21 rillig Exp $ */
/* $NetBSD: d_pr_22119.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_pr_22119.c"
/*
@ -8,6 +8,8 @@
* cast is NULL.
*/
/* lint1-extra-flags: -X 351 */
void
func1(void)
{

View File

@ -1,6 +1,8 @@
/* $NetBSD: d_return_type.c,v 1.5 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: d_return_type.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "d_return_type.c"
/* lint1-extra-flags: -X 351 */
enum A {
A
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: expr_cast.c,v 1.3 2021/08/03 18:44:33 rillig Exp $ */
/* $NetBSD: expr_cast.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "expr_cast.c"
/*
@ -12,7 +12,7 @@
* c-typeck.c, function build_c_cast, RECORD_OR_UNION_TYPE_P.
*/
/* lint1-flags: -Sw */
/* lint1-flags: -Sw -X 351 */
struct S {
int member;

View File

@ -1,10 +1,12 @@
/* $NetBSD: gcc_attribute_aligned.c,v 1.5 2022/08/27 23:24:37 rillig Exp $ */
/* $NetBSD: gcc_attribute_aligned.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "gcc_attribute_aligned.c"
/*
* Test size computations on aligned and packed structs.
*/
/* lint1-extra-flags: -X 351 */
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_builtin_alloca.c,v 1.3 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: gcc_builtin_alloca.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "gcc_builtin_alloca.c"
/*
@ -8,6 +8,8 @@
* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
*/
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_builtin_overflow.c,v 1.2 2021/09/03 22:48:49 rillig Exp $ */
/* $NetBSD: gcc_builtin_overflow.c,v 1.3 2023/07/07 19:45:22 rillig Exp $ */
# 3 "gcc_builtin_overflow.c"
/*
@ -8,7 +8,7 @@
* https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
*/
/* lint1-extra-flags: -T */
/* lint1-extra-flags: -T -X 351 */
void
is_overflow(void)

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_cast_union.c,v 1.3 2021/08/03 21:18:24 rillig Exp $ */
/* $NetBSD: gcc_cast_union.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "gcc_cast_union.c"
/*
@ -11,7 +11,7 @@
* https://gcc.gnu.org/onlinedocs/gcc/Cast-to-Union.html
*/
/* lint1-extra-flags: -e */
/* lint1-extra-flags: -e -X 351 */
union anything {
_Bool m_bool;

View File

@ -1,10 +1,12 @@
/* $NetBSD: gcc_stmt_asm.c,v 1.4 2022/06/17 18:54:53 rillig Exp $ */
/* $NetBSD: gcc_stmt_asm.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "gcc_stmt_asm.c"
/*
* Tests for the GCC 'asm' statement.
*/
/* lint1-extra-flags: -X 351 */
void
function(void)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_typeof_after_statement.c,v 1.5 2023/02/05 10:57:48 rillig Exp $ */
/* $NetBSD: gcc_typeof_after_statement.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "gcc_typeof_after_statement.c"
/*
@ -6,6 +6,8 @@
* there was a statement before it.
*/
/* lint1-extra-flags: -X 351 */
void *
example(void **ptr)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_braces.c,v 1.7 2023/07/01 06:09:24 rillig Exp $ */
/* $NetBSD: init_braces.c,v 1.8 2023/07/07 19:45:22 rillig Exp $ */
# 3 "init_braces.c"
/*
@ -9,6 +9,8 @@
* C11 6.7.9
*/
/* lint1-extra-flags: -X 351 */
void
init_int(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_003.c,v 1.5 2022/06/15 20:18:31 rillig Exp $ */
/* $NetBSD: msg_003.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_003.c"
// Test for message: '%s' declared in argument declaration list [3]
/* lint1-extra-flags: -X 351 */
/*ARGSUSED*/
void
example(declare_struct, declare_union, declare_enum)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_011.c,v 1.6 2023/07/07 06:03:31 rillig Exp $ */
/* $NetBSD: msg_011.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_011.c"
// Test for message: bit-field initializer out of range [11]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,9 +1,11 @@
/* $NetBSD: msg_012.c,v 1.4 2022/04/01 23:16:32 rillig Exp $ */
/* $NetBSD: msg_012.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_012.c"
// Test for message: compiler takes size of function [12]
/* This message is not used. */
/* lint1-extra-flags: -X 351 */
unsigned long
example(void)
{

View File

@ -1,10 +1,12 @@
/* $NetBSD: msg_021.c,v 1.4 2022/06/20 21:13:36 rillig Exp $ */
/* $NetBSD: msg_021.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_021.c"
// Test for message: redeclaration of formal parameter '%s' [21]
/* See also message 237, which has the same text. */
/* lint1-extra-flags: -X 351 */
/*ARGSUSED*/
void
/* expect+1: error: redeclaration of formal parameter 'parameter' [21] */

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_023.c,v 1.4 2021/07/11 19:30:56 rillig Exp $ */
/* $NetBSD: msg_023.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_023.c"
// Test for message: undefined label '%s' [23]
/* lint1-extra-flags: -X 351 */
void
test(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_028.c,v 1.4 2022/06/19 11:50:42 rillig Exp $ */
/* $NetBSD: msg_028.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_028.c"
// Test for message: redefinition of '%s' [28]
/* lint1-extra-flags: -X 351 */
int
defined(int arg)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_030.c,v 1.6 2022/10/01 09:42:40 rillig Exp $ */
/* $NetBSD: msg_030.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_030.c"
/* Test for message: redeclaration of '%s'; ANSI C requires static [30] */
/* lint1-flags: -sw */
/* lint1-flags: -sw -X 351 */
/* expect+1: error: old-style declaration; add 'int' [1] */
static a;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_032.c,v 1.6 2022/10/01 09:42:40 rillig Exp $ */
/* $NetBSD: msg_032.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_032.c"
// Test for message: type of argument '%s' defaults to 'int' [32]
/* lint1-extra-flags: -X 351 */
/* expect+5: error: old-style declaration; add 'int' [1] */
add(a, b, c)
/* expect+3: warning: type of argument 'a' defaults to 'int' [32] */

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_043.c,v 1.4 2022/06/20 21:13:36 rillig Exp $ */
/* $NetBSD: msg_043.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_043.c"
/* Test for message: redefinition of '%s' hides earlier one [43] */
/* lint1-extra-flags: -h */
/* lint1-extra-flags: -h -X 351 */
struct s {
int member;

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_050.c,v 1.5 2022/06/20 21:13:36 rillig Exp $ */
/* $NetBSD: msg_050.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_050.c"
/* Test for message: argument '%s' has function type, should be pointer [50] */
/* lint1-flags: -Stw */
/* lint1-flags: -tw */
typedef void (function)();

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_052.c,v 1.4 2022/06/20 21:13:36 rillig Exp $ */
/* $NetBSD: msg_052.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_052.c"
// Test for message: cannot initialize parameter '%s' [52]
/* lint1-extra-flags: -X 351 */
int
definition(i)
/* expect+1: error: cannot initialize parameter 'i' [52] */

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_053.c,v 1.6 2022/10/01 09:42:40 rillig Exp $ */
/* $NetBSD: msg_053.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_053.c"
// Test for message: declared argument '%s' is missing [53]
/* lint1-extra-flags: -X 351 */
/* expect+2: error: old-style declaration; add 'int' [1] */
oldstyle(argument)
int argument;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_057.c,v 1.6 2022/06/20 21:13:36 rillig Exp $ */
/* $NetBSD: msg_057.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_057.c"
// Test for message: enumeration constant '%s' hides parameter [57]
/* lint1-extra-flags: -X 351 */
long
/* expect+3: warning: argument 'red' unused in function 'rgb' [231] */
/* expect+2: warning: argument 'green' unused in function 'rgb' [231] */

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_059.c,v 1.4 2022/06/20 21:13:36 rillig Exp $ */
/* $NetBSD: msg_059.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_059.c"
// Test for message: formal parameter #%d lacks name [59]
/* lint1-extra-flags: -X 351 */
/* expect+4: error: formal parameter #2 lacks name [59] */
/* expect+3: error: formal parameter #3 lacks name [59] */
int

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_062.c,v 1.6 2022/10/01 09:42:40 rillig Exp $ */
/* $NetBSD: msg_062.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_062.c"
// Test for message: function prototype parameters must have types [62]
/* lint1-extra-flags: -X 351 */
/* expect+1: error: old-style declaration; add 'int' [1] */
outer() {
/* expect+2: warning: function prototype parameters must have types [62] */

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_063.c,v 1.3 2022/02/27 20:02:44 rillig Exp $ */
/* $NetBSD: msg_063.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_063.c"
// Test for message: prototype does not match old-style definition [63]
/* lint1-extra-flags: -X 351 */
int
function(a, b)
int a, b;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_072.c,v 1.7 2022/10/01 09:42:40 rillig Exp $ */
/* $NetBSD: msg_072.c,v 1.8 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_072.c"
// Test for message: typedef declares no type name [72]
/* lint1-extra-flags: -X 351 */
/* expect+1: warning: typedef declares no type name [72] */
typedef int;

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_084.c,v 1.4 2022/04/16 09:20:01 rillig Exp $ */
/* $NetBSD: msg_084.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_084.c"
/* Test for message: ANSI C requires formal parameter before '...' [84] */
/* lint1-flags: -sw */
/* lint1-flags: -sw -X 351 */
/* expect+2: error: ANSI C requires formal parameter before '...' [84] */
void

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_092.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
/* $NetBSD: msg_092.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_092.c"
// Test for message: inconsistent redeclaration of static '%s' [92]
/* lint1-extra-flags: -X 351 */
static int
random(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_093.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
/* $NetBSD: msg_093.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_093.c"
// Test for message: dubious static function '%s' at block level [93]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_094.c,v 1.5 2022/06/21 21:18:30 rillig Exp $ */
/* $NetBSD: msg_094.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_094.c"
// Test for message: function '%s' has illegal storage class [94]
/* lint1-extra-flags: -X 351 */
/* expect+2: error: illegal storage class [8] */
register int
global_example(int arg)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_096.c,v 1.6 2022/06/21 21:18:30 rillig Exp $ */
/* $NetBSD: msg_096.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_096.c"
// Test for message: cannot dereference non-pointer type '%s' [96]
/* lint1-extra-flags: -X 351 */
int
unary_plus(int i)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_099.c,v 1.5 2022/04/03 09:34:45 rillig Exp $ */
/* $NetBSD: msg_099.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_099.c"
// Test for message: '%s' undefined [99]
/* lint1-extra-flags: -X 351 */
void
example(int defined_variable)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_103.c,v 1.4 2022/06/17 18:54:53 rillig Exp $ */
/* $NetBSD: msg_103.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_103.c"
// Test for message: left operand of '.' must be struct or union, not '%s' [103]
/* lint1-extra-flags: -X 351 */
struct point {
int x, y;
};

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_104.c,v 1.4 2022/06/17 18:54:53 rillig Exp $ */
/* $NetBSD: msg_104.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_104.c"
// Test for message: left operand of '->' must be pointer to struct or union, not '%s' [104]
/* lint1-extra-flags: -X 351 */
struct point {
int x, y;
};

View File

@ -1,9 +1,11 @@
/* $NetBSD: msg_106.c,v 1.3 2022/06/15 20:18:31 rillig Exp $ */
/* $NetBSD: msg_106.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_106.c"
// Test for message: left operand of '->' must be pointer [106]
// This message is not used.
/* lint1-extra-flags: -X 351 */
struct s {
int member;
};

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_107.c,v 1.5 2023/06/03 20:28:54 rillig Exp $ */
/* $NetBSD: msg_107.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_107.c"
// Test for message: operands of '%s' have incompatible types '%s' and '%s' [107]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
void
compare(double d, void *ptr)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_108.c,v 1.8 2023/05/22 12:55:04 rillig Exp $ */
/* $NetBSD: msg_108.c,v 1.9 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_108.c"
// Test for message: operand of '%s' has invalid type '%s' [108]
/* lint1-extra-flags: -X 351 */
/*
* Before tree.c 1.137 from 2021-01-19, taking the complement of a struct
* (an absurd idea, by the way), resulted in an internal error because the

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_109.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_109.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_109.c"
// Test for message: void type illegal in expression [109]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
int
example(int arg)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_110.c,v 1.3 2021/07/25 10:26:46 rillig Exp $ */
/* $NetBSD: msg_110.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_110.c"
// Test for message: pointer to function is not allowed here [110]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
void
call_take(int (*ptr)(int))

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_113.c,v 1.4 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: msg_113.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_113.c"
// Test for message: cannot take address of register '%s' [113]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
void
example(register int arg)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_114.c,v 1.6 2022/06/21 21:18:30 rillig Exp $ */
/* $NetBSD: msg_114.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_114.c"
// Test for message: %soperand of '%s' must be lvalue [114]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
void
example(int a)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_116.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_116.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_116.c"
// Test for message: illegal pointer subtraction [116]
/* lint1-extra-flags: -X 351 */
/*
* Subtracting an int pointer from a double pointer does not make sense.
* The result cannot be reasonably defined since it is "the difference of

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_117.c,v 1.13 2023/01/29 17:13:10 rillig Exp $ */
/* $NetBSD: msg_117.c,v 1.14 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_117.c"
// Test for message: bitwise '%s' on signed value possibly nonportable [117]
/* lint1-extra-flags: -p */
/* lint1-extra-flags: -p -X 351 */
int
shr(int a, int b)

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_118.c,v 1.6 2022/06/17 18:54:53 rillig Exp $ */
/* $NetBSD: msg_118.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_118.c"
/* Test for message: semantics of '%s' change in ANSI C; use explicit cast [118] */
/* lint1-flags: -hw */
/* lint1-flags: -hw -X 351 */
int
int_shl_uint(int left, unsigned int right)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_119.c,v 1.3 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_119.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_119.c"
// Test for message: conversion of '%s' to '%s' is out of range [119]
/* lint1-extra-flags: -X 351 */
float
too_big(void)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_120.c,v 1.6 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_120.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_120.c"
// Test for message: bitwise '%s' on signed value nonportable [120]
/* lint1-extra-flags: -p */
/* lint1-extra-flags: -p -X 351 */
int
shr(int a, int b)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_121.c,v 1.6 2022/06/19 12:14:34 rillig Exp $ */
/* $NetBSD: msg_121.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_121.c"
// Test for message: negative shift [121]
/* lint1-extra-flags: -X 351 */
int
example(int x)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_122.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_122.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_122.c"
// Test for message: shift amount %llu is greater than bit-size %llu of '%s' [122]
/* lint1-extra-flags: -X 351 */
int
example(int x)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_125.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_125.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_125.c"
// Test for message: ANSI C forbids ordered comparisons of pointers to functions [125]
/* lint1-extra-flags: -s */
/* lint1-extra-flags: -s -X 351 */
typedef void (*action)(void);

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_126.c,v 1.6 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_126.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_126.c"
// Test for message: incompatible types '%s' and '%s' in conditional [126]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
int
max(int cond, void *ptr, double dbl)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_128.c,v 1.6 2023/07/07 06:03:31 rillig Exp $ */
/* $NetBSD: msg_128.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_128.c"
// Test for message: operands of '%s' have incompatible pointer types to '%s' and '%s' [128]
/* lint1-extra-flags: -X 351 */
void
conversion_to_unconst(const char *cstr)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_132_lp64.c,v 1.1 2022/06/10 18:29:01 rillig Exp $ */
/* $NetBSD: msg_132_lp64.c,v 1.2 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_132_lp64.c"
// Test for message: conversion from '%s' to '%s' may lose accuracy [132]
/* lint1-extra-flags: -a */
/* lint1-extra-flags: -a -X 351 */
/* lint1-only-if: lp64 */
unsigned int

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_133.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_133.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_133.c"
// Test for message: conversion of pointer to '%s' loses bits [133]
/* lint1-extra-flags: -X 351 */
char
to_char(void *ptr)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_136.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_136.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_136.c"
// Test for message: cannot do pointer arithmetic on operand of unknown size [136]
/* lint1-extra-flags: -X 351 */
/* expect+1: warning: struct 'incomplete' never defined [233] */
struct incomplete;

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_138.c,v 1.5 2022/07/01 20:53:13 rillig Exp $ */
/* $NetBSD: msg_138.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_138.c"
// Test for message: unknown operand size, op '%s' [138]
/* lint1-extra-flags: -z */
/* lint1-extra-flags: -z -X 351 */
struct incomplete;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_143.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_143.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_143.c"
// Test for message: cannot take size/alignment of incomplete type [143]
/* lint1-extra-flags: -X 351 */
/* expect+1: warning: struct 'incomplete' never defined [233] */
struct incomplete;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_144.c,v 1.5 2022/04/01 23:16:32 rillig Exp $ */
/* $NetBSD: msg_144.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_144.c"
// Test for message: cannot take size/alignment of function type '%s' [144]
/* lint1-extra-flags: -X 351 */
unsigned long
example(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_145.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_145.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_145.c"
// Test for message: cannot take size/alignment of bit-field [145]
/* lint1-extra-flags: -X 351 */
struct bits {
unsigned one: 1;
unsigned eight: 8;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_146.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_146.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_146.c"
// Test for message: cannot take size/alignment of void [146]
/* lint1-extra-flags: -X 351 */
unsigned long
example(void *ptr)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_149.c,v 1.4 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: msg_149.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_149.c"
// Test for message: cannot call '%s', must be a function [149]
/* lint1-extra-flags: -X 351 */
void
example(int i)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_159.c,v 1.6 2023/04/22 17:30:35 rillig Exp $ */
/* $NetBSD: msg_159.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_159.c"
// Test for message: assignment in conditional context [159]
/* lint1-extra-flags: -h */
/* lint1-extra-flags: -h -X 351 */
const char *
example(int a, int b)

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_163.c,v 1.4 2021/07/04 12:24:39 rillig Exp $ */
/* $NetBSD: msg_163.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_163.c"
// Test for message: a cast does not yield an lvalue [163]
/* lint1-extra-flags: -X 351 */
void
example(char *p, int i)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_164.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_164.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_164.c"
// Test for message: assignment of negative constant to unsigned type [164]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_165.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
/* $NetBSD: msg_165.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_165.c"
// Test for message: constant truncated by assignment [165]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_166.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_166.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_166.c"
// Test for message: precision lost in bit-field assignment [166]
/* lint1-extra-flags: -hp */
/* lint1-extra-flags: -hp -X 351 */
struct bit_set {

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_167.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_167.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_167.c"
// Test for message: array subscript cannot be negative: %ld [167]
/* lint1-extra-flags: -X 351 */
void
example(int *ptr)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_170.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_170.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_170.c"
// Test for message: first operand must have scalar type, op ? : [170]
/* lint1-extra-flags: -X 351 */
struct number {
int value;
};

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_171.c,v 1.8 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_171.c,v 1.9 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_171.c"
// Test for message: cannot assign to '%s' from '%s' [171]
/* lint1-extra-flags: -X 351 */
struct s {
int member;
};

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_174.c,v 1.5 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_174.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_174.c"
// Test for message: too many initializers [174]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_182.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
/* $NetBSD: msg_182.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_182.c"
// Test for message: incompatible pointer types to '%s' and '%s' [182]
/* lint1-extra-flags: -X 351 */
void *
return_discarding_volatile(volatile void *arg)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_183.c,v 1.4 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: msg_183.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_183.c"
// Test for message: illegal combination of %s '%s' and %s '%s' [183]
/* lint1-extra-flags: -X 351 */
/* expect+2: warning: argument 'x' unused in function 'example' [231] */
void *
example(double x, int i, void *vp, int *ip, double *dp, void (*fp)(void))

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_184.c,v 1.5 2022/06/17 18:54:53 rillig Exp $ */
/* $NetBSD: msg_184.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_184.c"
// Test for message: illegal combination of '%s' and '%s' [184]
/* lint1-extra-flags: -X 351 */
int *
example(char *cp)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_191.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_191.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_191.c"
// Test for message: '%s' set but not used in function '%s' [191]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,10 +1,12 @@
/* $NetBSD: msg_192.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_192.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_192.c"
// Test for message: '%s' unused in function '%s' [192]
/* ARGSUSED */
/* lint1-extra-flags: -X 351 */
void
/* expect+1: warning: argument 'param' unused in function 'example' [231] */
example(int param)
{
/* expect+1: warning: 'local' unused in function 'example' [192] */

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_194.c,v 1.4 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: msg_194.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_194.c"
// Test for message: label '%s' redefined [194]
/* lint1-extra-flags: -X 351 */
void example(void)
{
int i = 0;

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_195.c,v 1.3 2022/06/16 16:58:36 rillig Exp $ */
/* $NetBSD: msg_195.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_195.c"
// Test for message: case not in switch [195]
/* lint1-extra-flags: -X 351 */
int
example(int x)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_200.c,v 1.3 2021/08/27 20:16:50 rillig Exp $ */
/* $NetBSD: msg_200.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_200.c"
// Test for message: duplicate case in switch: %lu [200]
/* lint1-extra-flags: -X 351 */
void
example(unsigned x)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_201.c,v 1.3 2021/08/26 19:23:25 rillig Exp $ */
/* $NetBSD: msg_201.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_201.c"
// Test for message: default outside switch [201]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_202.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */
/* $NetBSD: msg_202.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_202.c"
// Test for message: duplicate default in switch [202]
/* lint1-extra-flags: -X 351 */
void
example(int x)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_205.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */
/* $NetBSD: msg_205.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_205.c"
// Test for message: switch expression must have integral type [205]
/* lint1-extra-flags: -X 351 */
/* ARGSUSED */
void
example(double x)

View File

@ -1,9 +1,9 @@
/* $NetBSD: msg_206.c,v 1.6 2022/05/22 13:58:59 rillig Exp $ */
/* $NetBSD: msg_206.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_206.c"
// Test for message: enumeration value(s) not handled in switch [206]
/* lint1-extra-flags: -eh */
/* lint1-extra-flags: -eh -X 351 */
enum number {
ONE, TWO, THREE

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_209.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */
/* $NetBSD: msg_209.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_209.c"
// Test for message: continue outside loop [209]
/* lint1-extra-flags: -X 351 */
void
example(void)
{

View File

@ -1,8 +1,10 @@
/* $NetBSD: msg_211.c,v 1.5 2022/06/22 19:23:18 rillig Exp $ */
/* $NetBSD: msg_211.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */
# 3 "msg_211.c"
// Test for message: function has return type '%s' but returns '%s' [211]
/* lint1-extra-flags: -X 351 */
struct str {
int member;
};

Some files were not shown because too many files have changed in this diff Show More