DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] testpmd: fix macro check for little endian
Date: Mon,  1 Dec 2014 11:38:55 +0000	[thread overview]
Message-ID: <1417433935-29181-3-git-send-email-bruce.richardson@intel.com> (raw)
In-Reply-To: <1417433935-29181-1-git-send-email-bruce.richardson@intel.com>

Compiling with clang on FreeBSD gave a compilation error:
app/test-pmd/csumonly.c:84:5: fatal error: '__BYTE_ORDER' is not defined, evaluates to 0 [-Wundef]

Querying the preprocessor defines show both the define and value used
are incorrect.
$ clang -dM -E - < /dev/null | grep BYTE
\#define  __BYTE_ORDER__  __ORDER_LITTLE_ENDIAN__

Changing the check to  __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ then
resolves the issue.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/csumonly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index d8c080a..6f43761 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -81,7 +81,7 @@
 
 /* we cannot use htons() from arpa/inet.h due to name conflicts, and we
  * cannot use rte_cpu_to_be_16() on a constant in a switch/case */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if  __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #define _htons(x) ((uint16_t)((((x) & 0x00ffU) << 8) | (((x) & 0xff00U) >> 8)))
 #else
 #define _htons(x) (x)
-- 
2.1.0

  parent reply	other threads:[~2014-12-01 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 11:38 [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD Bruce Richardson
2014-12-01 11:38 ` [dpdk-dev] [PATCH 1/2] testpmd: fix out-of-range compiler error Bruce Richardson
2014-12-01 11:38 ` Bruce Richardson [this message]
2014-12-01 15:57 ` [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD 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=1417433935-29181-3-git-send-email-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --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).