xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_156.c (revision b2baa50111d645353fa30b4deab0f79d93650c8c)
1 /*	$NetBSD: msg_156.c,v 1.8 2023/03/28 14:44:35 rillig Exp $	*/
2 # 3 "msg_156.c"
3 
4 // Test for message: function expects '%s', passing '%s' for arg #%d [156]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 enum color {
9 	RED	= 1 << 0,
10 	GREEN	= 1 << 1,
11 	BLUE	= 1 << 2
12 };
13 
14 enum size {
15 	SMALL,
16 	MEDIUM,
17 	LARGE
18 };
19 
20 void print_color(enum color);
21 
22 void
example(enum color c,enum size s)23 example(enum color c, enum size s)
24 {
25 	print_color(GREEN);
26 	print_color(c);
27 
28 	/* expect+1: warning: function expects 'enum color', passing 'enum size' for arg #1 [156] */
29 	print_color(MEDIUM);
30 	/* expect+1: warning: function expects 'enum color', passing 'enum size' for arg #1 [156] */
31 	print_color(s);
32 }
33