DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: christian.ehrhardt@canonical.com, adrien.mazarguil@6wind.com,
	shahafs@mellanox.com, yskoh@mellanox.com,
	gowrishankar.m@linux.vnet.ibm.com, chaozhu@linux.vnet.ibm.com,
	pradeep@us.ibm.com, tyos@jp.ibm.com, dwilder@us.ibm.com
Subject: [dpdk-dev] [PATCH] net/mlx5: fix build on PPC64
Date: Wed,  7 Nov 2018 17:00:28 +0100	[thread overview]
Message-ID: <20181107160028.5938-1-thomas@monjalon.net> (raw)
In-Reply-To: <20180903092911.GU3695@6wind.com>

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>
---
 drivers/net/mlx5/mlx5_utils.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h
index 886f60e61..97092c749 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
+#endif
+
 /* Bit-field manipulation. */
 #define BITFIELD_DECLARE(bf, type, size) \
 	type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \
-- 
2.19.0

  parent reply	other threads:[~2018-11-07 16:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 11:59 [dpdk-dev] [PATCH v3] ppc64: fix compilation of when AltiVec is enabled Christian Ehrhardt
2018-08-31  1:48 ` Chao Zhu
2018-08-31  5:14   ` Christian Ehrhardt
2018-08-31  7:59     ` Chao Zhu
2018-09-03  9:29 ` Adrien Mazarguil
2018-11-05 14:25   ` Thomas Monjalon
2018-11-07 16:00   ` Thomas Monjalon [this message]
2018-11-07 19:05     ` [dpdk-dev] [PATCH] net/mlx5: fix build on PPC64 dwilder
2018-11-07 21:10       ` Thomas Monjalon
2018-11-08  8:25         ` Shahaf Shuler
2018-11-08  9:46     ` ´ð¸´: " Chao Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181107160028.5938-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=adrien.mazarguil@6wind.com \
    --cc=chaozhu@linux.vnet.ibm.com \
    --cc=christian.ehrhardt@canonical.com \
    --cc=dev@dpdk.org \
    --cc=dwilder@us.ibm.com \
    --cc=gowrishankar.m@linux.vnet.ibm.com \
    --cc=pradeep@us.ibm.com \
    --cc=shahafs@mellanox.com \
    --cc=tyos@jp.ibm.com \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).