xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_123.c (revision d536862b7d93d77932ef5de7eebdc48d76921b77)
1 /*	$NetBSD: msg_123.c,v 1.4 2021/12/04 00:01:24 rillig Exp $	*/
2 # 3 "msg_123.c"
3 
4 // Test for message: illegal combination of %s '%s' and %s '%s', op '%s' [123]
5 
6 void ok(_Bool);
7 void bad(_Bool);
8 
9 void
10 compare(_Bool b, int i, double d, const char *p)
11 {
12 	ok(b < b);
13 	ok(b < i);
14 	ok(b < d);
15 	bad(b < p);		/* expect: 123 */
16 	ok(i < b);
17 	ok(i < i);
18 	ok(i < d);
19 	bad(i < p);		/* expect: 123 */
20 	ok(d < b);
21 	ok(d < i);
22 	ok(d < d);
23 	bad(d < p);		/* expect: 107 */
24 	bad(p < b);		/* expect: 123 */
25 	bad(p < i);		/* expect: 123 */
26 	bad(p < d);		/* expect: 107 */
27 	ok(p < p);
28 }
29 
30 void
31 cover_check_assign_types_compatible(int *int_pointer, int i)
32 {
33 	/* expect+1: warning: illegal combination of pointer 'pointer to int' and integer 'int', op '=' [123] */
34 	int_pointer = i;
35 	/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to int', op '=' [123] */
36 	i = int_pointer;
37 }
38