[PATCH] net/iavf: fix old GCC compilation warnings

Zeng, ZhichaoX zhichaox.zeng at intel.com
Fri Jun 9 09:19:38 CEST 2023


Hi David, 

> -----Original Message-----
> From: David Marchand <david.marchand at redhat.com>
> Sent: Friday, June 9, 2023 2:58 PM
> To: Zeng, ZhichaoX <zhichaox.zeng at intel.com>
> Cc: dev at dpdk.org; Zhang, Qi Z <qi.z.zhang at intel.com>; Gao, DaxueX
> <daxuex.gao at intel.com>; Richardson, Bruce <bruce.richardson at intel.com>;
> Konstantin Ananyev <konstantin.v.ananyev at yandex.ru>; Wu, Jingjing
> <jingjing.wu at intel.com>; Xing, Beilei <beilei.xing at intel.com>; Wu, Wenjun1
> <wenjun1.wu at intel.com>
> Subject: Re: [PATCH] net/iavf: fix old GCC compilation warnings
> 
> On Fri, Jun 9, 2023 at 7:35 AM Zhichao Zeng <zhichaox.zeng at intel.com>
> wrote:
> >
> > The code uses the Wimplicit-fallthrough compile option to ignore falls
> > through warnings in switch case, but this option was introduced by GCC
> > 7 and old GCC do not recognize the option.
> >
> > Add judgment to avoid warnings about unrecognized options in old GCC.
> >
> > Fixes: 95a1b0b23140 ("net/iavf: support Rx timestamp offload on SSE")
> > Fixes: 4f58266da4d3 ("net/iavf: support Rx timestamp offload on AVX2")
> > Fixes: d65eadb9e178 ("net/iavf: support Rx timestamp offload on
> > AVX512")
> > Signed-off-by: Zhichao Zeng <zhichaox.zeng at intel.com>
> 
> This is ugly.
> 
> I don't think we introduced a marker for this in EAL, but at least I see other
> drivers use /* fallthrough */.
> Prefer this form, please.

Thanks for your advice, I will change to this form and submit v2.

Best Regards
Zhichao

> IOW:
> 
> diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c
> b/drivers/net/iavf/iavf_rxtx_vec_sse.c
> index b754122c51..81ea154519 100644
> --- a/drivers/net/iavf/iavf_rxtx_vec_sse.c
> +++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c
> @@ -1126,24 +1126,26 @@ _recv_raw_pkts_vec_flex_rxd(struct
> iavf_rx_queue *rxq,
>                 nb_pkts_recd += var;
> 
>  #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
> -#pragma GCC diagnostic push
> -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
>                 if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
>                         inflection_point = (inflection_point <= var) ?
> inflection_point : 0;
>                         switch (inflection_point) {
>                         case 1:
>                                 *RTE_MBUF_DYNFIELD(rx_pkts[pos + 0],
>                                         iavf_timestamp_dynfield_offset
> + 4, uint32_t *) += 1;
> +                               /* fallthrough */
>                         case 2:
> 
> etc...
> 
> 
> --
> David Marchand



More information about the dev mailing list