Linux 4.6-rc6
[cris-mirror.git] / include / linux / typecheck.h
blobeb5b74a575be84c49197e029a7449420eee353af
1 #ifndef TYPECHECK_H_INCLUDED
2 #define TYPECHECK_H_INCLUDED
4 /*
5 * Check at compile time that something is of a particular type.
6 * Always evaluates to 1 so you may use it easily in comparisons.
7 */
8 #define typecheck(type,x) \
9 ({ type __dummy; \
10 typeof(x) __dummy2; \
11 (void)(&__dummy == &__dummy2); \
12 1; \
16 * Check at compile time that 'function' is a certain type, or is a pointer
17 * to that type (needs to use typedef for the function type.)
19 #define typecheck_fn(type,function) \
20 ({ typeof(type) __tmp = function; \
21 (void)__tmp; \
24 #endif /* TYPECHECK_H_INCLUDED */