From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Transfer-Encoding: 8bit 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 }; /** -- 2.34.1