From patchwork Fri Mar 11 20:05:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 108689 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1824A00C2; Fri, 11 Mar 2022 21:05:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B465410E3; Fri, 11 Mar 2022 21:05:33 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id BCAFB40042 for ; Fri, 11 Mar 2022 21:05:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647029131; x=1678565131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jFRXPdP/8jvyYISRZhP0tiyBcdEdegq01z72taF5xOk=; b=cwuIbs3/mNsg8z8Qx5HZ+bWHLu9EbExzJAKA26UV/tLHKVaUB9ba7xPm jn6go/okbHKahaM/T3QoqZxoQsFWei8M6P+n2zfzhoDCZNmaQnxwEK9u7 +L0opl11jg1oFqqlZZ95lCtVK2Zi99Ce/KR4bgzawK5+MWRfHA1i4jF80 N4lrJBicIlr7PxXg7RBHJB+ZbFVoFmvApS/M+6Z+FTEzM/PY8PpwJt86m 5C/sljI2/e61FMl8dYnt7pORj8dGUG5Rs1lJnHpv0aKBjXWvD+4qB4mBU sT5tf1y4oSZr3c/yttXllg89K7Q2lgqTpht4zywCApsN3biDcqTXI3pMB Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="253207381" X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="253207381" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 12:05:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="555444777" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2022 12:05:28 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 1/5] eal/freebsd: add missing C++ include guards Date: Fri, 11 Mar 2022 20:05:19 +0000 Message-Id: <20220311200523.1020050-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220311200523.1020050-1-bruce.richardson@intel.com> References: <20220311200523.1020050-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add mising 'extern "C"' to file. Fixes: 428eb983f5f7 ("eal: add OS specific header file") Signed-off-by: Bruce Richardson --- lib/eal/freebsd/include/rte_os.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/eal/freebsd/include/rte_os.h b/lib/eal/freebsd/include/rte_os.h index 9d8a69008c..b4afd45adc 100644 --- a/lib/eal/freebsd/include/rte_os.h +++ b/lib/eal/freebsd/include/rte_os.h @@ -5,6 +5,10 @@ #ifndef _RTE_OS_H_ #define _RTE_OS_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** * This header should contain any definition * which is not supported natively or named differently in FreeBSD. @@ -59,4 +63,8 @@ typedef cpuset_t rte_cpuset_t; } while (0) #endif +#ifdef __cplusplus +} +#endif + #endif /* _RTE_OS_H_ */ From patchwork Fri Mar 11 20:05:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 108690 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9C135A00C2; Fri, 11 Mar 2022 21:05:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A5CF41142; Fri, 11 Mar 2022 21:05:34 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id D3D1440140 for ; Fri, 11 Mar 2022 21:05:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647029131; x=1678565131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q4BdbAJPlt6tJGOijrvpgKnwvlGLvWrlZ+qmqacwrD8=; b=O2PemgQO0p/jLHolKbLi3oIJbDnAAmDSGrk+T20Ph+7mDhFxBbrTeMnA GVpokAyBkssXYwfOC/WI5xaH9uu7Z3pIoljWozpBqmpS4jtKc5OFS3/6j ACyQvVMutYqUSWlOyGHSgVhx/tVIk0aYQyGplR+17K+yWXDpJzOG/jjfZ YooE0ZykhwqSgsA1W3aRc8/p0oRQkBMEAP8NP8xGudaTeqoUdyJNKhbcG MNSWTtdMf2MHMFYQ4lz+ctm2azvrr6yTsNGmMtywySC0JR+QGJsgBYilj BdBLiBLf564vgUb3xM2z2oAldg1vOCDqge6JkYceqC5X2Fp7QMk7JqrOV g==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="253207383" X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="253207383" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 12:05:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="555444782" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2022 12:05:29 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 2/5] compressdev: separate out driver-only headers Date: Fri, 11 Mar 2022 20:05:20 +0000 Message-Id: <20220311200523.1020050-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220311200523.1020050-1-bruce.richardson@intel.com> References: <20220311200523.1020050-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The headers rte_compressdev_pmd.h and rte_compressdev_internal.h are, as the filenames suggest, headers for building drivers using the compressdev APIs. As such they should be marked as "driver_sdk_headers" rather than just "headers" in the meson.build file. Signed-off-by: Bruce Richardson --- lib/compressdev/meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/compressdev/meson.build b/lib/compressdev/meson.build index 75ea666a9b..c80295dc0d 100644 --- a/lib/compressdev/meson.build +++ b/lib/compressdev/meson.build @@ -11,7 +11,9 @@ sources = files('rte_compressdev.c', 'rte_compressdev_pmd.c', 'rte_comp.c') headers = files('rte_compressdev.h', - 'rte_compressdev_pmd.h', - 'rte_compressdev_internal.h', 'rte_comp.h') +driver_sdk_headers = files( + 'rte_compressdev_pmd.h', + 'rte_compressdev_internal.h', + ) deps += ['kvargs', 'mbuf'] From patchwork Fri Mar 11 20:05:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 108691 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB78BA00C2; Fri, 11 Mar 2022 21:05:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EA5141152; Fri, 11 Mar 2022 21:05:35 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 8C74440E78 for ; Fri, 11 Mar 2022 21:05:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647029133; x=1678565133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H3irUj6K9PAXOP0xBNIrOvdMfK1OACIJkABNXOM0o4c=; b=QFn1zXXFPVGw4T0RiPVJUq3tKTQWuUwzjIS+lH8c+okYtyETjs9lroIN LX2s3tbFzh2IjOFsHUnmYJuYn/aht6Z3zqIrYFHT+sxEDGM/pr7vLRKXj ihbcPdcZA01cKcKTTUFDRT9j+eE+GhBSxYWXZWY2D2iGVJWFsGv2I3KlH E9mSbBfUdT0at68rLWAzcnl46IQviO6vj9uldB7j+QJD6HgqOKN3Ks4yv CTGyr0kV0eNnnQ0GbqwrTSu7SkZkPcf2TB/kbSpxcL5cRYmAVEONXCJAm NNxUDQSjn4Armh9YiqOt3piaI5tHlMOBhLfXYI0bMyd9KFy9E3yK54UII w==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="253207386" X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="253207386" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 12:05:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="555444793" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2022 12:05:30 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , fiona.trahe@intel.com Subject: [PATCH 3/5] compressdev: fix missing space in header Date: Fri, 11 Mar 2022 20:05:21 +0000 Message-Id: <20220311200523.1020050-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220311200523.1020050-1-bruce.richardson@intel.com> References: <20220311200523.1020050-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Building with clang on FreeBSD with chkincs enabled, we get the following error about a missing space: ../lib/compressdev/rte_compressdev_internal.h:25:58: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): "fmt "\n", \ Adding in a space between the '"' and 'fmt' removes the error. Fixes: ed7dd94f7f66 ("compressdev: add basic device management") Cc: fiona.trahe@intel.com Signed-off-by: Bruce Richardson --- lib/compressdev/rte_compressdev_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h index 25d8afbfb9..b3b193e3ee 100644 --- a/lib/compressdev/rte_compressdev_internal.h +++ b/lib/compressdev/rte_compressdev_internal.h @@ -22,7 +22,7 @@ extern "C" { /* Logging Macros */ extern int compressdev_logtype; #define COMPRESSDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): "fmt "\n", \ + rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): " fmt "\n", \ __func__, ##args) /** From patchwork Fri Mar 11 20:05:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 108692 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1864A00C2; Fri, 11 Mar 2022 21:05:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5B0641157; Fri, 11 Mar 2022 21:05:35 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 74E264113F for ; Fri, 11 Mar 2022 21:05:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647029133; x=1678565133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FBNRTzyW5M7IHTT3uyXdRSBDi9ySjMthASS/jRoc8is=; b=FUic4bqJl5pvOSCeYtS5cOJdkY/X5rKzn9XPZ2t9EsBjENfcrryHcRDr sX0gGbhkToAlpDQUj7wh5a3fTx6AAWj5dKSO7wi+p587/dGq4MDR8+m7/ 6OVvBg5Pk7Zc7V4UndkykOnPLN1O1TICHJ2GkFzGI9FGUA6sjcwUixV5V ra0Xw9hgpWjaoGtxc3eFXgwzZlCOZzHashbtMgcRJf9AE7uPR7AO33Joz vg3o3lFNyV87z0WIQt/gg8gzq5Ehe5aE27MYEC4y1I/BYPHqSjQaqi6QG iSw1J6ebb/j8kBGUHI55B+YanHhJ4mCfjPCn3/mgrDXJEVJI4z4u46nvq Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="253207390" X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="253207390" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 12:05:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="555444801" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2022 12:05:31 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , pablo.de.lara.guarch@intel.com, declan.doherty@intel.com Subject: [PATCH 4/5] cryptodev: fix compilation with clang C++ builds Date: Fri, 11 Mar 2022 20:05:22 +0000 Message-Id: <20220311200523.1020050-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220311200523.1020050-1-bruce.richardson@intel.com> References: <20220311200523.1020050-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When compiling on FreeBSD with clang and include checking enabled, errors are emitted due to differences in how empty structs/unions are handled in C and C++, as C++ structs cannot have zero size. ../lib/cryptodev/rte_crypto.h:127:2: error: union has size 0 in C, non-zero size in C++ Since the contents of the union are all themselves of zero size, the actual union wrapper is unnecessary. We therefore remove it for C++ builds - though keep it for C builds for safety and clarity of understanding the code. Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented") Fixes: d2a4223c4c6d ("cryptodev: do not store pointer to op specific params") Cc: pablo.de.lara.guarch@intel.com Cc: declan.doherty@intel.com Signed-off-by: Bruce Richardson --- lib/cryptodev/rte_crypto.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/cryptodev/rte_crypto.h b/lib/cryptodev/rte_crypto.h index a864f5036f..aeb3bf6e38 100644 --- a/lib/cryptodev/rte_crypto.h +++ b/lib/cryptodev/rte_crypto.h @@ -123,15 +123,24 @@ struct rte_crypto_op { rte_iova_t phys_addr; /**< physical address of crypto operation */ +/* empty structures do not have zero size in C++ leading to compilation errors + * with clang about structure/union having different sizes in C and C++. + * While things are clearer with an explicit union, since each field is + * zero-sized it's not actually needed, so omit it for C++ + */ +#ifndef __cplusplus __extension__ union { +#endif struct rte_crypto_sym_op sym[0]; /**< Symmetric operation parameters */ struct rte_crypto_asym_op asym[0]; /**< Asymmetric operation parameters */ +#ifndef __cplusplus }; /**< operation specific parameters */ +#endif }; /** From patchwork Fri Mar 11 20:05:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 108693 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A8F71A00C2; Fri, 11 Mar 2022 21:06:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B59F84115E; Fri, 11 Mar 2022 21:05:36 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id D86E24114A for ; Fri, 11 Mar 2022 21:05:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647029135; x=1678565135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rkEOuJ9bQgqhm/yaulgivKJr9q8nJf+LnBHWGoYzgqY=; b=gEm3OmjoJHkOvMMZHAXyd0SKF9fhNvnNfFGuDD21ccU8ycrQG6H+SidF N0AdLxFxW41La3Ui/QUhuUT/rzk2VI3c1eaWFXRkmkBZj/0ttZZw+5A7h VRD/hYCNWxSmJhA/3Ck4KD8dwRo2WBK4T4zdJThHMG1Jc+usYRtprTdbf n9OLFyw0fFeXXEaehUsX0t0YJ4KcWuwK4+jow7j2fZldUxBwb1nF0fjOB ir21ZQ1oeTRCkEzesYltJIihrtD29Md3614jph15L6t5ZjwLH2sintcRx DIP1g/E8Ngjlf4AyiyTz+wjTleNa7OijTb0iXtqwHJeVl+M89w4kw9toO A==; X-IronPort-AV: E=McAfee;i="6200,9189,10283"; a="253207394" X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="253207394" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2022 12:05:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,174,1643702400"; d="scan'208";a="555444806" Received: from silpixa00399126.ir.intel.com ([10.237.223.34]) by orsmga008.jf.intel.com with ESMTP; 11 Mar 2022 12:05:32 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , pbhagavatula@marvell.com Subject: [PATCH 5/5] eventdev: fix compilation with clang C++ builds Date: Fri, 11 Mar 2022 20:05:23 +0000 Message-Id: <20220311200523.1020050-6-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220311200523.1020050-1-bruce.richardson@intel.com> References: <20220311200523.1020050-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When compiling on FreeBSD with clang and include checking enabled, errors are emitted due to differences in how empty structs/unions are handled in C and C++, as C++ structs cannot have zero size. ../lib/eventdev/rte_eventdev.h:992:2: error: union has size 0 in C, non-zero size in C++ Since the contents of the union are all themselves of zero size, the actual union wrapper is unnecessary. We therefore remove it for C++ builds - though keep it for C builds for safety and clarity of understanding the code. The alignment constraint on the union is unnecessary in the case where the whole struct is aligned on a 16-byte boundary, so we add that constraint to the overall structure to ensure it applies for C++ code as well as C. Fixes: 1cc44d409271 ("eventdev: introduce event vector capability") Cc: pbhagavatula@marvell.com Signed-off-by: Bruce Richardson --- lib/eventdev/rte_eventdev.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index 67c4a5e036..42a5660169 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -984,21 +984,31 @@ struct rte_event_vector { }; /**< Union to hold common attributes of the vector array. */ uint64_t impl_opaque; + +/* empty structures do not have zero size in C++ leading to compilation errors + * with clang about structure having different sizes in C and C++. + * Since these are all zero-sized arrays, we can omit the "union" wrapper for + * C++ builds, removing the warning. + */ +#ifndef __cplusplus /**< Implementation specific opaque value. * An implementation may use this field to hold implementation specific * value to share between dequeue and enqueue operation. * The application should not modify this field. */ union { +#endif struct rte_mbuf *mbufs[0]; void *ptrs[0]; uint64_t *u64s[0]; +#ifndef __cplusplus } __rte_aligned(16); +#endif /**< Start of the vector array union. Depending upon the event type the * vector array can be an array of mbufs or pointers or opaque u64 * values. */ -}; +} __rte_aligned(16); /* Scheduler type definitions */ #define RTE_SCHED_TYPE_ORDERED 0