From: Randy Dunlap <rdunlap@xenotime.net>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: Re: [PATCH] sparse: Fix BUILD_BUG_ON_{ZERO,NULL} definitions
Date: Fri, 24 Jun 2011 15:28:53 -0700 [thread overview]
Message-ID: <20110624152853.6fd65f41.rdunlap@xenotime.net> (raw)
In-Reply-To: <1308951912.3034.23.camel@bwh-desktop>
On Fri, 24 Jun 2011 22:45:12 +0100 Ben Hutchings wrote:
> Commit 903c0c7cdc21f2ccb7562a7bbc70289c0c2b16ad ('sparse: define dummy
> BUILD_BUG_ON definition for sparse') left these two broken. The ZERO
> or NULL suffix specifies what the macro should expand to, not the
> value that would indicate a bug.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> sparse currently reports a syntax error and no useful warnings for any
> source file which uses one of these macros. Since module_param() uses
> BUILD_BUG_ON_ZERO(), that's a lot of source files.
>
> Ben.
This patch from 2011-MAY-30 also fixes these warnings, but the typecasting
in yours is probably better. :)
http://marc.info/?l=linux-kernel&m=130677145629121&w=2
Wait, 3.0-rc4 already has the above patch. Is yours still needed?
> include/linux/kernel.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index fb0e732..fccd366 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -671,8 +671,8 @@ struct sysinfo {
>
> #ifdef __CHECKER__
> #define BUILD_BUG_ON_NOT_POWER_OF_2(n)
> -#define BUILD_BUG_ON_ZERO(e)
> -#define BUILD_BUG_ON_NULL(e)
> +#define BUILD_BUG_ON_ZERO(e) ((size_t)0)
> +#define BUILD_BUG_ON_NULL(e) ((void *)0)
> #define BUILD_BUG_ON(condition)
> #else /* __CHECKER__ */
>
> --
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
next prev parent reply other threads:[~2011-06-24 22:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 21:45 [PATCH] sparse: Fix BUILD_BUG_ON_{ZERO,NULL} definitions Ben Hutchings
2011-06-24 22:28 ` Randy Dunlap [this message]
2011-06-24 22:48 ` Ben Hutchings
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=20110624152853.6fd65f41.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=bhutchings@solarflare.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@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