xref: /netbsd-src/tests/usr.bin/xlint/lint1/platform_schar.c (revision ccd9df534e375a4366c5b55f23782053c7a98d82)
1 /*	$NetBSD: platform_schar.c,v 1.6 2024/06/08 06:37:06 rillig Exp $	*/
2 # 3 "platform_schar.c"
3 
4 /*
5  * Test features that only apply to platforms where plain char has the same
6  * representation as signed char.
7  */
8 
9 /* lint1-extra-flags: -c -h -a -p -b -r -z -X 161,351 */
10 /* lint1-only-if: schar */
11 
12 /* expect+1: warning: nonportable character comparison '-128 < ?' [230] */
13 typedef int char_char[(char)'\200' < (char)'\177' ? 1 : -1];
14 /* expect+1: warning: nonportable character comparison '-128 < ?' [230] */
15 typedef int char_int[(char)'\200' < (char)127 ? 1 : -1];
16 /* expect+1: warning: nonportable character comparison '-128 < ?' [230] */
17 typedef int int_char[(char)-128 < (char)'\177' ? 1 : -1];
18 /* expect+1: warning: nonportable character comparison '-128 < ?' [230] */
19 typedef int int_int[(char)-128 < (char)127 ? 1 : -1];
20 
21 
22 void
23 first_to_upper(char *p)
24 {
25 	*p += 'A' - 'a';
26 }
27