From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 844687E7B for ; Wed, 22 Oct 2014 11:52:11 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 22 Oct 2014 03:00:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,768,1406617200"; d="scan'208";a="593649699" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga001.jf.intel.com with ESMTP; 22 Oct 2014 02:59:57 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.175]) by IRSMSX102.ger.corp.intel.com ([169.254.2.200]) with mapi id 14.03.0195.001; Wed, 22 Oct 2014 10:59:41 +0100 From: "Richardson, Bruce" To: Marc Sune , Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH] KNI: fix compilation warning 'missing-field-initializers' Thread-Index: AQHP7ceHMb1+pbqwwkGZe+VhHapqr5w7unEAgAABeoCAAAIqgIAAEKKAgAATWlA= Date: Wed, 22 Oct 2014 09:59:41 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B0344218EF@IRSMSX103.ger.corp.intel.com> References: <1ED644BD7E0A5F4091CF203DAFB8E4CC01D8288F@SHSMSX101.ccr.corp.intel.com> <2234340.4n5qb1rBlX@xps13> <54476DF9.6060906@bisdn.de> <4364683.dn9JoP4MXp@xps13> <54477DBD.1090701@bisdn.de> In-Reply-To: <54477DBD.1090701@bisdn.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] KNI: fix compilation warning 'missing-field-initializers' X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 09:52:11 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Marc Sune > Sent: Wednesday, October 22, 2014 10:50 AM > To: Thomas Monjalon > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] KNI: fix compilation warning 'missing-fie= ld- > initializers' >=20 > On 22/10/14 10:50, Thomas Monjalon wrote: > > 2014-10-22 10:42, Marc Sune: > >> The mutex needs to be initialized to RTE_SPINLOCK_INITIALIZER(0) too, = or > >> move the initialization of the mutex to rte_kni_init(). > > RTE_SPINLOCK_INITIALIZER is { 0 } > > By initializing one field, all other fields are set to 0, so spinlock a= lso. > > Just choose one field and it's OK. > > It should be tested with ICC also but I think it's OK. >=20 > Seems that you are right, at least for C99: >=20 > C99 Standard 6.7.8.21 >=20 > If there are fewer initializers in a brace-enclosed list than > there are elements or members of an aggregate, or fewer characters > in a string literal used to initialize an array of known size than > there are elements in the array, the remainder of the aggregate > shall be initialized implicitly the same as objects that have static > storage duration. >=20 >=20 > I am not sure if there can be problems with other C dialects (e.g. C11), > I don't have the std here. So to prevent any problem with them (could > produce a dead-lock during first rte_kni_alloc() that could be difficult > to troubleshoot), I would still explicitly initialize the mutex, in one > or the other way. >=20 > Just tell me if you agree and which one you prefer. >=20 > I don't have an ICC license. I am always trying it with GCC and clang. >=20 > Marc ICC should be fine with this, it handles just initializing a single member = of a structure as described by Thomas above. /Bruce