From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com
 [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id B6E7E14EC
 for <dev@dpdk.org>; Wed,  7 Nov 2018 17:02:28 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 533E122213;
 Wed,  7 Nov 2018 11:02:28 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Wed, 07 Nov 2018 11:02:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding; s=mesmtp; bh=WaGVWJCFhy
 6H3bldohuHB3JzjPdchlwfObv03uI5y0s=; b=INaabyNa24r1WmMfmcSUnSLYh1
 n84vRk7ArhBP3aMPVG+FiUlVAYKkBt2kgvWeo5I6QS4vyJttAIpJQQImLNl9x470
 iSVF8ttoVRle9CVxCq65Yxz0Ff4LqLA2hRJdQnKHorIeDHDcA+E3J/Hdwjqk5dyf
 5Surm0PA0vg60Bt1Q=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:date:from
 :in-reply-to:message-id:mime-version:references:subject:to
 :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm1; bh=WaGVWJCFhy6H3bldohuHB3JzjPdchlwfObv03uI5y0s=; b=Xnr622oU
 L+8/uUf73Ocu6lzGvj4v6KQHgEJ1raz9TWBWQs2Y6r/Q39WdlG4/T6RtHnFKyYKE
 G/fhUpiPuT1aNa6zeKnfJ0Utsln/4RWmdow6D4znLYe9DpxsBZOPs2zJz/gLAcM7
 2Ji0li3ZXL4cfGxP9C+ieGXfoAaTkhvZhTa85z+eZ2Yd9Ie7lUvKmOtDHkl/k1Z1
 nWk7iYv+rP3NZCuiB3bQa1veSEZA2tnqlZPLx6p5lGnNSUkNbjWtA6rARkowR90S
 VXKq4N2Bg+d1Vxl5nEhsXOdyO7hpuxJZ/UyCwc1zlDQVldEwnAbWTwFOeRBG0caf
 WkinCOgJRZyZLw==
X-ME-Sender: <xms:kwzjW_VTppTR9sXPhED6LxdL5hwUoYr5J7Jh9RM-xnnTXuQHV1KC8A>
X-ME-Proxy: <xmx:kwzjW_U0A8ACAXSj85LlU0_7lETeWdz2xKMn9EITDZfJ3ShVxfm-RQ>
 <xmx:kwzjW9GgLJNy-OQwLqIpM0d8xVby0LwHlYRKehblc_7B9lt9y949Sg>
 <xmx:kwzjW-GoqlupumxbcxnLLwNzy-GIy_YM0WG3skGFgwKe8dwThgovmA>
 <xmx:kwzjW3uN_ijDjJYkt96jEVEZRp1BxygglydBrowgBmjRqTUVE9HL5Q>
 <xmx:kwzjW0P1cDulWOF76kv1WVkJcom82VcXzxacujtJFi_jZVREAKCh1g>
 <xmx:lAzjW4o37b-0TI01fhzBaRU1BHbeFy-lOpQ4m6l_hpenEbA9Pu0VUw>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id C5939102E8;
 Wed,  7 Nov 2018 11:02:25 -0500 (EST)
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
Date: Wed,  7 Nov 2018 17:00:28 +0100
Message-Id: <20181107160028.5938-1-thomas@monjalon.net>
X-Mailer: git-send-email 2.19.0
In-Reply-To: <20180903092911.GU3695@6wind.com>
References: <20180903092911.GU3695@6wind.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH] net/mlx5: fix build on PPC64
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 07 Nov 2018 16:02:29 -0000

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