xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_117.c (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: msg_117.c,v 1.5 2021/04/05 01:35:34 rillig Exp $	*/
2 # 3 "msg_117.c"
3 
4 // Test for message: bitwise '%s' on signed value possibly nonportable [117]
5 
6 /* lint1-extra-flags: -p */
7 
8 int
9 shr(int a, int b)
10 {
11 	return a >> b;			/* expect: 117 */
12 }
13 
14 int
15 shr_lhs_constant_positive(int a)
16 {
17 	return 0x1234 >> a;
18 }
19 
20 int
21 shr_lhs_constant_negative(int a)
22 {
23 	return -0x1234 >> a;		/* expect: 120 */
24 }
25 
26 int
27 shr_rhs_constant_positive(int a)
28 {
29 	return a >> 0x1234;		/* expect: 117 *//* expect: 122 */
30 }
31 
32 int
33 shr_rhs_constant_negative(int a)
34 {
35 	return a >> -0x1234;		/* expect: 117 *//* expect: 121 */
36 }
37