xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_383.c (revision 32d1c65c71fbdb65a012e8392a62a757dd6853e9)
1 /*	$NetBSD: msg_383.c,v 1.1 2024/11/23 16:48:35 rillig Exp $	*/
2 # 3 "msg_383.c"
3 
4 // Test for message: passing '%s' to argument %d discards '%s' [383]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 void sink_char(char *, const char *, volatile char *, const volatile char *);
9 void sink_int(int *, const int *, volatile int *, const volatile int *);
10 
11 void
12 caller(const volatile char *cvcp, const volatile int *cvip, int (*fn)(void))
13 {
14 	/* expect+3: warning: passing 'pointer to const volatile char' to argument 1 discards 'const volatile' [383] */
15 	/* expect+2: warning: passing 'pointer to const volatile char' to argument 2 discards 'volatile' [383] */
16 	/* expect+1: warning: passing 'pointer to const volatile char' to argument 3 discards 'const' [383] */
17 	sink_char(cvcp, cvcp, cvcp, cvcp);
18 	/* expect+3: warning: passing 'pointer to const volatile int' to argument 1 discards 'const volatile' [383] */
19 	/* expect+2: warning: passing 'pointer to const volatile int' to argument 2 discards 'volatile' [383] */
20 	/* expect+1: warning: passing 'pointer to const volatile int' to argument 3 discards 'const' [383] */
21 	sink_int(cvip, cvip, cvip, cvip);
22 	/* expect+4: warning: converting 'pointer to function(void) returning int' to incompatible 'pointer to char' for argument 1 [153] */
23 	/* expect+3: warning: converting 'pointer to function(void) returning int' to incompatible 'pointer to const char' for argument 2 [153] */
24 	/* expect+2: warning: converting 'pointer to function(void) returning int' to incompatible 'pointer to volatile char' for argument 3 [153] */
25 	/* expect+1: warning: converting 'pointer to function(void) returning int' to incompatible 'pointer to const volatile char' for argument 4 [153] */
26 	sink_char(fn, fn, fn, fn);
27 }
28