DPDK patches and discussions
 help / color / mirror / Atom feed
From: Joongi Kim <joongi@an.kaist.ac.kr>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] eal: Fix compilation on C++
Date: Fri,  3 Jul 2015 21:51:03 +0900	[thread overview]
Message-ID: <1435927863-3398-2-git-send-email-joongi@an.kaist.ac.kr> (raw)
In-Reply-To: <1435927863-3398-1-git-send-email-joongi@an.kaist.ac.kr>

 * 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

Signed-off-by: Joongi Kim <joongi@an.kaist.ac.kr>
---
 lib/librte_eal/common/include/arch/x86/rte_cpuflags.h |  4 ++--
 lib/librte_eal/common/include/generic/rte_cpuflags.h  | 12 ++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

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..df1834c 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 61c4db1..5352cbc 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 <errno.h>
 #include <stdint.h>
 
+#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];
 
-- 
1.9.1

  reply	other threads:[~2015-07-03 12:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 12:51 [dpdk-dev] [PATCH 1/2] lib: Fix pointer arithmetic for C++ Joongi Kim
2015-07-03 12:51 ` Joongi Kim [this message]
2015-08-17 15:29   ` [dpdk-dev] [PATCH 2/2] eal: Fix compilation on C++ Thomas Monjalon
2015-08-17 15:50     ` Thomas Monjalon
2015-11-13  9:35   ` [dpdk-dev] [PATCH 1/2] Revert "eal: fix C++ app build" David Marchand
2015-11-13  9:35     ` [dpdk-dev] [PATCH 2/2] eal: move empty declarations to doc David Marchand
2015-11-23 15:19       ` Thomas Monjalon
2015-08-17 15:22 ` [dpdk-dev] [PATCH 1/2] lib: Fix pointer arithmetic for C++ Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435927863-3398-2-git-send-email-joongi@an.kaist.ac.kr \
    --to=joongi@an.kaist.ac.kr \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).