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 <christian.ehrhardt@canonical.com>
Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: David Wilder <dwilder@us.ibm.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
This commit is contained in:
Thomas Monjalon 2018-11-07 17:00:28 +01:00 committed by Ferruh Yigit
parent ba46f5e60f
commit 725f5dd0bf

View File

@ -15,6 +15,16 @@
#include "mlx5_defs.h" #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
#endif
/* Bit-field manipulation. */ /* Bit-field manipulation. */
#define BITFIELD_DECLARE(bf, type, size) \ #define BITFIELD_DECLARE(bf, type, size) \
type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \ type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \