1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef TYPECHECK_H_INCLUDED
3 #define TYPECHECK_H_INCLUDED
6 * Check at compile time that something is of a particular type.
7 * Always evaluates to 1 so you may use it easily in comparisons.
9 #define typecheck(type,x) \
12 (void)(&__dummy == &__dummy2); \
17 * Check at compile time that 'function' is a certain type, or is a pointer
18 * to that type (needs to use typedef for the function type.)
20 #define typecheck_fn(type,function) \
21 ({ typeof(type) __tmp = function; \
25 #endif /* TYPECHECK_H_INCLUDED */