File: /Users/paulross/dev/linux/linux-3.13/include/linux/typecheck.h

Green shading in the line number column means the source is part of the translation unit, red means it is conditionally excluded. Highlighted line numbers link to the translation unit page. Highlighted macros link to the macro page.

       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 */
      25: