mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Steve French <smfrench@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: Sparse warning: "initializer entry defined twice"
Date: Fri, 7 May 2010 14:11:36 +0800	[thread overview]
Message-ID: <20100507061136.GC5921@cr0.nay.redhat.com> (raw)
In-Reply-To: <l2v524f69651005061643vcdc9f7c1h780344e30c123646@mail.gmail.com>

On Thu, May 06, 2010 at 06:43:10PM -0500, Steve French wrote:
>Sparse, but not gcc, throws a warning ("make modules C=1") as follows
>on the first two lines of the following array of booleans
>
>  CHECK   fs/smb2/misc.c
>fs/smb2/misc.c:456:23: warning: Initializer entry defined twice
>fs/smb2/misc.c:457:27:   also defined here
>
>
>static const bool has_smb2_data_area[NUMBER_OF_SMB2_COMMANDS] = {
>    /* SMB2_NEGOTIATE */ true,
>    /* SMB2_SESSION_SETUP */ true,
>    /* SMB2_LOGOFF */ false,
>    /* SMB2_TREE_CONNECT */    false,
>    /* SMB2_TREE_DISCONNECT */ false,
>    /* SMB2_CREATE */ true,
>    /* SMB2_CLOSE */ false,
>    /* SMB2_FLUSH */ false,
>    /* SMB2_READ */    true,
>    /* SMB2_WRITE */ false,
>    /* SMB2_LOCK */    false,
>    /* SMB2_IOCTL */ true,
>    /* SMB2_CANCEL */ false, /* BB CHECK this not listed in documentation */
>    /* SMB2_ECHO */ false,
>    /* SMB2_QUERY_DIRECTORY */ true,
>    /* SMB2_CHANGE_NOTIFY */ true,
>    /* SMB2_QUERY_INFO */ true,
>    /* SMB2_SET_INFO */ false,
>    /* SMB2_OPLOCK_BREAK */ false
>};
>
>
>Any idea why sparse is complaining about the first two lines of the
>arry of booleans? Is this just a sparse bug?
>

Hmm, looks weird, sparse doesn't understand bool well?

Can you construct a small C program to show this? Something like:

typedef _Bool bool;
enum {
     false = 0,
     true = 1
};

static const bool foo[10] = {
       true,
       true,
       false,
       false,
};

      reply	other threads:[~2010-05-07  6:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06 23:43 Steve French
2010-05-07  6:11 ` Américo Wang [this message]

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=20100507061136.GC5921@cr0.nay.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smfrench@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

all inboxes | Powered by JetHome®