hash: fix build with gcc 4.4 and 4.5
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 15 Jul 2015 12:40:42 +0000 (13:40 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 16 Jul 2015 14:48:51 +0000 (16:48 +0200)
gcc 4.4 and 4.5 throws following error:
rte_cuckoo_hash.c:145: error: flexible array member in otherwise empty struct.

This is due to empty length in flexible array, which has been changed to use
size 0 in the declaration of the array.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Reported-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
lib/librte_hash/rte_cuckoo_hash.c

index 105ecdb..00ba3a3 100644 (file)
@@ -142,7 +142,7 @@ struct rte_hash_key {
                void *pdata;
        };
        /* Variable key size */
-       char key[];
+       char key[0];
 } __attribute__((aligned(KEY_ALIGNMENT)));
 
 /** Bucket structure */