xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_030.c (revision dcb32fd76a6d98c4a9af231446a80d630943641c)
1 /*	$NetBSD: msg_030.c,v 1.8 2023/08/26 10:43:53 rillig Exp $	*/
2 # 3 "msg_030.c"
3 
4 /* Test for message: redeclaration of '%s'; C90 or later require static [30] */
5 
6 /* lint1-flags: -sw -X 351 */
7 
8 /* expect+1: error: old-style declaration; add 'int' [1] */
9 static a;
10 /* expect+1: warning: redeclaration of 'a'; C90 or later require 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'; C90 or later require 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'; C90 or later require static [30] */
21 int c;
22 
23 void
use_variables(void)24 use_variables(void)
25 {
26 	c = a + b + c;
27 }
28