diff mbox

[dpdk-dev,3/6] fix build error when initialized structure in enic driver

Message ID 1426735018-19411-6-git-send-email-yong.liu@intel.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Liu, Yong March 19, 2015, 3:16 a.m. UTC
From: Marvin Liu <yong.liu@intel.com>

gcc4.3 will raise warnings in blow code for initialized field overwritten.

enic_main.c: In function ‘enic_set_rsskey’:
enic_main.c:845: error: initialized field overwritten
enic_main.c:845: error: (near initialization for ‘rss_key.key’)
enic_main.c:846: error: initialized field overwritten
enic_main.c:846: error: (near initialization for ‘rss_key.key’)
enic_main.c:847: error: initialized field overwritten
enic_main.c:847: error: (near initialization for ‘rss_key.key’)

static union vnic_rss_key rss_key = {
	.key[0] = ...,
	.key[1] = ...,
	.key[2] = ...,
	.key[3] = ...,
};

Change struct initialized code reference to ISO 9899 section 6.7.8.
gcc4.3 will happy for that.

static union vnic_rss_key rss_key = {
	.key = {
		[0] = ...,
		[1] = ...,
		[2] = ...,
		[3] = ...,
	}

Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff mbox

Patch

diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c
index c66f139..0892b3e 100644
--- a/lib/librte_pmd_enic/enic_main.c
+++ b/lib/librte_pmd_enic/enic_main.c
@@ -840,10 +840,12 @@  static int enic_set_rsskey(struct enic *enic)
 	dma_addr_t rss_key_buf_pa;
 	union vnic_rss_key *rss_key_buf_va = NULL;
 	static union vnic_rss_key rss_key = {
-		.key[0] = {.b = {85, 67, 83, 97, 119, 101, 115, 111, 109, 101}},
-		.key[1] = {.b = {80, 65, 76, 79, 117, 110, 105, 113, 117, 101}},
-		.key[2] = {.b = {76, 73, 78, 85, 88, 114, 111, 99, 107, 115}},
-		.key[3] = {.b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}},
+		.key = {
+			[0] = {.b = {85, 67, 83, 97, 119, 101, 115, 111, 109, 101}},
+			[1] = {.b = {80, 65, 76, 79, 117, 110, 105, 113, 117, 101}},
+			[2] = {.b = {76, 73, 78, 85, 88, 114, 111, 99, 107, 115}},
+			[3] = {.b = {69, 78, 73, 67, 105, 115, 99, 111, 111, 108}},
+		}
 	};
 	int err;
 	u8 name[NAME_MAX];