From: Chuck Ebbert <76306.1226@compuserve.com> Add typecheck_fn(type, function) to do type-checking of function pointers. Modified-by: Ingo Molnar (made it typeof() based, instead of typedef based.) Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton --- include/linux/kernel.h | 9 +++++++++ 1 files changed, 9 insertions(+) diff -puN include/linux/kernel.h~mutex-subsystem-add-typecheck_fntype-function include/linux/kernel.h --- 25/include/linux/kernel.h~mutex-subsystem-add-typecheck_fntype-function Fri Jan 6 17:04:38 2006 +++ 25-akpm/include/linux/kernel.h Fri Jan 6 17:04:38 2006 @@ -288,6 +288,15 @@ extern void dump_stack(void); 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 /* __KERNEL__ */ #define SI_LOAD_SHIFT 16 _