linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Ben Pfaff <blp@nicira.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [PATCH] evaluate: Allow sizeof(_Bool) to succeed.
Date: Mon, 9 May 2011 13:31:10 -0700	[thread overview]
Message-ID: <BANLkTim26gM+WxF+XSjZTVf+sL9xLLtCoA@mail.gmail.com> (raw)
In-Reply-To: <20110509200231.GG2971@nicira.com>

On Mon, May 9, 2011 at 1:02 PM, Ben Pfaff <blp@nicira.com> wrote:

> Thank you for applying my patch.  It does work for me, in the sense
> that I get a warning instead of an error now, but I'm not so happy to
> get any diagnostic at all.  Is there some reason why sizeof(_Bool)
> warrants a warning when, say, sizeof(long) does not?  After all, both
> sizes are implementation defined.

Because sizeof(_Bool) is a little bit special compare to sizeof(long).
In the case of long, all sizeof(long) * 8 bits are use in the actual value.
But for the _Bool, only the 1 bit is used in the 8 bits size. In other words,
the _Bool has a special case of the actual bit size is not a multiple of 8.

Sparse has two hats, it is a C compiler front end, and more often it is
used in the Linux kernel source sanitize checking. Depending on the sizeof
_Bool sounds a little bit suspicious in the kernel. I would love to the heard
your actual usage case of the sizeof(_Bool). Why do you care about this
warning?

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-05-09 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 23:39 [PATCH] evaluate: Allow sizeof(_Bool) to succeed Ben Pfaff
2011-05-07 20:37 ` Christopher Li
2011-05-09 20:02   ` Ben Pfaff
2011-05-09 20:31     ` Christopher Li [this message]
2011-05-09 20:49       ` Ben Pfaff
2011-05-12  0:09         ` Christopher Li
2011-05-12 20:48           ` Ben Pfaff

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=BANLkTim26gM+WxF+XSjZTVf+sL9xLLtCoA@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=blp@nicira.com \
    --cc=linux-sparse@vger.kernel.org \
    /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).