blob: 0849e0fca9811eea8906944bda70456c02398e72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* $NetBSD: msg_123.c,v 1.8 2023/06/03 20:28:54 rillig Exp $ */
# 3 "msg_123.c"
// Test for message: illegal combination of %s '%s' and %s '%s', op '%s' [123]
/* lint1-extra-flags: -X 351 */
void ok(_Bool);
void bad(_Bool);
void
compare(_Bool b, int i, double d, const char *p)
{
ok(b < b);
ok(b < i);
ok(b < d);
/* expect+1: warning: illegal combination of integer '_Bool' and pointer 'pointer to const char', op '<' [123] */
bad(b < p);
ok(i < b);
ok(i < i);
ok(i < d);
/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to const char', op '<' [123] */
bad(i < p);
ok(d < b);
ok(d < i);
ok(d < d);
/* expect+1: error: operands of '<' have incompatible types 'double' and 'pointer to const char' [107] */
bad(d < p);
/* expect+1: warning: illegal combination of pointer 'pointer to const char' and integer '_Bool', op '<' [123] */
bad(p < b);
/* expect+1: warning: illegal combination of pointer 'pointer to const char' and integer 'int', op '<' [123] */
bad(p < i);
/* expect+1: error: operands of '<' have incompatible types 'pointer to const char' and 'double' [107] */
bad(p < d);
ok(p < p);
}
void
cover_check_assign_types_compatible(int *int_pointer, int i)
{
/* expect+1: warning: illegal combination of pointer 'pointer to int' and integer 'int', op '=' [123] */
int_pointer = i;
/* expect+1: warning: illegal combination of integer 'int' and pointer 'pointer to int', op '=' [123] */
i = int_pointer;
}
|