Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[patch 02/21] mutex subsystem, add typecheck_fn(type, function)

0 views
Skip to first unread message

Ingo Molnar

unread,
Jan 4, 2006, 9:42:48 AM1/4/06
to lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven, Nicolas Pitre, Jes Sorensen, Al Viro, Oleg Nesterov, David Howells, Alan Cox, Christoph Hellwig, Andi Kleen, Russell King
From: Chuck Ebbert <76306...@compuserve.com>

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

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

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

Signed-off-by: Chuck Ebbert <76306...@compuserve.com>
Signed-off-by: Ingo Molnar <mi...@elte.hu>

----

include/linux/kernel.h | 9 +++++++++
1 files changed, 9 insertions(+)

Index: linux/include/linux/kernel.h
===================================================================
--- linux.orig/include/linux/kernel.h
+++ 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Ingo Molnar

unread,
Jan 5, 2006, 10:38:32 AM1/5/06
to lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven, Nicolas Pitre, Jes Sorensen, Al Viro, Oleg Nesterov, David Howells, Alan Cox, Christoph Hellwig, Andi Kleen, Russell King
0 new messages