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 9776F43D5B; Thu, 28 Mar 2024 00:09:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D6AB40EE3; Thu, 28 Mar 2024 00:09:22 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1E696402E7 for ; Thu, 28 Mar 2024 00:09:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 32E0D20E67D1; Wed, 27 Mar 2024 16:09:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 32E0D20E67D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711580959; bh=Voq+F+SyxuZBC+ZYqhgF2Bm6b+40Msje8TCyGJ0TmoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mcrfeaeo7BSIpxaLoIDQETGt6pTR9Fg5vdneqqRqaeGcSWHpSdz+R8oMrFZ3B7BVA OwGc4GY6jBpDT7ewipMV7ghxSOC22pCc/HB/H31H43d+99yDralmEWUrjlX+c3jUGA S76/kCPnkgji0OIKFgzB9Aj6Rne8dJU+83d8dCeg= From: Tyler Retzlaff To: dev@dpdk.org Cc: Akhil Goyal , Aman Singh , Anatoly Burakov , Bruce Richardson , Byron Marohn , Conor Walsh , Cristian Dumitrescu , Dariusz Sosnowski , David Hunt , Jerin Jacob , Jingjing Wu , Kirill Rybalchenko , Konstantin Ananyev , Matan Azrad , Ori Kam , Radu Nicolau , Ruifeng Wang , Sameh Gobriel , Sivaprasad Tummala , Suanming Mou , Sunil Kumar Kori , Vamsi Attunuru , Viacheslav Ovsiienko , Vladimir Medvedkin , Yipeng Wang , Yuying Zhang , Yuying Zhang , Tyler Retzlaff Subject: [PATCH v2 01/15] eal: provide pack start macro for MSVC Date: Wed, 27 Mar 2024 16:09:04 -0700 Message-Id: <1711580958-20808-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711580958-20808-1-git-send-email-roretzla@linux.microsoft.com> References: <1710968771-16435-1-git-send-email-roretzla@linux.microsoft.com> <1711580958-20808-1-git-send-email-roretzla@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 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 298a5c6..44825ed 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -97,8 +97,10 @@ * 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 -- 1.8.3.1