On 04/21 15:03:06, Bill Fischofer wrote:
> 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 <[email protected]>

Reviewed-by: Brian Brooks <[email protected]>

> ---
>  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(-)
> 
> 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..c2e8b9cf 100644
> --- a/platform/linux-generic/odp_packet_flags.c
> +++ b/platform/linux-generic/odp_packet_flags.c
> @@ -19,7 +19,7 @@
>       odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); \
>       if (pkt_hdr->p.parsed_layers < layer)            \
>               packet_parse_layer(pkt_hdr, layer);      \
> -     pkt_hdr->p.x = v & 1;                            \
> +     pkt_hdr->p.x = (v) & 1;                          \
>       } while (0)
>  
>  int odp_packet_has_error(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) {
> -- 
> 2.11.0
> 

Reply via email to