Skip to contentSkip to conversation

mutex subsystem, add typecheck_fn(type, function)

PATCH In review Ingo Molnar 1 participant 1 message Jan 3, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 2/19 mutex subsystem, add typecheck_fn(type, function)

From: Chuck Ebbert <[email protected]>

add typecheck_fn(type, function) to do type-checking of function pointers.

(made it typeof() based, instead of typedef based.)

----

 include/linux/kernel.h |    9 +++++++++
 1 files changed, 9 insertions(+)
include/linux/kernel.h +9 -0
Index: linux/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