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