From patchwork Thu Apr 6 00:45:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 125832 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 A3F74428D0; Thu, 6 Apr 2023 02:45:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEC2242D31; Thu, 6 Apr 2023 02:45:28 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E9C3542B8E for ; Thu, 6 Apr 2023 02:45:22 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 696AD210DEFF; Wed, 5 Apr 2023 17:45:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 696AD210DEFF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680741921; bh=suk611O6Ad/NaeKVpu2g21DUajOcYEmDmeCZxDkH9Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEgPU7Vbeh3At7LaQTyBVh2kRDV+/QGFbVZxSYXzADFnxk6O7b/bmurOHHscMqIrd 6nC7+WHf4sAmCunmPBnK++hB0Iw7IJTWYUX+tlLJKR28FymtIaSWKCKUYb1yFbcVrN MiBdpOZ2/VkuXzbZWLRTr3IQqE9skgGMiDwtvHsE= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v3 06/11] eal: typedef cpu flag enum as int for msvc Date: Wed, 5 Apr 2023 17:45:14 -0700 Message-Id: <1680741919-22102-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1680741919-22102-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1680741919-22102-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 Forward declaration of a typedef is a non-standard extension and is not supported by msvc. Use an int instead. Abstract the use of the int/enum rte_cpu_flag_t in function parameter lists by re-typdefing the enum rte_cpu_flag_t to the rte_cpu_flag_t identifier. Remove the use of __extension__ on function prototypes where rte_cpu_flag_t appeared in parameter lists, it is sufficient to have the conditionally compiled __extension__ at the non-standard forward declaration site. Signed-off-by: Tyler Retzlaff --- lib/eal/include/generic/rte_cpuflags.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/eal/include/generic/rte_cpuflags.h b/lib/eal/include/generic/rte_cpuflags.h index d35551e..87ab03c 100644 --- a/lib/eal/include/generic/rte_cpuflags.h +++ b/lib/eal/include/generic/rte_cpuflags.h @@ -44,8 +44,12 @@ struct rte_cpu_intrinsics { /** * Enumeration of all CPU features supported */ +#ifndef RTE_TOOLCHAIN_MSVC __extension__ -enum rte_cpu_flag_t; +typedef enum rte_cpu_flag_t rte_cpu_flag_t; +#else +typedef int rte_cpu_flag_t; +#endif /** * Get name of CPU flag @@ -56,9 +60,8 @@ struct rte_cpu_intrinsics { * flag name * NULL if flag ID is invalid */ -__extension__ const char * -rte_cpu_get_flag_name(enum rte_cpu_flag_t feature); +rte_cpu_get_flag_name(rte_cpu_flag_t feature); /** * Function for checking a CPU flag availability @@ -70,9 +73,8 @@ struct rte_cpu_intrinsics { * 0 if flag is not available * -ENOENT if flag is invalid */ -__extension__ int -rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); +rte_cpu_get_flag_enabled(rte_cpu_flag_t feature); /** * This function checks that the currently used CPU supports the CPU features