DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] PPC64: fix boolean type conflict
@ 2020-04-28 16:52 Thinh Tran
  2020-04-28 21:38 ` Thinh Tran
  0 siblings, 1 reply; 2+ messages in thread
From: Thinh Tran @ 2020-04-28 16:52 UTC (permalink / raw)
  To: dev; +Cc: drc, david.marchand, jerinjacobk, orika, Thinh Tran

The altivec.h on PPC64 breaks boolean type:

In file included from ../lib/librte_mempool/rte_mempool_trace_fp.h:18:0,
                 from ../lib/librte_mempool/rte_mempool.h:54,
                 from ../lib/librte_mbuf/rte_mbuf.h:38,
                 from ../lib/librte_net/rte_ether.h:23,
                 from ../drivers/common/mlx5/mlx5_nl.h:10,
                 from ../drivers/common/mlx5/mlx5_nl.c:23:
../lib/librte_eal/include/rte_trace_point.h: In function
‘__rte_trace_point_fp_is_enabled’:
../lib/librte_eal/include/rte_trace_point.h:226:9: error: incompatible
types when returning type ‘int’ but ‘__vector __bool int {aka
__vector(4) __bool int}’ was expected
  return false;

It needs to be redefinded as in the stdbool.h 


Signed-off-by: Thinh Tran <thinhtr@linux.vnet.ibm.com>
---
 drivers/common/mlx5/mlx5_common.h       | 10 ----------
 drivers/net/mlx4/mlx4_utils.h           | 10 ----------
 drivers/net/mlx5/mlx5_utils.h           | 10 ----------
 lib/librte_eal/ppc/include/rte_memcpy.h |  4 ++++
 4 files changed, 4 insertions(+), 30 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
index 16de1b397..c2d688a9b 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -17,16 +17,6 @@
 #include "mlx5_prm.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. */
 #define BITFIELD_DECLARE(bf, type, size) \
 	type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \
diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
index b8769562a..095958f3d 100644
--- a/drivers/net/mlx4/mlx4_utils.h
+++ b/drivers/net/mlx4/mlx4_utils.h
@@ -14,16 +14,6 @@
 
 #include "mlx4.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
-
 extern int mlx4_logtype;
 
 #ifdef RTE_LIBRTE_MLX4_DEBUG
diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index d81ace394..0e016f87c 100644
--- a/drivers/net/mlx5/mlx5_utils.h
+++ b/drivers/net/mlx5/mlx5_utils.h
@@ -21,16 +21,6 @@
 #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
-
 /* Convert a bit number to the corresponding 64-bit mask */
 #define MLX5_BITSHIFT(v) (UINT64_C(1) << (v))
 
diff --git a/lib/librte_eal/ppc/include/rte_memcpy.h b/lib/librte_eal/ppc/include/rte_memcpy.h
index 25311ba1d..abeede231 100644
--- a/lib/librte_eal/ppc/include/rte_memcpy.h
+++ b/lib/librte_eal/ppc/include/rte_memcpy.h
@@ -11,6 +11,10 @@
 /*To include altivec.h, GCC version must  >= 4.8 */
 #include <altivec.h>
 
+/* redefine as in stdbool.h after altivec.h */
+#undef bool
+#define bool _Bool
+
 #ifdef __cplusplus
 extern "C" {
 #endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] PPC64: fix boolean type conflict
  2020-04-28 16:52 [dpdk-dev] [PATCH] PPC64: fix boolean type conflict Thinh Tran
@ 2020-04-28 21:38 ` Thinh Tran
  0 siblings, 0 replies; 2+ messages in thread
From: Thinh Tran @ 2020-04-28 21:38 UTC (permalink / raw)
  To: dev; +Cc: drc, david.marchand, jerinjacobk, orika

Please, ignore this patch and pull the patches from Ori Kam and David 
Christensen
https://mails.dpdk.org/archives/dev/2020-April/165783.html

Thanks,
Thinh Tran

On 4/28/2020 11:52 AM, Thinh Tran wrote:
> The altivec.h on PPC64 breaks boolean type:
> 
> In file included from ../lib/librte_mempool/rte_mempool_trace_fp.h:18:0,
>                   from ../lib/librte_mempool/rte_mempool.h:54,
>                   from ../lib/librte_mbuf/rte_mbuf.h:38,
>                   from ../lib/librte_net/rte_ether.h:23,
>                   from ../drivers/common/mlx5/mlx5_nl.h:10,
>                   from ../drivers/common/mlx5/mlx5_nl.c:23:
> ../lib/librte_eal/include/rte_trace_point.h: In function
> ‘__rte_trace_point_fp_is_enabled’:
> ../lib/librte_eal/include/rte_trace_point.h:226:9: error: incompatible
> types when returning type ‘int’ but ‘__vector __bool int {aka
> __vector(4) __bool int}’ was expected
>    return false;
> 
> It needs to be redefinded as in the stdbool.h
> 
> 
> Signed-off-by: Thinh Tran <thinhtr@linux.vnet.ibm.com>
> ---
>   drivers/common/mlx5/mlx5_common.h       | 10 ----------
>   drivers/net/mlx4/mlx4_utils.h           | 10 ----------
>   drivers/net/mlx5/mlx5_utils.h           | 10 ----------
>   lib/librte_eal/ppc/include/rte_memcpy.h |  4 ++++
>   4 files changed, 4 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h
> index 16de1b397..c2d688a9b 100644
> --- a/drivers/common/mlx5/mlx5_common.h
> +++ b/drivers/common/mlx5/mlx5_common.h
> @@ -17,16 +17,6 @@
>   #include "mlx5_prm.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. */
>   #define BITFIELD_DECLARE(bf, type, size) \
>   	type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \
> diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
> index b8769562a..095958f3d 100644
> --- a/drivers/net/mlx4/mlx4_utils.h
> +++ b/drivers/net/mlx4/mlx4_utils.h
> @@ -14,16 +14,6 @@
> 
>   #include "mlx4.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
> -
>   extern int mlx4_logtype;
> 
>   #ifdef RTE_LIBRTE_MLX4_DEBUG
> diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
> index d81ace394..0e016f87c 100644
> --- a/drivers/net/mlx5/mlx5_utils.h
> +++ b/drivers/net/mlx5/mlx5_utils.h
> @@ -21,16 +21,6 @@
>   #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
> -
>   /* Convert a bit number to the corresponding 64-bit mask */
>   #define MLX5_BITSHIFT(v) (UINT64_C(1) << (v))
> 
> diff --git a/lib/librte_eal/ppc/include/rte_memcpy.h b/lib/librte_eal/ppc/include/rte_memcpy.h
> index 25311ba1d..abeede231 100644
> --- a/lib/librte_eal/ppc/include/rte_memcpy.h
> +++ b/lib/librte_eal/ppc/include/rte_memcpy.h
> @@ -11,6 +11,10 @@
>   /*To include altivec.h, GCC version must  >= 4.8 */
>   #include <altivec.h>
> 
> +/* redefine as in stdbool.h after altivec.h */
> +#undef bool
> +#define bool _Bool
> +
>   #ifdef __cplusplus
>   extern "C" {
>   #endif
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-28 21:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 16:52 [dpdk-dev] [PATCH] PPC64: fix boolean type conflict Thinh Tran
2020-04-28 21:38 ` Thinh Tran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).