xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_211.c (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1 /*	$NetBSD: msg_211.c,v 1.6 2023/07/07 19:45:22 rillig Exp $	*/
2 # 3 "msg_211.c"
3 
4 // Test for message: function has return type '%s' but returns '%s' [211]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 struct str {
9 	int member;
10 };
11 
12 int
13 return_int(double dbl, void *ptr, struct str str)
14 {
15 	if (dbl > 0.0)
16 		return dbl;
17 	if (ptr != (void *)0)
18 		/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to void' [183] */
19 		return ptr;
20 	if (str.member > 0)
21 		/* expect+1: error: function has return type 'int' but returns 'struct str' [211] */
22 		return str;
23 	return 3;
24 }
25