simplify '(x / -1)' to '-x' (but only for signed division)
[smatch.git] / validation / bswap-constant-folding.c
blobc6511fe6204108970b8d26104d7f39320256a75e
1 typedef unsigned short __be16;
2 typedef unsigned short __u16;
3 typedef unsigned short u16;
4 #define __force
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)
12 #define ETH_P_IPV6 0x86DD
14 static u16 protocol;
16 static void test(void)
18 switch (protocol) {
19 case htons(ETH_P_IPV6):
20 break;
25 * check-name: constant folding in bswap builtins
26 * check-error-start
27 * check-error-end