mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Sparse warning: "initializer entry defined twice"
@ 2010-05-06 23:43 Steve French
  2010-05-07  6:11 ` Américo Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2010-05-06 23:43 UTC (permalink / raw)
  To: LKML, linux-fsdevel

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?

--
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Sparse warning: "initializer entry defined twice"
  2010-05-06 23:43 Sparse warning: "initializer entry defined twice" Steve French
@ 2010-05-07  6:11 ` Américo Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Américo Wang @ 2010-05-07  6:11 UTC (permalink / raw)
  To: Steve French; +Cc: LKML, linux-fsdevel

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,
};

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-07  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-06 23:43 Sparse warning: "initializer entry defined twice" Steve French
2010-05-07  6:11 ` Américo Wang

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®