From patchwork Wed Jul 1 17:32:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Sanford, Robert" X-Patchwork-Id: 6002 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 55FDB593A; Wed, 1 Jul 2015 19:32:57 +0200 (CEST) Received: from prod-mail-xrelay08.akamai.com (prod-mail-xrelay08.akamai.com [96.6.114.112]) by dpdk.org (Postfix) with ESMTP id C43655927 for ; Wed, 1 Jul 2015 19:32:55 +0200 (CEST) Received: from prod-mail-xrelay08.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id 067C74BC8C; Wed, 1 Jul 2015 17:32:55 +0000 (GMT) Received: from prod-mail-relay09.akamai.com (prod-mail-relay09.akamai.com [172.27.22.68]) by prod-mail-xrelay08.akamai.com (Postfix) with ESMTP id E1C024BC8E; Wed, 1 Jul 2015 17:32:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=akamai.com; s=a1; t=1435771974; bh=7tJ96t3OhiSbI+/zs26GTdhZWrbuvAYWi90ApQRS3qs=; h=From:To:Subject:Date:References:In-Reply-To:From; b=pZIOas7wYv8MVDHdoGV1eKwtR/XahU2vg+x/TtEG7JmgrhgZ3HDNCgA5AFP9oQ3Yh 21c4mcUVGC7t54zDHKF4kMWYQrBqxJH5sWRsI86TRiK2y+OjdCeeizWcjsr7VnWOcH w6gR8BqN1cIV05eEUIl8Al60tnRmc3ktdtnvv5MU= Received: from email.msg.corp.akamai.com (ustx2ex-cas1.msg.corp.akamai.com [172.27.25.30]) by prod-mail-relay09.akamai.com (Postfix) with ESMTP id DF29D1E07C; Wed, 1 Jul 2015 17:32:54 +0000 (GMT) Received: from USTX2EX-DAG1MB3.msg.corp.akamai.com (172.27.27.103) by ustx2ex-dag1mb3.msg.corp.akamai.com (172.27.27.103) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Wed, 1 Jul 2015 12:32:54 -0500 Received: from USTX2EX-DAG1MB3.msg.corp.akamai.com ([172.27.27.103]) by ustx2ex-dag1mb3.msg.corp.akamai.com ([172.27.27.103]) with mapi id 15.00.1076.000; Wed, 1 Jul 2015 12:32:54 -0500 From: "Sanford, Robert" To: Dirk-Holger Lenz , "dev@dpdk.org" Thread-Topic: [dpdk-dev] g++ applications doesn't compile anymore when dpdk header files are included Thread-Index: AQHQtBvAhz0DjbCkx0ufu80oV7MAuZ3G8HEA Date: Wed, 1 Jul 2015 17:32:54 +0000 Message-ID: References: <55941678.3000806@ng4t.com> In-Reply-To: <55941678.3000806@ng4t.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.3.140616 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.19.133.165] MIME-Version: 1.0 Subject: Re: [dpdk-dev] g++ applications doesn't compile anymore when dpdk header files are included X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello Dirk, We recently resolved a similar problem with rte_cpuflags.h. I'm attaching a git-diff of how we worked around it. We may submit a patch for this, eventually. --- Regards, Robert >Hello, >the g++ complains the following problems when rte_xxxx.h header files >are included: > ....x86_64-native-linuxapp-gcc/include/rte_common.h:95:59: warning: >invalid conversion from Œvoid*¹ to Œrte_mempool_objhdr*¹.... this >appears in multiple flavours > -as a workaround the '-fpermissive' option of the g++ may be used but >that's not nice. >....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:50:6: >error: use of enum Œrte_cpu_flag_t¹ without previous declaration enum >rte_cpu_flag_t; > ....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:55:6: >error: use of enum Œcpu_register_t¹ without previous declaration > enum cpu_register_t; >....x86_64-native-linuxapp-gcc/include/generic/rte_cpuflags.h:104:31: >error: use of enum Œrte_cpu_flag_t¹ without previous declaration >rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); > -as a workaround the file >'lib/librte_eal/common/include/generic/rte_cpuflags.h' may be modified: > remove or uncomment the following lines: > line 50: //enum rte_cpu_flag_t; > line 55: //enum cpu_register_t; > lines 103/104: //static inline int > //rte_cpu_get_flag_enabled(enum >rte_cpu_flag_t feature); > >Best regards >Dirk >-- >Dirk-Holger Lenz >+49 157 848 09099 >dirk.lenz@ng4t.com > ng 4 T Telecommunication >Technology >Testing >Tools > > >ng4T GmbH >Siemensdamm 50 >13629 Berlin >Germany >www.ng4t.com >+49 30 65218530 > >Berlin-Charlottenburg, HRB 123546 >CEO Dr. Andreas Kallmann diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index 6fd360c..07c1e7b 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -30,6 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define RTE_INSTANTIATE_CPU_FEATURES 1 #include /* @@ -78,7 +79,7 @@ rte_cpu_check_supported(void) fprintf(stderr, "ERROR: This system does not support \"%s\".\n" "Please check that RTE_MACHINE is set correctly.\n", - cpu_feature_table[compile_time_flags[i]].name); + rte_cpu_feature_table[compile_time_flags[i]].name); exit(1); } } diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h index df45047..3dfa6d2 100644 --- a/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cpuflags.h @@ -42,8 +42,6 @@ extern "C" { #include #include -#include "generic/rte_cpuflags.h" - /* Symbolic values for the entries in the auxiliary table */ #define AT_HWCAP 16 #define AT_HWCAP2 26 @@ -96,7 +94,10 @@ enum rte_cpu_flag_t { RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */ }; -static const struct feature_entry cpu_feature_table[] = { +#include "generic/rte_cpuflags.h" + +#ifdef RTE_INSTANTIATE_CPU_FEATURES +const struct feature_entry rte_cpu_feature_table[] = { FEAT_DEF(PPC_LE, 0x00000001, 0, REG_HWCAP, 0) FEAT_DEF(TRUE_LE, 0x00000001, 0, REG_HWCAP, 1) FEAT_DEF(PSERIES_PERFMON_COMPAT, 0x00000001, 0, REG_HWCAP, 6) @@ -132,6 +133,7 @@ static const struct feature_entry cpu_feature_table[] = { FEAT_DEF(HTM, 0x00000001, 0, REG_HWCAP2, 30) FEAT_DEF(ARCH_2_07, 0x00000001, 0, REG_HWCAP2, 31) }; +#endif /* * Read AUXV software register and get cpu features for Power @@ -167,7 +169,7 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) /* Flag does not match anything in the feature tables */ return -ENOENT; - feat = &cpu_feature_table[feature]; + feat = &rte_cpu_feature_table[feature]; if (!feat->leaf) /* This entry in the table wasn't filled out! */ diff --git a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h index dd56553..a4a8d19 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h +++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h @@ -43,8 +43,6 @@ extern "C" { #include #include -#include "generic/rte_cpuflags.h" - enum rte_cpu_flag_t { /* (EAX 01h) ECX features*/ RTE_CPUFLAG_SSE3 = 0, /**< SSE3 */ @@ -157,7 +155,10 @@ enum cpu_register_t { RTE_REG_EDX, }; -static const struct feature_entry cpu_feature_table[] = { +#include "generic/rte_cpuflags.h" + +#ifdef RTE_INSTANTIATE_CPU_FEATURES +const struct feature_entry rte_cpu_feature_table[] = { FEAT_DEF(SSE3, 0x00000001, 0, RTE_REG_ECX, 0) FEAT_DEF(PCLMULQDQ, 0x00000001, 0, RTE_REG_ECX, 1) FEAT_DEF(DTES64, 0x00000001, 0, RTE_REG_ECX, 2) @@ -250,6 +251,7 @@ static const struct feature_entry cpu_feature_table[] = { FEAT_DEF(INVTSC, 0x80000007, 0, RTE_REG_EDX, 8) }; +#endif static inline void rte_cpu_get_features(uint32_t leaf, uint32_t subleaf, cpuid_registers_t out) @@ -285,7 +287,7 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) /* Flag does not match anything in the feature tables */ return -ENOENT; - feat = &cpu_feature_table[feature]; + feat = &rte_cpu_feature_table[feature]; if (!feat->leaf) /* This entry in the table wasn't filled out! */ diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h index a04e021..760539f 100644 --- a/lib/librte_eal/common/include/generic/rte_cpuflags.h +++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h @@ -39,6 +39,10 @@ * Architecture specific API to determine available CPU features at runtime. */ +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -75,7 +79,7 @@ struct feature_entry { /** * An array that holds feature entries */ -static const struct feature_entry cpu_feature_table[]; +extern const struct feature_entry rte_cpu_feature_table[]; /** * Execute CPUID instruction and get contents of a specific register @@ -107,4 +111,8 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); void rte_cpu_check_supported(void); +#ifdef __cplusplus +} +#endif + #endif /* _RTE_CPUFLAGS_H_ */