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 _packed_attribute __attribute__((packed))
19 # define _format_attribute(type, format_str, args_start) \
20 /*__attribute__((format(type, format_str, args_start))) */
21 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
22 # define _cold_attribute __attribute__((cold))
24 # define _cold_attribute
26 # define _malloc_attribute __attribute__((malloc))
27 # define _warn_unused_result_attribute __attribute__((warn_unused_result))
28 # define _aligned_attribute(size) __attribute__((aligned(size)))
29 # define likely(x) __builtin_expect(!!(x), 1)
30 # define unlikely(x) __builtin_expect(!!(x), 0)
31 # define inline inline __attribute__((always_inline))
32 # define prefetch(x) __builtin_prefetch(x)
35 # define _always_inline_attribute inline
36 # define _format_attribute(type, format_str, args_start)
37 # define _cold_attribute
38 # define _packed_attribute
39 # define _malloc_attribute
40 # define _warn_unused_result_attribute
41 # define _aligned_attribute(size)
42 # define likely(x) (x)
43 # define unlikely(x) (x)
47 #endif /* _WIMLIB_COMPILER_H */