From: Chuck Ebbert <76306.1226@compuserve.com> Date: Mon, 9 Jan 2006 23:59:17 +0000 (-0800) Subject: [PATCH] mutex subsystem, add typecheck_fn(type, function) X-Git-Tag: v2.6.16-rc1~655^2~16 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=711a660dc2064013a2b0167ee67389707fc9cac3;p=linux-2.6-omap-h63xx.git [PATCH] mutex subsystem, add typecheck_fn(type, function) 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 --- diff --git a/include/linux/kernel.h b/include/linux/kernel.h index ca7ff8fdd09..d0e6ca3b00e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -286,6 +286,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