xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_240.c (revision 039b010016da489b3c993f4814255a8bc72125df)
1 /*	$NetBSD: msg_240.c,v 1.8 2023/08/02 18:51:25 rillig Exp $	*/
2 # 3 "msg_240.c"
3 
4 // Test for message: assignment of different structures (%s != %s) [240]
5 // This message is not used.
6 
7 /* lint1-extra-flags: -X 351 */
8 
9 struct s_param {
10 	int member;
11 };
12 
13 struct s_local {
14 	int member;
15 };
16 
17 struct s_return {
18 	int member;
19 };
20 
21 union u_arg {
22 	int member;
23 };
24 
25 /* expect+2: warning: parameter 's_param' unused in function 'return_other_struct' [231] */
26 struct s_return
return_other_struct(struct s_param s_param)27 return_other_struct(struct s_param s_param)
28 {
29 	/* XXX: No warning? */
30 	return s_param;
31 }
32 
33 /* expect+2: warning: parameter 's_param' unused in function 'assign_other_struct' [231] */
34 void
assign_other_struct(struct s_param s_param)35 assign_other_struct(struct s_param s_param)
36 {
37 	/* expect+1: warning: 's_local' unused in function 'assign_other_struct' [192] */
38 	static struct s_local s_local;
39 	/* XXX: No warning? */
40 	s_local = s_param;
41 }
42 
43 /* expect+2: warning: parameter 'u_arg' unused in function 'return_other_union' [231] */
44 struct s_return
return_other_union(union u_arg u_arg)45 return_other_union(union u_arg u_arg)
46 {
47 	/* XXX: No warning? */
48 	return u_arg;
49 }
50