Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __LINUX_COMPILER_TYPES_H
0003 #define __LINUX_COMPILER_TYPES_H
0004 
0005 /* Builtins */
0006 
0007 /*
0008  * __has_builtin is supported on gcc >= 10, clang >= 3 and icc >= 21.
0009  * In the meantime, to support gcc < 10, we implement __has_builtin
0010  * by hand.
0011  */
0012 #ifndef __has_builtin
0013 #define __has_builtin(x) (0)
0014 #endif
0015 
0016 #ifdef __CHECKER__
0017 /* context/locking */
0018 # define __must_hold(x) __attribute__((context(x,1,1)))
0019 # define __acquires(x)  __attribute__((context(x,0,1)))
0020 # define __releases(x)  __attribute__((context(x,1,0)))
0021 # define __acquire(x)   __context__(x,1)
0022 # define __release(x)   __context__(x,-1)
0023 # define __cond_lock(x,c)   ((c) ? ({ __acquire(x); 1; }) : 0)
0024 #else /* __CHECKER__ */
0025 /* context/locking */
0026 # define __must_hold(x)
0027 # define __acquires(x)
0028 # define __releases(x)
0029 # define __acquire(x)   (void)0
0030 # define __release(x)   (void)0
0031 # define __cond_lock(x,c) (c)
0032 #endif /* __CHECKER__ */
0033 
0034 /* Compiler specific macros. */
0035 #ifdef __GNUC__
0036 #include <linux/compiler-gcc.h>
0037 #endif
0038 
0039 #ifndef asm_volatile_goto
0040 #define asm_volatile_goto(x...) asm goto(x)
0041 #endif
0042 
0043 #endif /* __LINUX_COMPILER_TYPES_H */