mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparse: Fix BUILD_BUG_ON_{ZERO,NULL} definitions
@ 2011-06-24 21:45 Ben Hutchings
  2011-06-24 22:28 ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2011-06-24 21:45 UTC (permalink / raw)
  To: LKML; +Cc: KOSAKI Motohiro

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.

 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__ */
 
-- 
1.7.4.4


-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-24 22:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-24 21:45 [PATCH] sparse: Fix BUILD_BUG_ON_{ZERO,NULL} definitions Ben Hutchings
2011-06-24 22:28 ` Randy Dunlap
2011-06-24 22:48   ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®