PageRenderTime 73ms CodeModel.GetById 71ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/include/linux/typecheck.h

https://github.com/airy09/android_kernel_sony_apq8064
C Header | 24 lines | 13 code | 3 blank | 8 comment | 1 complexity | b126b84611d4b4e30fdc865112fc72be MD5 | raw file
 1#ifndef TYPECHECK_H_INCLUDED
 2#define TYPECHECK_H_INCLUDED
 3
 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; \
13})
14
15/*
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.)
18 */
19#define typecheck_fn(type,function) \
20({	typeof(type) __tmp = function; \
21	(void)__tmp; \
22})
23
24#endif		/* TYPECHECK_H_INCLUDED */