[dpdk-dev] [PATCH 3/3] ethdev: fix build warning on 64-bit value

Andrew Rybchenko arybchenko at solarflare.com
Mon Apr 27 15:39:29 CEST 2020


On 4/27/20 4:34 PM, Bruce Richardson 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.marchand at redhat.com>
>> ---
>>  lib/librte_ethdev/rte_flow.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
>> index 132b44edc6..1fb94f35e8 100644
>> --- a/lib/librte_ethdev/rte_flow.h
>> +++ b/lib/librte_ethdev/rte_flow.h
>> @@ -1534,7 +1534,7 @@ struct rte_flow_item_pfcp {
>>  #ifndef __cplusplus
>>  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.

It is not a cast as far as I can see, it is exactly ULL (or UL):
/usr/include/stdint.h
# if __WORDSIZE == 64
#  define UINT64_C(c)   c ## UL
# else
#  define UINT64_C(c)   c ## ULL
# endif

> If we are going to cast, why not just put "-1" in to save some digits.
>
> /Bruce



More information about the dev mailing list