lkml.org 
[lkml]   [2011]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sparse: Fix BUILD_BUG_ON_{ZERO,NULL} definitions
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 ***


\
 
 \ /
  Last update: 2011-06-25 00:31    [W:0.030 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site