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 25D6045D3C; Tue, 19 Nov 2024 05:36:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC6D440E1D; Tue, 19 Nov 2024 05:36:18 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 571D6406B8 for ; Tue, 19 Nov 2024 05:36:15 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id 5EA6720BEBD3; Mon, 18 Nov 2024 20:36:14 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5EA6720BEBD3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1731990974; bh=zlostFFDnI34frNeTgae8A2/egDX3dXq+jYlzKgj2oU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ocLL6lWPjgSOuXi2ymv+HwIv4OL/yqvaYEirViwoGyhysrItG/X3Ri2wjY2wGOKrH 33H69kC4KzRcq38deXLUio6A/i4rgMxye/qiuu4lF39527QAc1Ql0xSzj09dPC+sPd ZbVEa+N6e76C7eC3VI3uVCAcuWrTvOk6yJGtWqzE= From: Andre Muezerie To: roretzla@linux.microsoft.com Cc: Yuying.Zhang@intel.com, aman.deep.singh@intel.com, anatoly.burakov@intel.com, bruce.richardson@intel.com, byron.marohn@intel.com, conor.walsh@intel.com, cristian.dumitrescu@intel.com, david.hunt@intel.com, dev@dpdk.org, dsosnowski@nvidia.com, gakhil@marvell.com, jerinj@marvell.com, jingjing.wu@intel.com, kirill.rybalchenko@intel.com, konstantin.v.ananyev@yandex.ru, matan@nvidia.com, orika@nvidia.com, radu.nicolau@intel.com, ruifeng.wang@arm.com, sameh.gobriel@intel.com, sivaprasad.tummala@amd.com, skori@marvell.com, stephen@networkplumber.org, suanmingm@nvidia.com, vattunuru@marvell.com, viacheslavo@nvidia.com, vladimir.medvedkin@intel.com, yipeng1.wang@intel.com Subject: [PATCH v5 01/16] eal: provide pack start macro for MSVC Date: Mon, 18 Nov 2024 20:35:26 -0800 Message-Id: <1731990941-10001-2-git-send-email-andremue@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1731990941-10001-1-git-send-email-andremue@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1731990941-10001-1-git-send-email-andremue@linux.microsoft.com> 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 From: Tyler Retzlaff MSVC struct packing is not compatible with GCC. Provide a macro that can be used to push existing pack value and sets packing to 1-byte. The existing __rte_packed macro is then used to restore the pack value prior to the push. Instead of providing macros exclusively for MSVC and for GCC the existing macro is deliberately utilized to trigger a warning if no existing packing has been pushed allowing easy identification of locations where the __rte_msvc_pack is missing. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 4d299f2b36..409890863e 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -103,8 +103,10 @@ typedef uint16_t unaligned_uint16_t; * Force a structure to be packed */ #ifdef RTE_TOOLCHAIN_MSVC -#define __rte_packed +#define __rte_msvc_pack __pragma(pack(push, 1)) +#define __rte_packed __pragma(pack(pop)) #else +#define __rte_msvc_pack #define __rte_packed __attribute__((__packed__)) #endif -- 2.47.0.vfs.0.3