diff mbox

bug: linux-generic: add syntax to allow newer clang to compile odp

Message ID 20170417170745.3528-1-bill.fischofer@linaro.org
State Superseded
Headers show

Commit Message

Bill Fischofer April 17, 2017, 5:07 p.m. UTC
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2942 by adding
casts needed to avoid compilation failures when using clang 4.0.0
included in Ubuntu 17.04, which is stricter than clang 3.8.1 which
is in Ubuntu 16.10.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
 helper/chksum.c                                                     | 6 +++---
 platform/linux-generic/odp_packet_flags.c                           | 2 +-
 .../validation/api/classification/odp_classification_common.c       | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.11.0
diff mbox

Patch

diff --git a/helper/chksum.c b/helper/chksum.c
index f740618d..ae70d97e 100644
--- a/helper/chksum.c
+++ b/helper/chksum.c
@@ -128,7 +128,7 @@  static inline int odph_process_l4_hdr(odp_packet_t      odp_pkt,
 		 * should come from the udp header, unlike for TCP where is
 		 * derived. */
 		l4_len            = odp_be_to_cpu_16(udp_hdr_ptr->length);
-		pkt_chksum_ptr    = &udp_hdr_ptr->chksum;
+		pkt_chksum_ptr    = (uint16_t *)(void *)&udp_hdr_ptr->chksum;
 		pkt_chksum_offset = l4_offset + offsetof(odph_udphdr_t, chksum);
 	} else if (odp_packet_has_tcp(odp_pkt)) {
 		tcp_hdr_ptr  = (odph_tcphdr_t *)l4_ptr;
@@ -139,7 +139,7 @@  static inline int odph_process_l4_hdr(odp_packet_t      odp_pkt,
 					       ODPH_TCPHDR_LEN, tcp_hdr_ptr);
 		}
 
-		pkt_chksum_ptr    = &tcp_hdr_ptr->cksm;
+		pkt_chksum_ptr    = (uint16_t *)(void *)&tcp_hdr_ptr->cksm;
 		pkt_chksum_offset = l4_offset + offsetof(odph_tcphdr_t, cksm);
 		is_tcp            = true;
 	} else {
@@ -203,7 +203,7 @@  static inline int odph_process_l3_hdr(odp_packet_t odp_pkt,
 			ipv4_hdr_ptr = &ipv4_hdr;
 		}
 
-		addrs_ptr = (uint16_t *)&ipv4_hdr_ptr->src_addr;
+		addrs_ptr = (uint16_t *)(void *)&ipv4_hdr_ptr->src_addr;
 		addrs_len = 2 * ODPH_IPV4ADDR_LEN;
 		protocol  = ipv4_hdr_ptr->proto;
 		l3_len    = odp_be_to_cpu_16(ipv4_hdr_ptr->tot_len);
diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index ea9a2271..a23fdd81 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -180,7 +180,7 @@  odp_bool_t odp_packet_drop_eligible(odp_packet_t pkt)
 
 void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t drop)
 {
-	setflag(pkt, input_flags.nodrop, !drop, LAYER_ALL);
+	setflag(pkt, input_flags.nodrop, (!drop), LAYER_ALL);
 }
 
 int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt)
diff --git a/test/common_plat/validation/api/classification/odp_classification_common.c b/test/common_plat/validation/api/classification/odp_classification_common.c
index 3b379c14..eca30b87 100644
--- a/test/common_plat/validation/api/classification/odp_classification_common.c
+++ b/test/common_plat/validation/api/classification/odp_classification_common.c
@@ -278,14 +278,14 @@  odp_packet_t create_packet(cls_packet_info_t pkt_info)
 	ethhdr = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL);
 	memcpy(ethhdr->src.addr, &src_mac, ODPH_ETHADDR_LEN);
 	memcpy(ethhdr->dst.addr, &dst_mac_be, ODPH_ETHADDR_LEN);
-	vlan_type = (odp_u16be_t *)&ethhdr->type;
+	vlan_type = (odp_u16be_t *)(void *)&ethhdr->type;
 	vlan_hdr = (odph_vlanhdr_t *)(ethhdr + 1);
 
 	if (pkt_info.vlan_qinq) {
 		odp_packet_has_vlan_qinq_set(pkt, 1);
 		*vlan_type = odp_cpu_to_be_16(ODPH_ETHTYPE_VLAN_OUTER);
 		vlan_hdr->tci = odp_cpu_to_be_16(0);
-		vlan_type = (uint16_t *)&vlan_hdr->type;
+		vlan_type = (uint16_t *)(void *)&vlan_hdr->type;
 		vlan_hdr++;
 	}
 	if (pkt_info.vlan) {