linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ivo van Doorn <ivdoorn@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Pavel Roskin <proski@gnu.org>,
	linux-wireless@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: sparse using insane amounts of memory
Date: Thu, 8 Mar 2007 20:02:41 +0100	[thread overview]
Message-ID: <20070308190241.GA9792@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0703081023490.10832@woody.linux-foundation.org>

> 
> You can then make it a compile-time failure with something like
> 
> 	extern unsigned int this_doesnt_exist_and_wont_link;
> 
> 	is_contiguous_mask(x) ? (x) : this_doesnt_exist_and_wont_link;
> 
> which returns "x" if it's ok, and an unlinkable expression if it isn't.

Or you can use the already defined macros in kernel.h for this:

/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(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(char[1 - 2 * !!(e)]) - 1)

	Sam

  reply	other threads:[~2007-03-08 19:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-08  2:02 sparse using insane amounts of memory Johannes Berg
2007-03-08 16:33 ` Pavel Roskin
2007-03-08 16:45   ` Johannes Berg
2007-03-08 17:34     ` Pavel Roskin
2007-03-08 17:42       ` Johannes Berg
2007-03-08 17:43       ` Johannes Berg
2007-03-08 18:08         ` Ivo van Doorn
2007-03-08 18:54           ` Linus Torvalds
2007-03-08 19:02             ` Sam Ravnborg [this message]
2007-03-08 19:08             ` Linus Torvalds
2007-03-10  5:05               ` Darren Jenkins
2007-03-08 19:26             ` Ivo van Doorn
2007-03-09  1:12             ` OT [Re: sparse using insane amounts of memory] Tommy Thorn
2007-03-09  2:15               ` OT David Miller

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=20070308190241.GA9792@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=ivdoorn@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=proski@gnu.org \
    --cc=torvalds@linux-foundation.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).