From: Thomas Monjalon Date: Fri, 16 Nov 2018 16:58:50 +0000 (+0100) Subject: eal: fix build with -O1 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e357e8ebd99c9c394a276fdffd37f13005cb1c63;p=dpdk.git eal: fix build with -O1 In case of optimized compilation, RTE_BUILD_BUG_ON use an external variable which is neither defined, nor used. It seems not optimized out in case of OPDL compiled with clang -O1: opdl_ring.c: undefined reference to `RTE_BUILD_BUG_ON_detected_error' clang-6.0: fatal error: linker command failed with exit code 1 Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon --- diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index d115b175c9..66cdf60b23 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -270,16 +270,7 @@ rte_is_aligned(void *ptr, unsigned align) /** * Triggers an error at compilation time if the condition is true. */ -#ifndef __OPTIMIZE__ #define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) -#else -extern int RTE_BUILD_BUG_ON_detected_error; -#define RTE_BUILD_BUG_ON(condition) do { \ - ((void)sizeof(char[1 - 2*!!(condition)])); \ - if (condition) \ - RTE_BUILD_BUG_ON_detected_error = 1; \ -} while(0) -#endif /** * Combines 32b inputs most significant set bits into the least