* [patch 02/21] mutex subsystem, add typecheck_fn(type, function)
@ 2006-01-04 14:42 Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-01-04 14:42 UTC (permalink / raw)
To: lkml
Cc: 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.1226@compuserve.com>
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>
----
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [patch 02/21] mutex subsystem, add typecheck_fn(type, function)
@ 2006-01-05 15:37 Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-01-05 15:37 UTC (permalink / raw)
To: lkml
Cc: 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.1226@compuserve.com>
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>
----
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-01-05 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04 14:42 [patch 02/21] mutex subsystem, add typecheck_fn(type, function) Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2006-01-05 15:37 Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox