xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_347.c (revision 5e813441c07ecbe6db2dd698359dc51e12b40685)
1 /*	$NetBSD: msg_347.c,v 1.7 2023/08/02 21:11:35 rillig Exp $	*/
2 # 3 "msg_347.c"
3 
4 // Test for message: redeclaration of '%s' with type '%s', expected '%s' [347]
5 
6 /* lint1-extra-flags: -r -X 351 */
7 
8 /*
9  * Message 27 already covers redeclarations, but it doesn't include enough
10  * details to make any sense of it.
11  */
12 
13 /*
14  * Before 2023-08-02, lint did not interpret unnamed function parameters with
15  * complicated types correctly. The named counterparts were no problem, though.
16  */
17 
18 void function_parameter(void *, double *(void *, int));
19 void function_parameter(void *fs, double *fn(void *, int));
20 
21 
22 /* expect+1: warning: struct 'last_arg' never defined [233] */
23 struct last_arg;
24 void last_arg_struct(double, double *(struct last_arg *));
25 void last_arg_struct(double d, double *fn(struct last_arg *));
26 
27 
28 struct last_param {
29 	int member;
30 };
31 
32 void last_param(double, double *(struct last_param));
33 void last_param(double d, double *fn(struct last_param));
34 
35 
36 /* expect+1: previous declaration of 'mismatch' [260] */
37 void mismatch(double, double *(struct last_param));
38 /* expect+1: error: redeclaration of 'mismatch' with type 'function(double, pointer to function(struct last_param) returning pointer to float) returning void', expected 'function(double, pointer to function(struct last_param) returning pointer to double) returning void' [347] */
39 void mismatch(double d, float *fn(struct last_param));
40