dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix clang compilation on FreeBSD
@ 2014-12-01 11:38 Bruce Richardson
       [not found] ` <1417433935-29181-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2014-12-01 11:38 UTC (permalink / raw)
  To: dev-VfR2kkLFssw

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

* [PATCH 1/2] testpmd: fix out-of-range compiler error
       [not found] ` <1417433935-29181-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2014-12-01 11:38   ` Bruce Richardson
  2014-12-01 11:38   ` [PATCH 2/2] testpmd: fix macro check for little endian Bruce Richardson
  2014-12-01 15:57   ` [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-VfR2kkLFssw

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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 related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] testpmd: fix macro check for little endian
       [not found] ` <1417433935-29181-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2014-12-01 11:38   ` [PATCH 1/2] testpmd: fix out-of-range compiler error Bruce Richardson
@ 2014-12-01 11:38   ` Bruce Richardson
  2014-12-01 15:57   ` [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-VfR2kkLFssw

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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 related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Fix clang compilation on FreeBSD
       [not found] ` <1417433935-29181-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2014-12-01 11:38   ` [PATCH 1/2] testpmd: fix out-of-range compiler error Bruce Richardson
  2014-12-01 11:38   ` [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-VfR2kkLFssw

> 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-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

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 [PATCH 0/2] Fix clang compilation on FreeBSD Bruce Richardson
     [not found] ` <1417433935-29181-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-01 11:38   ` [PATCH 1/2] testpmd: fix out-of-range compiler error Bruce Richardson
2014-12-01 11:38   ` [PATCH 2/2] testpmd: fix macro check for little endian Bruce Richardson
2014-12-01 15:57   ` [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).