[dpdk-dev] [PATCH 5/5] hash: fix icc build

Ferruh Yigit ferruh.yigit at intel.com
Tue Jun 13 18:42:12 CEST 2017


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 at intel.com>
---
This can be merged with the patch fixes gcc build error.

Cc: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/librte_hash/rte_hash_crc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index 0f485b854..b8a0cbefb 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -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
-- 
2.13.0



More information about the dev mailing list