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
46
47
48
49
50
51
52
53
54
55
56
57
|
/* $NetBSD: msg_124.c,v 1.13 2023/03/28 14:44:34 rillig Exp $ */
# 3 "msg_124.c"
// Test for message: illegal combination of '%s' and '%s', op '%s' [124]
/* lint1-extra-flags: -s -X 351 */
typedef void(*signal_handler)(int);
typedef signal_handler(*sys_signal)(signal_handler);
typedef int(*printflike)(const char *, ...)
__attribute__((format(printf, 1, 2)));
void
example(int *ptr)
{
/* expect+1: warning: illegal combination of 'pointer to function(int) returning void' and 'pointer to int', op 'init' [124] */
signal_handler handler = ptr;
/* expect+1: warning: illegal combination of 'pointer to function(pointer to function(int) returning void) returning pointer to function(int) returning void' and 'pointer to int', op 'init' [124] */
sys_signal signal = ptr;
/* expect+1: warning: illegal combination of 'pointer to function(pointer to const char, ...) returning int' and 'pointer to int', op 'init' [124] */
printflike printf = ptr;
}
void ok(_Bool);
void not_ok(_Bool);
void
compare_pointers(const void *vp, const char *cp, const int *ip,
signal_handler fp)
{
ok(vp == cp);
ok(vp == ip);
/* expect+1: warning: ANSI C forbids comparison of 'void *' with function pointer [274] */
ok(vp == fp);
/* expect+1: warning: illegal combination of 'pointer to const char' and 'pointer to const int', op '==' [124] */
not_ok(cp == ip);
/* expect+1: warning: illegal combination of 'pointer to const char' and 'pointer to function(int) returning void', op '==' [124] */
not_ok(cp == fp);
ok(vp == (void *)0);
ok(cp == (void *)0);
ok(ip == (void *)0);
ok(fp == (void *)0); /* wrong 274 before 2021-01-25 */
ok((void *)0 == vp);
ok((void *)0 == cp);
ok((void *)0 == ip);
ok((void *)0 == fp); /* wrong 274 before 2021-01-25 */
ok(vp == 0);
ok(cp == 0);
ok(ip == 0);
ok(fp == 0);
ok(vp == 0L);
ok(cp == 0L);
ok(ip == 0L);
ok(fp == 0L);
}
|