DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD
@ 2014-12-01 11:38 Bruce Richardson
  2014-12-01 11:38 ` [dpdk-dev] [PATCH 1/2] testpmd: fix out-of-range compiler error Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bruce Richardson @ 2014-12-01 11:38 UTC (permalink / raw)
  To: dev

This patch contains fixes for two compilation errors that occur with clang
on FreeBSD. These errors are not seen when compiling with clang on Fedora
Linux.

Bruce Richardson (2):
  testpmd: fix out-of-range compiler error
  testpmd: fix macro check for little endian

 app/test-pmd/csumonly.c | 2 +-
 app/test-pmd/icmpecho.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 1/2] testpmd: fix out-of-range compiler error
  2014-12-01 11:38 [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD Bruce Richardson
@ 2014-12-01 11:38 ` Bruce Richardson
  2014-12-01 11:38 ` [dpdk-dev] [PATCH 2/2] testpmd: fix macro check for little endian Bruce Richardson
  2014-12-01 15:57 ` [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2014-12-01 11:38 UTC (permalink / raw)
  To: dev

The definition value for IPPROTO_DIVERT protocol uses a value
which is out of range of the uint8_t type, giving clang compiler
errors on FreeBSD.

app/test-pmd/icmpecho.c:231:7: fatal error: overflow converting case value to switch condition type (258 to 2) [-Wswitch]
        case IPPROTO_DIVERT: /**< divert pseudo-protocol */

This is fixed by having the code to return the protocol name
use the uint16_t type for the protocol value input.

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

diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c
index c25a54b..08ea01d 100644
--- a/app/test-pmd/icmpecho.c
+++ b/app/test-pmd/icmpecho.c
@@ -88,7 +88,7 @@ arp_op_name(uint16_t arp_op)
 }
 
 static const char *
-ip_proto_name(uint8_t ip_proto)
+ip_proto_name(uint16_t ip_proto)
 {
 	static const char * ip_proto_names[] = {
 		"IP6HOPOPTS", /**< IP6 hop-by-hop options */
-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 2/2] testpmd: fix macro check for little endian
  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
  2014-12-01 15:57 ` [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2014-12-01 11:38 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD
  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 ` [dpdk-dev] [PATCH 2/2] testpmd: fix macro check for little endian Bruce Richardson
@ 2014-12-01 15:57 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2014-12-01 15:57 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

> This patch contains fixes for two compilation errors that occur with clang
> on FreeBSD. These errors are not seen when compiling with clang on Fedora
> Linux.
> 
> Bruce Richardson (2):
>   testpmd: fix out-of-range compiler error
>   testpmd: fix macro check for little endian

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-01 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-dev] [PATCH 2/2] testpmd: fix macro check for little endian Bruce Richardson
2014-12-01 15:57 ` [dpdk-dev] [PATCH 0/2] Fix clang compilation on FreeBSD Thomas Monjalon

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).