diff options
authorThomas Monjalon <>2018-11-07 17:00:28 +0100
committerFerruh Yigit <>2018-11-14 00:35:53 +0100
commit725f5dd0bfb50192a2d2341d4cc69084c2c4e03d (patch)
parentba46f5e60f03fdc357e5fcbc370eb2812c3120ff (diff)
net/mlx5: fix build on PPC64
The AltiVec header file breaks boolean type: error: incompatible types when initializing type '__vector _bool int' {aka '_vector(4) __bool int'} using type 'int' If __APPLE_ALTIVEC__ is defined, then bool type is redefined and conflicts with stdbool.h. There is no good solution to fix it for the whole project without breaking something else, so a workaround is inserted in mlx5 PMD. This workaround is not compatible with C++ but there is no C++ in DPDK. Suggested-by: Christian Ehrhardt <> Suggested-by: Adrien Mazarguil <> Signed-off-by: Thomas Monjalon <> Tested-by: David Wilder <> Acked-by: Chao Zhu <>
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index 886f60e..97092c7 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -15,6 +15,16 @@
#include "mlx5_defs.h"
+ * Compilation workaround for PPC64 when AltiVec is fully enabled, e.g. std=c11.
+ * Otherwise there would be a type conflict between stdbool and altivec.
+ */
+#if defined(__PPC64__) && !defined(__APPLE_ALTIVEC__)
+#undef bool
+/* redefine as in stdbool.h */
+#define bool _Bool
/* Bit-field manipulation. */
#define BITFIELD_DECLARE(bf, type, size) \
type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \