xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_192.c (revision ccd9df534e375a4366c5b55f23782053c7a98d82)
1 /*	$NetBSD: msg_192.c,v 1.9 2023/09/12 22:01:05 rillig Exp $	*/
2 # 3 "msg_192.c"
3 
4 // Test for message: '%s' unused in function '%s' [192]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 void
9 /* expect+1: warning: parameter 'param' unused in function 'example' [231] */
10 example(int param)
11 {
12 	/* expect+1: warning: 'local' unused in function 'example' [192] */
13 	int local;
14 }
15 
16 
17 void assertion_failed(const char *, int, const char *, const char *);
18 
19 /*
20  * The symbol '__func__' only occurs in an unreachable branch.  It is
21  * nevertheless marked as used.
22  */
23 void
24 assert_true(void)
25 {
26 	sizeof(char) == 1
27 	    ? (void)0
28 	    : assertion_failed("file", 26, __func__, "sizeof(char) == 1");
29 }
30 
31 void
32 assert_false(void)
33 {
34 	sizeof(char) == 0
35 	    ? (void)0
36 	    : assertion_failed("file", 34, __func__, "sizeof(char) == 0");
37 }
38 
39 void
40 assert_unknown(_Bool cond)
41 {
42 	cond
43 	    ? (void)0
44 	    : assertion_failed("file", 42, __func__, "cond");
45 }
46