linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Mariusz Gorski <marius.gorski@gmail.com>,
	linux-kernel@vger.kernel.org,
	Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Sparse warning: "initializer entry defined twice" - sparse can't handle bool?
Date: Sun, 19 Oct 2014 10:21:29 -0700	[thread overview]
Message-ID: <5443F319.4000303@infradead.org> (raw)
In-Reply-To: <CABbAP1QWTorBt+f-nCmw1Q_DPe1CLecXYGUJFAcQkuw0Rk6d2g@mail.gmail.com>

[adding linux-sparse mailing list]

On 10/19/14 02:46, Mariusz Gorski wrote:
> Sparse throws the following warning, which I can't really understand:
> 
> $ make drivers/staging/vt6655/ C=2
> [...]
>   CHECK   drivers/staging/vt6655/datarate.c
> drivers/staging/vt6655/datarate.c:302:40: warning: Initializer entry
> defined twice
> drivers/staging/vt6655/datarate.c:302:46:   also defined here
> 
> The code looks fine to me:
> bool bAutoRate[MAX_RATE]    = {true, true, true, true, false, false,
> true, true, true, true, true, true};
> 
> I've googled it and found only this LKML discussion:
> https://lkml.org/lkml/2010/5/7/31
> 
> I've tested the suggested code sample and here are the results:
> $ cat foo.c
> typedef _Bool bool;
> enum {
>      false = 0,
>      true = 1
> };
> static const bool foo[10] = {
>        true,
>        true,
>        false,
>        false,
> };
> 
> $ sparse foo.c
> foo.c:7:8: warning: Initializer entry defined twice
> foo.c:8:8:   also defined here
> 
> It this a sparse problem?
> 
> Thanks,
> Mariusz
> --


-- 
~Randy

       reply	other threads:[~2014-10-19 17:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABbAP1QWTorBt+f-nCmw1Q_DPe1CLecXYGUJFAcQkuw0Rk6d2g@mail.gmail.com>
2014-10-19 17:21 ` Randy Dunlap [this message]
2014-10-19 21:40   ` Sparse warning: "initializer entry defined twice" - sparse can't handle bool? Ramsay Jones
2014-10-20 21:00     ` Mariusz Gorski

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=5443F319.4000303@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=marius.gorski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).