From: Joongi Kim Date: Fri, 3 Jul 2015 12:51:03 +0000 (+0900) Subject: eal: fix C++ app build X-Git-Tag: spdx-start~8508 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=621389bbbe08;p=dpdk.git eal: fix C++ app build * Forward declaration of enum in C++ requires explicit underlying type definitions. * This fixes the issue at: http://dpdk.org/ml/archives/dev/2015-April/017065.html include/generic/rte_cpuflags.h:50:6: error: use of enum ‘rte_cpu_flag_t’ without previous declaration enum rte_cpu_flag_t; include/generic/rte_cpuflags.h:55:6: error: use of enum ‘cpu_register_t’ without previous declaration enum cpu_register_t; Signed-off-by: Joongi Kim [Thomas: fix extended to ppc and tile] --- 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 df45047037..f1cfc4f6f3 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 @@ -49,7 +49,7 @@ extern "C" { #define AT_HWCAP2 26 /* software based registers */ -enum cpu_register_t { +enum cpu_register_t __RTE_REGISTER_UNDERLYING_TYPE { REG_HWCAP = 0, REG_HWCAP2, }; @@ -57,7 +57,7 @@ enum cpu_register_t { /** * Enumeration of all CPU features supported */ -enum rte_cpu_flag_t { +enum rte_cpu_flag_t __RTE_CPUFLAG_UNDERLYING_TYPE { RTE_CPUFLAG_PPC_LE = 0, RTE_CPUFLAG_TRUE_LE, RTE_CPUFLAG_PSERIES_PERFMON_COMPAT, diff --git a/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h b/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h index 08aa957021..d6696d3d23 100644 --- a/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h +++ b/lib/librte_eal/common/include/arch/tile/rte_cpuflags.h @@ -45,14 +45,14 @@ extern "C" { #include "generic/rte_cpuflags.h" /* software based registers */ -enum cpu_register_t { +enum cpu_register_t __RTE_REGISTER_UNDERLYING_TYPE { REG_DUMMY = 0 }; /** * Enumeration of all CPU features supported */ -enum rte_cpu_flag_t { +enum rte_cpu_flag_t __RTE_CPUFLAG_UNDERLYING_TYPE { RTE_CPUFLAG_NUMFLAGS /**< This should always be the last! */ }; 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 dd5655356d..df1834c1ee 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h +++ b/lib/librte_eal/common/include/arch/x86/rte_cpuflags.h @@ -45,7 +45,7 @@ extern "C" { #include "generic/rte_cpuflags.h" -enum rte_cpu_flag_t { +enum rte_cpu_flag_t __RTE_CPUFLAG_UNDERLYING_TYPE { /* (EAX 01h) ECX features*/ RTE_CPUFLAG_SSE3 = 0, /**< SSE3 */ RTE_CPUFLAG_PCLMULQDQ, /**< PCLMULQDQ */ @@ -150,7 +150,7 @@ enum rte_cpu_flag_t { RTE_CPUFLAG_NUMFLAGS, /**< This should always be the last! */ }; -enum cpu_register_t { +enum cpu_register_t __RTE_REGISTER_UNDERLYING_TYPE { RTE_REG_EAX = 0, RTE_REG_EBX, RTE_REG_ECX, diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h index 61c4db1904..5352cbc32d 100644 --- a/lib/librte_eal/common/include/generic/rte_cpuflags.h +++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h @@ -44,15 +44,23 @@ #include #include +#ifdef __cplusplus +#define __RTE_CPUFLAG_UNDERLYING_TYPE : unsigned int +#define __RTE_REGISTER_UNDERLYING_TYPE : unsigned int +#else +#define __RTE_CPUFLAG_UNDERLYING_TYPE +#define __RTE_REGISTER_UNDERLYING_TYPE +#endif + /** * Enumeration of all CPU features supported */ -enum rte_cpu_flag_t; +enum rte_cpu_flag_t __RTE_CPUFLAG_UNDERLYING_TYPE; /** * Enumeration of CPU registers */ -enum cpu_register_t; +enum cpu_register_t __RTE_REGISTER_UNDERLYING_TYPE; typedef uint32_t cpuid_registers_t[4];