27/04/2020 16:00, David Marchand: > On Mon, Apr 27, 2020 at 3:47 PM Ananyev, Konstantin wrote: > > From: dev <dev-boun...@dpdk.org> On Behalf Of David Marchand > > > On Mon, Apr 27, 2020 at 3:34 PM Bruce Richardson > > > <bruce.richard...@intel.com> wrote: > > > > On Mon, Apr 27, 2020 at 03:23:41PM +0200, David Marchand wrote: > > > > > Building OVS with dpdk, sparse complains about 64-bit constant being > > > > > passed as a normal integer that can't fit it: > > > > > error: constant 0xffffffffffffffff is so big it is unsigned long > > > > > > > > > > Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API") > > > > > > > > > > Signed-off-by: David Marchand <david.march...@redhat.com> > > > > > --- > > > > > --- a/lib/librte_ethdev/rte_flow.h > > > > > +++ b/lib/librte_ethdev/rte_flow.h > > > > > static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = { > > > > > .s_field = 0x01, > > > > > - .seid = RTE_BE64(0xffffffffffffffff), > > > > > + .seid = RTE_BE64(UINT64_C(0xffffffffffffffff)), > > > > > > > > Rather than cast, why not put "ULL" at the end. If we are going to cast, > > > > why not just put "-1" in to save some digits. > > > > > > I preferred this form in the hope future developers who want > > > 0x0fffffffffffffff will copy/paste this. > > > > > > > As I remember there should be UINT64_MAX in stdint.h. > > Yes, we could go with: > + .seid = RTE_BE64(UINT64_MAX), > > And then next time, for any value like 0x0fff ffff ffff ffff (had to > group the digits of what I had written), pretty sure we will miss this > and I will catch it only when building ovs.
I agree with David (in general and especially here). RTE_BE64 is required for static analyzers and is an explicit info. UINT64_C is better than ULL suffix because it - is generic - gives size explicitly UINT64_C(0xffffffffffffffff) is better than UINT64_MAX because - rte_flow.h has a lot of bitmasks - it is copy/paste safe Acked-by: Thomas Monjalon <tho...@monjalon.net>