xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_030.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: msg_030.c,v 1.6 2022/10/01 09:42:40 rillig Exp $	*/
2 # 3 "msg_030.c"
3 
4 /* Test for message: redeclaration of '%s'; ANSI C requires static [30] */
5 
6 /* lint1-flags: -sw */
7 
8 /* expect+1: error: old-style declaration; add 'int' [1] */
9 static a;
10 /* expect+1: warning: redeclaration of 'a'; ANSI C requires static [30] */
11 int a;
12 
13 /* expect+1: error: old-style declaration; add 'int' [1] */
14 static b;
15 /* expect+1: warning: redeclaration of 'b'; ANSI C requires static [30] */
16 int b = 1;
17 
18 /* expect+1: error: old-style declaration; add 'int' [1] */
19 static c = 1;
20 /* expect+1: warning: redeclaration of 'c'; ANSI C requires static [30] */
21 int c;
22 
23 void
24 use_variables(void)
25 {
26 	c = a + b + c;
27 }
28