[dpdk-dev] [PATCH 1/2] enic: fix initialization error with clang

Bruce Richardson bruce.richardson at intel.com
Fri Dec 5 16:57:11 CET 2014


This patch fixes the following compiler error raised by clang 3.3
on FreeBSD 10:

  CC enic_clsf.o
/usr/home/bruce/dpdk.org/lib/librte_pmd_enic/enic_clsf.c:99:25: fatal error: missing field 'u' initializer [-Wmissing-field-initializers]
        struct filter fltr = {0};

It fixes it by changing the initializer to set a named field to zero,
thereby automatically setting the rest of the unnamed fields also to
zero.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/librte_pmd_enic/enic_clsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_pmd_enic/enic_clsf.c b/lib/librte_pmd_enic/enic_clsf.c
index 30a4def..577a382 100644
--- a/lib/librte_pmd_enic/enic_clsf.c
+++ b/lib/librte_pmd_enic/enic_clsf.c
@@ -96,7 +96,7 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_fdir_filter *params,
 	u16 queue, u8 drop)
 {
 	struct enic_fdir_node *key;
-	struct filter fltr = {0};
+	struct filter fltr = {.type = 0};
 	int32_t pos;
 	u8 do_free = 0;
 	u16 old_fltr_id = 0;
-- 
2.1.0



More information about the dev mailing list