4 * The author dedicates this file to the public domain.
5 * You can do whatever you want with this file.
8 #ifndef _WIMLIB_COMPILER_H
9 #define _WIMLIB_COMPILER_H
12 # include "wimlib/compiler-gcc.h"
14 # error "Unrecognized compiler. Please add a header file for your compiler."
21 #ifndef _packed_attribute
22 # error "missing required definition of _packed_attribute"
25 #ifndef _aligned_attribute
26 # error "missing required definition of _aligned_attribute"
29 #ifndef _may_alias_attribute
30 # error "missing required definition of _may_alias_attribute"
34 # define likely(expr) (expr)
38 # define unlikely(expr) (expr)
42 # define prefetch(addr)
45 #ifndef _cold_attribute
46 # define _cold_attribute
49 #ifndef _malloc_attribute
50 # define _malloc_attribute
53 #ifndef _format_attribute
54 # define _format_attribute(type, format_str, format_start)
61 /* Same as 'noinline', but 'noinline_for_stack' documents that 'noinline' is
62 * being used to prevent the annotated function from being inlined into a
63 * recursive function and increasing its stack usage. */
64 #define noinline_for_stack noinline
66 #ifndef CPU_IS_BIG_ENDIAN
67 # error "missing required endianness definition"
70 #define CPU_IS_LITTLE_ENDIAN (!CPU_IS_BIG_ENDIAN)
72 #ifndef UNALIGNED_ACCESS_SPEED
73 # define UNALIGNED_ACCESS_SPEED 0
76 #define UNALIGNED_ACCESS_IS_ALLOWED (UNALIGNED_ACCESS_SPEED >= 1)
77 #define UNALIGNED_ACCESS_IS_FAST (UNALIGNED_ACCESS_SPEED >= 2)
78 #define UNALIGNED_ACCESS_IS_VERY_FAST (UNALIGNED_ACCESS_SPEED >= 3)
81 # error "missing required definition of typeof"
84 #if !defined(min) || !defined(max) || !defined(swap)
85 # error "missing required definitions of min(), max(), and swap() macros"
89 # define _bitwise_attr __attribute__((bitwise))
90 # define _force_attr __attribute__((force))
92 # define _bitwise_attr
97 # define BUILD_BUG_ON(expr) ((void)sizeof(char[1 - 2*!!(expr)]))
100 #endif /* _WIMLIB_COMPILER_H */