jcs's openbsd hax
openbsd
at jcs 55 lines 1.5 kB view raw
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 __nonstring 22#define __always_unused __attribute__((__unused__)) 23#define __maybe_unused __attribute__((__unused__)) 24#define __always_inline inline __attribute__((__always_inline__)) 25#define noinline __attribute__((__noinline__)) 26#define noinline_for_stack __attribute__((__noinline__)) 27#define fallthrough do {} while (0) 28#define __counted_by(x) 29#define __cleanup(fn) __attribute__((__cleanup__(fn))) 30 31#define __PASTE(x,y) __CONCAT(x,y) 32 33#ifndef __user 34#define __user 35#endif 36 37#define barrier() __asm volatile("" : : : "memory") 38 39#define __printf(x, y) __attribute__((__format__(__kprintf__,x,y))) 40 41/* The Linux code doesn't meet our usual standards! */ 42#ifdef __clang__ 43#pragma clang diagnostic ignored "-Winitializer-overrides" 44#pragma clang diagnostic ignored "-Wunused-function" 45#pragma clang diagnostic ignored "-Wunused-variable" 46#pragma clang diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" 47#else 48#pragma GCC diagnostic ignored "-Wformat-zero-length" 49#endif 50 51#define __diag_push() 52#define __diag_ignore_all(x, y) 53#define __diag_pop() 54 55#endif