aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2008-07-25 04:45:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:26 -0400
commite0deaff470900a4c3222ca7139f6c9639e26a2f5 (patch)
treeaf18056ba150a3f4fd61f397c83699b2d6231cdc /include/linux/kernel.h
parent5df439ef06d4173357711a04740aa8bfcf50d621 (diff)
split the typecheck macros out of include/linux/kernel.h
Needed to fix up a recursive include snafu in locking-add-typecheck-on-irqsave-and-friends-for-correct-flags.patch Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h21
1 files changed, 1 insertions, 20 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f9cd7a513f9c..5c4b1251e110 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -14,6 +14,7 @@
14#include <linux/compiler.h> 14#include <linux/compiler.h>
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/log2.h> 16#include <linux/log2.h>
17#include <linux/typecheck.h>
17#include <asm/byteorder.h> 18#include <asm/byteorder.h>
18#include <asm/bug.h> 19#include <asm/bug.h>
19 20
@@ -441,26 +442,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
441 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 442 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
442 (type *)( (char *)__mptr - offsetof(type,member) );}) 443 (type *)( (char *)__mptr - offsetof(type,member) );})
443 444
444/*
445 * Check at compile time that something is of a particular type.
446 * Always evaluates to 1 so you may use it easily in comparisons.
447 */
448#define typecheck(type,x) \
449({ type __dummy; \
450 typeof(x) __dummy2; \
451 (void)(&__dummy == &__dummy2); \
452 1; \
453})
454
455/*
456 * Check at compile time that 'function' is a certain type, or is a pointer
457 * to that type (needs to use typedef for the function type.)
458 */
459#define typecheck_fn(type,function) \
460({ typeof(type) __tmp = function; \
461 (void)__tmp; \
462})
463
464struct sysinfo; 445struct sysinfo;
465extern int do_sysinfo(struct sysinfo *info); 446extern int do_sysinfo(struct sysinfo *info);
466 447