xref: /netbsd-src/tests/usr.bin/xlint/lint1/queries_uchar.c (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1 /*	$NetBSD: queries_uchar.c,v 1.1 2023/07/03 15:29:42 rillig Exp $	*/
2 # 3 "queries_uchar.c"
3 
4 /*
5  * Tests for queries that are specific to platforms where 'char' has the same
6  * representation as 'unsigned char'.
7  *
8  * See also:
9  *	queries.c		platform-independent tests
10  *	queries_schar.c		for platforms where 'char' is signed
11  */
12 
13 /* lint1-only-if: uchar */
14 /* lint1-extra-flags: -q 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 -X 351 */
15 
16 int
17 Q14(char c)
18 {
19 	/* expect+6: implicit conversion changes sign from 'char' to 'int' [Q3] */
20 	/* expect+5: implicit conversion changes sign from 'char' to 'int' [Q3] */
21 	/* expect+4: implicit conversion changes sign from 'char' to 'int' [Q3] */
22 	/* expect+3: comparison '==' of 'char' with plain integer 92 [Q14] */
23 	/* expect+2: implicit conversion changes sign from 'char' to 'int' [Q3] */
24 	/* expect+1: comparison '==' of 'char' with plain integer 0 [Q14] */
25 	if (c == 'c' || c == L'w' || c == 92 || c == 0)
26 		return 1;
27 	return 5;
28 }
29 
30 /*
31  * Since queries do not affect the exit status, force a warning to make this
32  * test conform to the general expectation that a test that produces output
33  * exits non-successfully.
34  */
35 /* expect+1: warning: static variable 'unused' unused [226] */
36 static int unused;
37