All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Randy Dunlap <rdunlap@xenotime.net>
Cc: linux-sparse@vger.kernel.org
Subject: Re: linux kernel warnings/errors
Date: Tue, 23 Feb 2010 12:59:42 -0800	[thread overview]
Message-ID: <20100223205942.GA32491@feather> (raw)
In-Reply-To: <20100223114906.61d4e001.rdunlap@xenotime.net>

On Tue, Feb 23, 2010 at 11:49:06AM -0800, Randy Dunlap wrote:
> Hi,
> 
> You probably know that sparse produces a ton of errors & warnings when
> run on the Linux kernel tree (a little over 1 MB in my latest 'make C=1'
> on x86_64 arch.).
> 
> I'm wondering if all of these are valid.
> 
> Examples:
> 
> 
> 1.  Use of the BUILD_BUG_ON() macro causes this error from sparse:
> 
> arch/x86/kernel/paravirt.c:101:9: error: invalid bitfield width, -1.
> 
> include/linux/kernel.h:
> 
> /* Force a compilation error if condition is true */
> #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
> 
> /* Force a compilation error if condition is true, but also produce a
>    result (of value 0 and type size_t), so the expression can be used
>    e.g. in a structure initializer (or where-ever else comma expressions
>    aren't permitted). */
> #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))

In theory that should only happen if the BUILD_BUG_ON_ZERO actually
triggers, and thus sparse fails to build just as GCC would.  If sparse
has this problem and GCC doesn't, could you please provide a minimal
test case?

> 2.  drivers/block/drbd/drbd_int.h uses __protected_by(var);
> this seems to be unknown to sparse.
> 
> #ifdef __CHECKER__
> # define __protected_by(x)       __attribute__((require_context(x,1,999,"rdwr")))
> 
> sparse says many times:
> 
> drivers/block/drbd/drbd_int.h:887:39: error: attribute 'require_context': unknown attribute

That looks broken.  A few patches went around for new Sparse
context-tracking features, one of which got reverted before the 0.4.2
release, but I don't think any of them would have allowed *that*.

- Josh Triplett

  reply	other threads:[~2010-02-23 21:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23 19:49 linux kernel warnings/errors Randy Dunlap
2010-02-23 20:59 ` Josh Triplett [this message]
2010-02-23 22:20   ` Randy Dunlap
2010-02-23 22:40 ` linux kernel warnings/errors (#7) Randy Dunlap
2010-02-24  0:55 ` linux kernel warnings/errors (#8) Randy Dunlap

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=20100223205942.GA32491@feather \
    --to=josh@joshtriplett.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.