xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_021.c (revision 3d6a50253cd682dca85a66a49baee893251dac65)
1 /*	$NetBSD: msg_021.c,v 1.8 2025/01/03 03:14:47 rillig Exp $	*/
2 # 3 "msg_021.c"
3 
4 // Test for message: redeclaration of formal parameter '%s' [21]
5 
6 /* See also message 237, which has the same text. */
7 
8 /* lint1-extra-flags: -X 351 */
9 
10 /*ARGSUSED*/
11 void
12 /* expect+2: error: redeclaration of formal parameter 'parameter' [21] */
13 /* expect+1: warning: function definition for 'old_style_with_duplicate_parameter' with identifier list is obsolete in C23 [384] */
14 old_style_with_duplicate_parameter(parameter, parameter)
15     int parameter;
16 {
17 	/* expect-1: warning: type of parameter 'parameter' defaults to 'int' [32] */
18 }
19 
20 void
21 /* expect+1: warning: function definition for 'old_style_with_duplicate_parameter_declaration' with identifier list is obsolete in C23 [384] */
22 old_style_with_duplicate_parameter_declaration(parameter)
23     int parameter;
24     /* expect+1: error: redeclaration of formal parameter 'parameter' [237] */
25     int parameter;
26 {
27 }
28 
29 /* expect+1: warning: function definition for 'old_style_with_local_variable' with identifier list is obsolete in C23 [384] */
30 void old_style_with_local_variable(parameter)
31     int parameter;
32 {
33 	/* expect+1: error: redeclaration of 'parameter' [27] */
34 	int parameter;
35 }
36 
37 /*ARGSUSED*/
38 void
39 /* expect+1: error: redeclaration of formal parameter 'param' [237] */
40 prototype_with_duplicate_parameter(int param, int param)
41 {
42 
43 }
44 
45 void
46 prototype_with_local_variable(int parameter)
47 {
48 	/* expect+1: error: redeclaration of 'parameter' [27] */
49 	int parameter;
50 }
51