DPDK patches and discussions
 help / color / mirror / Atom feed
From: Marc Sune <marc.sune@bisdn.de>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] KNI: fix compilation warning 'missing-field-initializers'
Date: Wed, 22 Oct 2014 11:49:49 +0200
Message-ID: <54477DBD.1090701@bisdn.de> (raw)
In-Reply-To: <4364683.dn9JoP4MXp@xps13>

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().
> 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

         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.

I don't have an ICC license. I am always trying it with GCC and clang.


  reply	other threads:[~2014-10-22  9:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17 22:51 [dpdk-dev] [PATCH v4] KNI: use a memzone pool for KNI alloc/release Marc Sune
2014-10-21  4:57 ` Zhang, Helin
2014-10-21  8:29 ` Thomas Monjalon
2014-10-21 10:52   ` Marc Sune
2014-10-22  5:51     ` Liu, Jijiang
2014-10-22  7:10       ` [dpdk-dev] [PATCH] KNI: fix compilation warning 'missing-field-initializers' Marc Sune
2014-10-22  7:14         ` Marc Sune
2014-10-22  8:11         ` Liu, Jijiang
2014-10-22  8:37         ` Thomas Monjalon
2014-10-22  8:42           ` Marc Sune
2014-10-22  8:50             ` Thomas Monjalon
2014-10-22  9:49               ` Marc Sune [this message]
2014-10-22  9:59                 ` Richardson, Bruce
2014-10-22 10:00                 ` Thomas Monjalon
2014-10-22 10:23                   ` [dpdk-dev] [PATCH v2] " Marc Sune
2014-10-22 10:35                     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54477DBD.1090701@bisdn.de \
    --to=marc.sune@bisdn.de \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git