/home/agreen/projects/dpdk/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),
The code seems to be quite broken. It's casting this typedef uint64_t (*rte_table_hash_op_hash)( void *key, void *key_mask, uint32_t key_size, uint64_t seed); to this typedef uint32_t (*rte_hash_function)(const void *key, uint32_t key_len, uint32_t init_val); if the definition with 4 args is later called with a pointer giving it three args, obviously it working is just an accident. I grepped around a bit and could not see it being cast back to the original type before use; the uses I saw have three args. I simply patch it to stop the build breaking, rather than fix it, since I am not sure what a fix should look like considering the whole code. --- lib/librte_table/rte_table_hash_cuckoo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_table/rte_table_hash_cuckoo.c b/lib/librte_table/rte_table_hash_cuckoo.c index dcb4fe978..eca72b506 100644 --- a/lib/librte_table/rte_table_hash_cuckoo.c +++ b/lib/librte_table/rte_table_hash_cuckoo.c @@ -107,7 +107,7 @@ rte_table_hash_cuckoo_create(void *params, struct rte_hash_parameters hash_cuckoo_params = { .entries = p->n_keys, .key_len = p->key_size, - .hash_func = (rte_hash_function)(p->f_hash), + .hash_func = (rte_hash_function)(void *)(p->f_hash), .hash_func_init_val = p->seed, .socket_id = socket_id, .name = p->name