From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id A48CE7E7B for ; Wed, 22 Oct 2014 11:52:48 +0200 (CEST) Received: by mail-wg0-f48.google.com with SMTP id k14so3353591wgh.19 for ; Wed, 22 Oct 2014 03:01:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=DsJW1eEcjggQOqyr7vlYemeHwDhNxG56vBhtuACSY/c=; b=f6PiIjyeA5h+MSw3i0Hy6LRxTk60wXwnDN/q6fjNZJsxJlctu4bl6Vh6bdYjTOjZFb 3uLrADkw8vWAS9MUnFihoLLBroAHuPrfi2qDIFZNuEaqmA3pD5NKSU7qe0VxJhzpINEM 2mtDnzo7WePy4PLHp1KY1k2cXeHaRjrZLHyLnE9I2K2LXQZmRSqH052A+zL24v5GtuwI fu+jg2U+QEL8Ewwp5TXSQDuN5iAfgaSJKR70EtPTFA86dX/J+zYK8XbjpsbScIUaTMvf I7WF4PLhTgPSWc8Kufwmu31ulcv+FPZ66hoMDWzEGmGF4nrOSuz9QvbvXo0G9S3R8yNb WNwg== X-Gm-Message-State: ALoCoQlfQD7x+88hoppPCvUYxCcn4AYzbQ1EHzJow6Co7OABxF9nAya2pX62c6hW9Zmcezahro0Y X-Received: by 10.180.9.169 with SMTP id a9mr4427354wib.7.1413972068492; Wed, 22 Oct 2014 03:01:08 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id p3sm12233196wjf.49.2014.10.22.03.01.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Oct 2014 03:01:07 -0700 (PDT) From: Thomas Monjalon To: Marc Sune Date: Wed, 22 Oct 2014 12:00:46 +0200 Message-ID: <1818029.CqCeQSHIe6@xps13> Organization: 6WIND User-Agent: KMail/4.14.1 (Linux/3.16.4-1-ARCH; KDE/4.14.1; x86_64; ; ) In-Reply-To: <54477DBD.1090701@bisdn.de> References: <1ED644BD7E0A5F4091CF203DAFB8E4CC01D8288F@SHSMSX101.ccr.corp.intel.com> <4364683.dn9JoP4MXp@xps13> <54477DBD.1090701@bisdn.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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:48 -0000 2014-10-22 11:49, Marc Sune: > 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 also. > > Just choose one field and it's OK. > > It should be tested with ICC also but I think it's OK. > > Seems that you are right, at least for C99: > > C99 Standard 6.7.8.21 > > 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. > > > 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. > > Just tell me if you agree and which one you prefer. No problem for initializing mutex. > I don't have an ICC license. I am always trying it with GCC and clang. That's why it's the Intel job to support ICC in DPDK :) -- Thomas