From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yliu84x@shecgisg003.sh.intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 585CA9AAB
 for <dev@dpdk.org>; Thu, 19 Mar 2015 04:17:16 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga101.fm.intel.com with ESMTP; 18 Mar 2015 20:17:16 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,427,1422950400"; d="scan'208";a="682242914"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2015 20:17:15 -0700
Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com
 [10.239.29.90])
 by shvmail01.sh.intel.com with ESMTP id t2J3HDuO024365;
 Thu, 19 Mar 2015 11:17:13 +0800
Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1])
 by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 t2J3HBdW019482; Thu, 19 Mar 2015 11:17:13 +0800
Received: (from yliu84x@localhost)
 by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t2J3HAH3019478;
 Thu, 19 Mar 2015 11:17:10 +0800
From: Yong Liu <yong.liu@intel.com>
To: dev@dpdk.org
Date: Thu, 19 Mar 2015 11:16:55 +0800
Message-Id: <1426735018-19411-6-git-send-email-yong.liu@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1426735018-19411-1-git-send-email-yong.liu@intel.com>
References: <1426735018-19411-1-git-send-email-yong.liu@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 3/6] fix build error when initialized structure
	in enic driver
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2015 03:17:16 -0000

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 --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];
-- 
1.9.3