Super User's BSD Cross Reference: /NetBSD/tests/usr.bin/xlint/lint1/msg_183.c

1 /* $NetBSD: msg_183.c,v 1.8 2025年04月12日 15:49:50 rillig Exp $ */
2# 3 "msg_183.c"
3
4 // Test for message: invalid combination of %s '%s' and %s '%s' for '%s' [183]
5
6 /* lint1-extra-flags: -X 351 */
7
8 /* expect+2: warning: parameter 'x' unused in function 'example' [231] */
9 void *
10 example(double x, int i, void *vp, int *ip, double *dp, void (*fp)(void))
11{
12 /* expect+1: warning: invalid combination of pointer 'pointer to void' and integer 'int' for 'init' [183] */
13 void *local_vp = i;
14
15 if (i < 0)
16 /* expect+1: error: function has return type 'pointer to void' but returns 'double' [211] */
17 return x;
18
19 if (i < 1)
20 /* expect+1: warning: invalid combination of pointer 'pointer to void' and integer 'int' for 'return' [183] */
21 return i;
22
23 if (i < 2)
24 return vp;
25
26 if (i < 3)
27 return ip;
28
29 if (i < 4)
30 return dp;
31
32 if (i < 5)
33 return fp;
34
35 return (void *)0;
36}
37 

AltStyle によって変換されたページ (->オリジナル) /