hash: fix icc build
authorFerruh Yigit <ferruh.yigit@intel.com>
Tue, 13 Jun 2017 16:42:12 +0000 (17:42 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 14 Jun 2017 20:54:54 +0000 (22:54 +0200)
build error with icc version 17.0.4 (gcc version 7.0.0 compatibility):

In file included from .../dpdk/lib/librte_hash/rte_fbk_hash.h(59),
                 from .../dpdk/lib/librte_hash/rte_fbk_hash.c(54):
.../dpdk/x86_64-native-linuxapp-icc/include/rte_hash_crc.h(480):
 error #1292: unknown attribute "fallthrough"
                __attribute__ ((fallthrough));
                                ^

In file included from .../dpdk/lib/librte_hash/rte_fbk_hash.h(59),
                 from .../dpdk/lib/librte_hash/rte_fbk_hash.c(54):
.../dpdk/x86_64-native-linuxapp-icc/include/rte_hash_crc.h(486):
 error #1292: unknown attribute "fallthrough"
                __attribute__ ((fallthrough));
                                ^
This code patch hit when gcc > 7 installed and ICC doesn't recognize
fallthrough attribute.

Fixed by disabling code when compiled with ICC.

Fixes: 3dfb9facb055 ("lib: add switch fall-through comments")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_hash/rte_hash_crc.h

index 0f485b8..b8a0cbe 100644 (file)
@@ -476,13 +476,13 @@ rte_hash_crc_set_alg(uint8_t alg)
        case CRC32_SSE42_x64:
                if (! rte_cpu_get_flag_enabled(RTE_CPUFLAG_EM64T))
                        alg = CRC32_SSE42;
-#if __GNUC__ >= 7
+#if __GNUC__ >= 7 && !defined(RTE_TOOLCHAIN_ICC)
                __attribute__ ((fallthrough));
 #endif
        case CRC32_SSE42:
                if (! rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE4_2))
                        alg = CRC32_SW;
-#if __GNUC__ >= 7
+#if __GNUC__ >= 7 && !defined(RTE_TOOLCHAIN_ICC)
                __attribute__ ((fallthrough));
 #endif
 #endif