From 21e5da4f96d924aeaa3328c982b9129f61310794 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 25 Jul 2008 01:45:24 -0700 Subject: [PATCH] --- yaml --- r: 105782 b: refs/heads/master c: e0deaff470900a4c3222ca7139f6c9639e26a2f5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/kernel.h | 21 +-------------------- trunk/include/linux/typecheck.h | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 trunk/include/linux/typecheck.h diff --git a/[refs] b/[refs] index 313800517d22..f9158c15cb78 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5df439ef06d4173357711a04740aa8bfcf50d621 +refs/heads/master: e0deaff470900a4c3222ca7139f6c9639e26a2f5 diff --git a/trunk/include/linux/kernel.h b/trunk/include/linux/kernel.h index f9cd7a513f9c..5c4b1251e110 100644 --- a/trunk/include/linux/kernel.h +++ b/trunk/include/linux/kernel.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -441,26 +442,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte) const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) -/* - * Check at compile time that something is of a particular type. - * Always evaluates to 1 so you may use it easily in comparisons. - */ -#define typecheck(type,x) \ -({ type __dummy; \ - typeof(x) __dummy2; \ - (void)(&__dummy == &__dummy2); \ - 1; \ -}) - -/* - * Check at compile time that 'function' is a certain type, or is a pointer - * to that type (needs to use typedef for the function type.) - */ -#define typecheck_fn(type,function) \ -({ typeof(type) __tmp = function; \ - (void)__tmp; \ -}) - struct sysinfo; extern int do_sysinfo(struct sysinfo *info); diff --git a/trunk/include/linux/typecheck.h b/trunk/include/linux/typecheck.h new file mode 100644 index 000000000000..eb5b74a575be --- /dev/null +++ b/trunk/include/linux/typecheck.h @@ -0,0 +1,24 @@ +#ifndef TYPECHECK_H_INCLUDED +#define TYPECHECK_H_INCLUDED + +/* + * Check at compile time that something is of a particular type. + * Always evaluates to 1 so you may use it easily in comparisons. + */ +#define typecheck(type,x) \ +({ type __dummy; \ + typeof(x) __dummy2; \ + (void)(&__dummy == &__dummy2); \ + 1; \ +}) + +/* + * Check at compile time that 'function' is a certain type, or is a pointer + * to that type (needs to use typedef for the function type.) + */ +#define typecheck_fn(type,function) \ +({ typeof(type) __tmp = function; \ + (void)__tmp; \ +}) + +#endif /* TYPECHECK_H_INCLUDED */