xref: /openbsd/sys/dev/pci/drm/include/linux/compiler.h (revision 5a38ef86)
1 /* Public domain. */
2 
3 #ifndef _LINUX_COMPILER_H
4 #define _LINUX_COMPILER_H
5 
6 #include <linux/kconfig.h>
7 #include <sys/atomic.h>		/* for READ_ONCE() WRITE_ONCE() */
8 
9 #define unlikely(x)	__builtin_expect(!!(x), 0)
10 #define likely(x)	__builtin_expect(!!(x), 1)
11 
12 #define __force
13 #define __acquires(x)
14 #define __releases(x)
15 #define __read_mostly
16 #define __iomem
17 #define __must_check
18 #define __init
19 #define __exit
20 #define __deprecated
21 #define __always_unused	__attribute__((__unused__))
22 #define __maybe_unused	__attribute__((__unused__))
23 #define __always_inline	__attribute__((__always_inline__))
24 #define noinline	__attribute__((__noinline__))
25 #define fallthrough	do {} while (0)
26 
27 #ifndef __user
28 #define __user
29 #endif
30 
31 #define barrier()	__asm __volatile("" : : : "memory")
32 
33 #define __printf(x, y)	__attribute__((__format__(__kprintf__,x,y)))
34 
35 /* The Linux code doesn't meet our usual standards! */
36 #ifdef __clang__
37 #pragma clang diagnostic ignored "-Winitializer-overrides"
38 #pragma clang diagnostic ignored "-Wtautological-compare"
39 #pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
40 #pragma clang diagnostic ignored "-Wunused-function"
41 #pragma clang diagnostic ignored "-Wunused-variable"
42 #else
43 #pragma GCC diagnostic ignored "-Wformat-zero-length"
44 #endif
45 
46 #endif
47