1 typedef unsigned short __be16;
2 typedef unsigned short __u16;
3 typedef unsigned short u16;
4 #define __force
5
6 #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
7 /* the test behaves as though it's always on a little-endian machine */
8 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
9 #define ___htons(x) __cpu_to_be16(x)
10 #define htons(x) ___htons(x)
11
12 #define ETH_P_IPV6 0x86DD
13
14 static u16 protocol;
15
16 static void test(void)
17 {
18 switch (protocol) {
19 case htons(ETH_P_IPV6):
20 break;
21 }
22 }
23
24 /*
25 * check-name: constant folding in bswap builtins
26 * check-error-start
27 * check-error-end
28 */