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 # if defined(__CYGWIN__) || defined(__WIN32__)
13 # define WIMLIBAPI __declspec(dllexport)
15 # define WIMLIBAPI __attribute__((visibility("default")))
17 # define _always_inline_attribute inline __attribute__((always_inline))
18 # define _no_inline_attribute __attribute__((noinline))
19 # define _packed_attribute __attribute__((packed))
20 # define _format_attribute(type, format_str, args_start) \
21 /*__attribute__((format(type, format_str, args_start))) */
22 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
23 # define _cold_attribute __attribute__((cold))
25 # define _cold_attribute
27 # define _malloc_attribute __attribute__((malloc))
28 # define _warn_unused_result_attribute __attribute__((warn_unused_result))
29 # define _aligned_attribute(size) __attribute__((aligned(size)))
30 # define likely(x) __builtin_expect(!!(x), 1)
31 # define unlikely(x) __builtin_expect(!!(x), 0)
32 # define inline inline __attribute__((always_inline))
33 # define prefetch(x) __builtin_prefetch(x)
34 # define is_constant(x) __builtin_constant_p(x)
37 # define _always_inline_attribute inline
38 # define _no_inline_attribute
39 # define _format_attribute(type, format_str, args_start)
40 # define _cold_attribute
41 # define _packed_attribute
42 # define _malloc_attribute
43 # define _warn_unused_result_attribute
44 # define _aligned_attribute(size)
45 # define likely(x) (x)
46 # define unlikely(x) (x)
48 # define is_constant(x) (0)
52 # define _bitwise_attr __attribute__((bitwise))
53 # define _force_attr __attribute__((force))
55 # define _bitwise_attr
59 #endif /* _WIMLIB_COMPILER_H */