xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_021.c (revision ccd9df534e375a4366c5b55f23782053c7a98d82)
1 /*	$NetBSD: msg_021.c,v 1.6 2023/08/02 18:51:25 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+1: error: redeclaration of formal parameter 'parameter' [21] */
13 old_style_with_duplicate_parameter(parameter, parameter)
14     int parameter;
15 {
16 	/* expect-1: warning: type of parameter 'parameter' defaults to 'int' [32] */
17 }
18 
19 void
20 old_style_with_duplicate_parameter_declaration(parameter)
21     int parameter;
22     /* expect+1: error: redeclaration of formal parameter 'parameter' [237] */
23     int parameter;
24 {
25 }
26 
27 void old_style_with_local_variable(parameter)
28     int parameter;
29 {
30 	/* expect+1: error: redeclaration of 'parameter' [27] */
31 	int parameter;
32 }
33 
34 /*ARGSUSED*/
35 void
36 /* expect+1: error: redeclaration of formal parameter 'param' [237] */
37 prototype_with_duplicate_parameter(int param, int param)
38 {
39 
40 }
41 
42 void
43 prototype_with_local_variable(int parameter)
44 {
45 	/* expect+1: error: redeclaration of 'parameter' [27] */
46 	int parameter;
47 }
48