1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_COMPILER_TYPES_H
3#define __LINUX_COMPILER_TYPES_H
4
5/* Builtins */
6
7/*
8 * __has_builtin is supported on gcc >= 10, clang >= 3 and icc >= 21.
9 * In the meantime, to support gcc < 10, we implement __has_builtin
10 * by hand.
11 */
12#ifndef __has_builtin
13#define __has_builtin(x) (0)
14#endif
15
16#ifdef __CHECKER__
17/* context/locking */
18# define __must_hold(x)	__attribute__((context(x,1,1)))
19# define __acquires(x)	__attribute__((context(x,0,1)))
20# define __releases(x)	__attribute__((context(x,1,0)))
21# define __acquire(x)	__context__(x,1)
22# define __release(x)	__context__(x,-1)
23# define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0)
24#else /* __CHECKER__ */
25/* context/locking */
26# define __must_hold(x)
27# define __acquires(x)
28# define __releases(x)
29# define __acquire(x)	(void)0
30# define __release(x)	(void)0
31# define __cond_lock(x,c) (c)
32#endif /* __CHECKER__ */
33
34/* Compiler specific macros. */
35#ifdef __GNUC__
36#include <linux/compiler-gcc.h>
37#endif
38
39#ifndef asm_goto_output
40#define asm_goto_output(x...) asm goto(x)
41#endif
42
43#endif /* __LINUX_COMPILER_TYPES_H */
44