From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <kananye1@ecsmtp.ir.intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id D13BB11A2
 for <dev@dpdk.org>; Fri,  6 Mar 2015 17:00:13 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga103.fm.intel.com with ESMTP; 06 Mar 2015 07:54:57 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,353,1422950400"; d="scan'208";a="661490744"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by orsmga001.jf.intel.com with ESMTP; 06 Mar 2015 08:00:04 -0800
Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com
 [10.237.217.46])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 t26G048s023118; Fri, 6 Mar 2015 16:00:04 GMT
Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1])
 by sivswdev02.ir.intel.com with ESMTP id t26G03oY023731;
 Fri, 6 Mar 2015 16:00:03 GMT
Received: (from kananye1@localhost)
 by sivswdev02.ir.intel.com with  id t26G032K023727;
 Fri, 6 Mar 2015 16:00:03 GMT
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Date: Fri,  6 Mar 2015 15:59:47 +0000
Message-Id: <1425657587-23516-1-git-send-email-konstantin.ananyev@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <20150225142851.55406347@miho>
References: <20150225142851.55406347@miho>
In-Reply-To: <20150225142851.55406347@miho>
References: <20150225142851.55406347@miho>
Subject: [dpdk-dev] [PATCHv2] headers: typeof -> __typeof__ to unbreak C++11
	code
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Mar 2015 16:00:14 -0000

v2:
Instead of changing all the affected files,
define 'typeofi' and 'asm' if needed.

When compiling C++11-code or above (--std=c++11), the build fails with
lots of

  rte_eth_ctrl.h:517:3: note: in expansion of macro RTE_ALIGN
    (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
    ^

When reading the GCC info pages, I get the feeling that __typeof__ is
a better choice, and that indeed works when including the headers in
C++ files (--std=c++11).

There are some typeof()s left in C files, the patch only touches the
public API.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_eal/common/include/rte_common.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 8ac940c..1867692 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -51,6 +51,15 @@ extern "C" {
 #include <errno.h>
 #include <limits.h>
 
+#ifndef typeof
+#define typeof __typeof__
+#endif
+
+#ifndef asm
+#define asm __asm__
+#endif
+
+
 /*********** Macros to eliminate unused variable warnings ********/
 
 /**
-- 
1.8.5.3