[dpdk-dev] DPDK build issues with gcc-8

Stephen Hemminger stephen at networkplumber.org
Mon Mar 19 18:50:47 CET 2018


Tried building DPDK with gcc-8 and got several new warnings.
Working on trivial patches for most of them, but the DPDK rte_table interface
for hashing has a more fundamental problem which Gcc-8 discovers.

The code is trying to cast an RTE hash function into a RTE table hash function
with a different signature.  It works because the two are mostly the same, but
it really shouldn't be done that way:

Warning:
  CC rte_table_hash_cuckoo.o
lib/librte_table/rte_table_hash_cuckoo.c: In function ‘rte_table_hash_cuckoo_create’:
lib/librte_table/rte_table_hash_cuckoo.c:110:16: error: cast between incompatible function types from ‘rte_table_hash_op_hash’ {aka ‘long unsigned int (*)(void *, void *, unsigned int,  long unsigned int)’} to ‘uint32_t (*)(const void *, uint32_t,  uint32_t)’ {aka ‘unsigned int (*)(const void *, unsigned int,  unsigned int)’} [-Werror=cast-function-type]
   .hash_func = (rte_hash_function)(p->f_hash),
                ^

RTE hash:
/** Type of function that can be used for calculating the hash value. */
typedef uint32_t (*rte_hash_function)(const void *key, uint32_t key_len,
				      uint32_t init_val);


RTE table hash:

/** Hash function */
typedef uint64_t (*rte_table_hash_op_hash)(
	void *key,
	void *key_mask,
	uint32_t key_size,
	uint64_t seed);

Just turning off the warning is not an acceptable solution. The API should really
be fixed. My preference would be to eliminate rte_table_hash_op_hash typedef
and keep rte_hash_function.



More information about the dev mailing list