Commit 7a4542c9 authored by David S. Miller's avatar David S. Miller Committed by Linus Torvalds

[KERNEL]: Add typecheck macro for verifying types at compile time.

parent 23f3c02f
......@@ -188,6 +188,17 @@ extern void dump_stack(void);
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
/*
* Check at compile time that something is of a particular type.
* Always evaluates to 1 so you may use it easily in conparisons.
*/
#define typecheck(type,x) \
({ type __dummy; \
typeof(x) __dummy2; \
(void)(&__dummy == &__dummy2); \
1; \
})
#endif /* __KERNEL__ */
#define SI_LOAD_SHIFT 16
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment