Browse Source

[PATCH] mutex subsystem, add typecheck_fn(type, function)

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

Modified-by: Ingo Molnar <mingo@elte.hu>

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

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Chuck Ebbert 19 years ago
parent
commit
711a660dc2
1 changed files with 9 additions and 0 deletions
  1. 9 0
      include/linux/kernel.h

+ 9 - 0
include/linux/kernel.h

@@ -286,6 +286,15 @@ extern void dump_stack(void);
 	1; \
 	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__ */
 #endif /* __KERNEL__ */
 
 
 #define SI_LOAD_SHIFT	16
 #define SI_LOAD_SHIFT	16