From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <michael.qiu@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 242488042
 for <dev@dpdk.org>; Wed,  3 Dec 2014 20:44:45 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga102.fm.intel.com with ESMTP; 03 Dec 2014 08:45:54 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.07,508,1413270000"; d="scan'208";a="617973469"
Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88])
 by orsmga001.jf.intel.com with ESMTP; 03 Dec 2014 08:26:04 -0800
Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by
 KMSMSX153.gar.corp.intel.com (172.21.73.88) with Microsoft SMTP Server (TLS)
 id 14.3.195.1; Thu, 4 Dec 2014 00:26:04 +0800
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by
 SHSMSX151.ccr.corp.intel.com ([169.254.3.86]) with mapi id 14.03.0195.001;
 Thu, 4 Dec 2014 00:26:02 +0800
From: "Qiu, Michael" <michael.qiu@intel.com>
To: Michael Qiu <qdy220091330@gmail.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH] test-pmd: Fix "__BYTE_ORDER__" not defined error
Thread-Index: AQHQDuxGl82rqoFqMUC/ffsnsL6LRg==
Date: Wed, 3 Dec 2014 16:26:02 +0000
Message-ID: <533710CFB86FA344BFBF2D6802E60286C9C636@SHSMSX101.ccr.corp.intel.com>
References: <1417606044-3432-1-git-send-email-michael.qiu@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] test-pmd: Fix "__BYTE_ORDER__" not defined
	error
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: Wed, 03 Dec 2014 19:44:46 -0000

Hi all,=0A=
=0A=
What about this patch?=0A=
=0A=
It may be some network or mail client issue of me, so not sure this=0A=
patch posted to mail list successful.=0A=
=0A=
If failed, I will re-post it later.=0A=
=0A=
Thanks,=0A=
Michael=0A=
=0A=
On 2014/12/3 19:28, Michael Qiu wrote:=0A=
> app/test-pmd/csumonly.c:84:5: error: "__BYTE_ORDER__" is not defined=0A=
> app/test-pmd/csumonly.c:84:23: error: "__ORDER_LITTLE_ENDIAN__" is not de=
fined=0A=
>=0A=
> This because old gcc version, like 4.4.7, does not has these buildin macr=
os.=0A=
>=0A=
> $ gcc -v=0A=
> Using built-in specs.=0A=
> Target: x86_64-redhat-linux=0A=
> ...=0A=
> gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)=0A=
>=0A=
> $ echo | gcc -dM -E -| grep "LITTLE"=0A=
> (none)=0A=
>=0A=
> In this situation, we should back to use the macros defined in=0A=
> <endian.h>=0A=
>=0A=
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>=0A=
> ---=0A=
>  app/test-pmd/csumonly.c | 8 +++++++-=0A=
>  1 file changed, 7 insertions(+), 1 deletion(-)=0A=
>=0A=
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c=0A=
> index 6f43761..3fa81a2 100644=0A=
> --- a/app/test-pmd/csumonly.c=0A=
> +++ b/app/test-pmd/csumonly.c=0A=
> @@ -81,7 +81,13 @@=0A=
>  =0A=
>  /* we cannot use htons() from arpa/inet.h due to name conflicts, and we=
=0A=
>   * cannot use rte_cpu_to_be_16() on a constant in a switch/case */=0A=
> -#if  __BYTE_ORDER__ =3D=3D __ORDER_LITTLE_ENDIAN__=0A=
> +#ifdef __BYTE_ORDER__=0A=
> +#define LITTLE_ENDIAN_CHECK (__BYTE_ORDER__ =3D=3D __ORDER_LITTLE_ENDIAN=
__)=0A=
> +#else=0A=
> +#define LITTLE_ENDIAN_CHECK (__BYTE_ORDER =3D=3D __LITTLE_ENDIAN)=0A=
> +#endif=0A=
> +=0A=
> +#if LITTLE_ENDIAN_CHECK=0A=
>  #define _htons(x) ((uint16_t)((((x) & 0x00ffU) << 8) | (((x) & 0xff00U) =
>> 8)))=0A=
>  #else=0A=
>  #define _htons(x) (x)=0A=
=0A=