[dpdk-dev] [PATCH v3] net: fix build error with clang

Chen, Jing D jing.d.chen at intel.com
Tue Sep 27 19:24:35 CEST 2016


Hi, 

> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> Sent: Tuesday, September 27, 2016 5:20 AM
> To: dev at dpdk.org
> Cc: Jerin Jacob <jerin.jacob at caviumnetworks.com>; Chen, Jing D
> <jing.d.chen at intel.com>; Liang, Cunming <cunming.liang at intel.com>;
> Richardson, Bruce <bruce.richardson at intel.com>; Thomas Monjalon
> <thomas.monjalon at 6wind.com>
> Subject: Re: [PATCH v3] net: fix build error with clang
> 
> Can any PMD guys review it? It blocks a virtio patchset apply...
> 
> Thanks.
> 
> 	--yliu
> 
> On Mon, Sep 26, 2016 at 12:29:13PM +0800, Yuanhan Liu wrote:
> > Interestingly, clang and gcc has different prototype for _mm_prefetch().
> > For gcc, we have
> >
> >    _mm_prefetch (const void *__P, enum _mm_hint __I)
> >
> > While for clang, it's
> >
> >    #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0,
> > (sel)))
> >
> > That's how the following error comes with clang:
> >
> >    error: cast from 'const void *' to 'void *' drops const qualifier
> >    [-Werror,-Wcast-qual]
> >            _mm_prefetch((const void *)rused, _MM_HINT_T0);
> >    /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0/include/xmmintrin.h:684:58:
> >    note: expanded from macro '_mm_prefetch'
> >             #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a),
> >                                           0, (sel)))
> >
> > What's weird is that the build was actaully Okay before. I met it
> > while apply Jerin's vector support for ARM patch set: he just move
> > this peiece of code to another file, nothing else changed.
> >
> > This patch fix the issue when Jerin's patchset is applied. Thus, I
> > think it's still needed.
> >
> > Similarly, make the same change to other _mm_prefetch users, just in
> > case this weird issue shows up again somehow later.
> >
> > Fixes: fc3d66212fed ("virtio: add vector Rx")
> > Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
> > Fixes: 9ed94e5bb04e ("i40e: add vector Rx")
> > Fixes: 7092be8437bd ("fm10k: add vector Rx")
> >
> > Cc: Jerin Jacob <jerin.jacob at caviumnetworks.com>
> > Cc: Chen Jing D(Mark) <jing.d.chen at intel.com>
> > Cc: Cunming Liang <cunming.liang at intel.com>
> > Cc: Bruce Richardson <bruce.richardson at intel.com>
> > CC: Thomas Monjalon <thomas.monjalon at 6wind.com>
> > Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
Acked-by: Jing Chen <jing.d.chen at intel.com>


More information about the dev mailing list