gpu_neon: revive the old tests
[pcsx_rearmed.git] / deps / libchdr / deps / lzma-24.05 / include / Compiler.h
1 /* Compiler.h : Compiler specific defines and pragmas
2 2024-01-22 : Igor Pavlov : Public domain */
3
4 #ifndef ZIP7_INC_COMPILER_H
5 #define ZIP7_INC_COMPILER_H
6
7 #if defined(__clang__)
8 # define Z7_CLANG_VERSION  (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
9 #endif
10 #if defined(__clang__) && defined(__apple_build_version__)
11 # define Z7_APPLE_CLANG_VERSION   Z7_CLANG_VERSION
12 #elif defined(__clang__)
13 # define Z7_LLVM_CLANG_VERSION    Z7_CLANG_VERSION
14 #elif defined(__GNUC__)
15 # define Z7_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
16 #endif
17
18 #ifdef _MSC_VER
19 #if !defined(__clang__) && !defined(__GNUC__)
20 #define Z7_MSC_VER_ORIGINAL _MSC_VER
21 #endif
22 #endif
23
24 #if defined(__MINGW32__) || defined(__MINGW64__)
25 #define Z7_MINGW
26 #endif
27
28 #if defined(__LCC__) && (defined(__MCST__) || defined(__e2k__))
29 #define Z7_MCST_LCC
30 #define Z7_MCST_LCC_VERSION (__LCC__ * 100 + __LCC_MINOR__)
31 #endif
32
33 /*
34 #if defined(__AVX2__) \
35     || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900) \
36     || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 40600) \
37     || defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30100) \
38     || defined(Z7_MSC_VER_ORIGINAL) && (Z7_MSC_VER_ORIGINAL >= 1800) \
39     || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400)
40     #define Z7_COMPILER_AVX2_SUPPORTED
41   #endif
42 #endif
43 */
44
45 // #pragma GCC diagnostic ignored "-Wunknown-pragmas"
46
47 #ifdef __clang__
48 // padding size of '' with 4 bytes to alignment boundary
49 #pragma GCC diagnostic ignored "-Wpadded"
50
51 #if defined(Z7_LLVM_CLANG_VERSION) && (__clang_major__ == 13) \
52   && defined(__FreeBSD__)
53 // freebsd:
54 #pragma GCC diagnostic ignored "-Wexcess-padding"
55 #endif
56
57 #if __clang_major__ >= 16
58 #pragma GCC diagnostic ignored "-Wunsafe-buffer-usage"
59 #endif
60
61 #if __clang_major__ == 13
62 #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 16)
63 // cheri
64 #pragma GCC diagnostic ignored "-Wcapability-to-integer-cast"
65 #endif
66 #endif
67
68 #if __clang_major__ == 13
69   // for <arm_neon.h>
70   #pragma GCC diagnostic ignored "-Wreserved-identifier"
71 #endif
72
73 #endif // __clang__
74
75 #if defined(_WIN32) && defined(__clang__) && __clang_major__ >= 16
76 // #pragma GCC diagnostic ignored "-Wcast-function-type-strict"
77 #define Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION \
78   _Pragma("GCC diagnostic ignored \"-Wcast-function-type-strict\"")
79 #else
80 #define Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
81 #endif
82
83 typedef void (*Z7_void_Function)(void);
84 #if defined(__clang__) || defined(__GNUC__)
85 #define Z7_CAST_FUNC_C  (Z7_void_Function)
86 #elif defined(_MSC_VER) && _MSC_VER > 1920
87 #define Z7_CAST_FUNC_C  (void *)
88 // #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
89 #else
90 #define Z7_CAST_FUNC_C
91 #endif
92 /*
93 #if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
94   // #pragma GCC diagnostic ignored "-Wcast-function-type"
95 #endif
96 */
97 #ifdef __GNUC__
98 #if defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40000) && (Z7_GCC_VERSION < 70000)
99 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
100 #endif
101 #endif
102
103
104 #ifdef _MSC_VER
105
106   #ifdef UNDER_CE
107     #define RPC_NO_WINDOWS_H
108     /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */
109     #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union
110     #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
111   #endif
112
113 #if defined(_MSC_VER) && _MSC_VER >= 1800
114 #pragma warning(disable : 4464) // relative include path contains '..'
115 #endif
116
117 // == 1200 : -O1 : for __forceinline
118 // >= 1900 : -O1 : for printf
119 #pragma warning(disable : 4710) // function not inlined
120
121 #if _MSC_VER < 1900
122 // winnt.h: 'Int64ShllMod32'
123 #pragma warning(disable : 4514) // unreferenced inline function has been removed
124 #endif
125     
126 #if _MSC_VER < 1300
127 // #pragma warning(disable : 4702) // unreachable code
128 // Bra.c : -O1:
129 #pragma warning(disable : 4714) // function marked as __forceinline not inlined
130 #endif
131
132 /*
133 #if _MSC_VER > 1400 && _MSC_VER <= 1900
134 // strcat: This function or variable may be unsafe
135 // sysinfoapi.h: kit10: GetVersion was declared deprecated
136 #pragma warning(disable : 4996)
137 #endif
138 */
139
140 #if _MSC_VER > 1200
141 // -Wall warnings
142
143 #pragma warning(disable : 4711) // function selected for automatic inline expansion
144 #pragma warning(disable : 4820) // '2' bytes padding added after data member
145
146 #if _MSC_VER >= 1400 && _MSC_VER < 1920
147 // 1400: string.h: _DBG_MEMCPY_INLINE_
148 // 1600 - 191x : smmintrin.h __cplusplus'
149 // is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
150 #pragma warning(disable : 4668)
151
152 // 1400 - 1600 : WinDef.h : 'FARPROC' :
153 // 1900 - 191x : immintrin.h: _readfsbase_u32
154 // no function prototype given : converting '()' to '(void)'
155 #pragma warning(disable : 4255)
156 #endif
157
158 #if _MSC_VER >= 1914
159 // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
160 #pragma warning(disable : 5045)
161 #endif
162
163 #endif // _MSC_VER > 1200
164 #endif // _MSC_VER
165
166
167 #if defined(__clang__) && (__clang_major__ >= 4)
168   #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
169     _Pragma("clang loop unroll(disable)") \
170     _Pragma("clang loop vectorize(disable)")
171   #define Z7_ATTRIB_NO_VECTORIZE
172 #elif defined(__GNUC__) && (__GNUC__ >= 5) \
173     && (!defined(Z7_MCST_LCC_VERSION) || (Z7_MCST_LCC_VERSION >= 12610))
174   #define Z7_ATTRIB_NO_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
175   // __attribute__((optimize("no-unroll-loops")));
176   #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
177 #elif defined(_MSC_VER) && (_MSC_VER >= 1920)
178   #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
179     _Pragma("loop( no_vector )")
180   #define Z7_ATTRIB_NO_VECTORIZE
181 #else
182   #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
183   #define Z7_ATTRIB_NO_VECTORIZE
184 #endif
185
186 #if defined(MY_CPU_X86_OR_AMD64) && ( \
187        defined(__clang__) && (__clang_major__ >= 4) \
188     || defined(__GNUC__) && (__GNUC__ >= 5))
189   #define Z7_ATTRIB_NO_SSE  __attribute__((__target__("no-sse")))
190 #else
191   #define Z7_ATTRIB_NO_SSE
192 #endif
193
194 #define Z7_ATTRIB_NO_VECTOR \
195   Z7_ATTRIB_NO_VECTORIZE \
196   Z7_ATTRIB_NO_SSE
197
198
199 #if defined(__clang__) && (__clang_major__ >= 8) \
200   || defined(__GNUC__) && (__GNUC__ >= 1000) \
201   /* || defined(_MSC_VER) && (_MSC_VER >= 1920) */
202   // GCC is not good for __builtin_expect()
203   #define Z7_LIKELY(x)   (__builtin_expect((x), 1))
204   #define Z7_UNLIKELY(x) (__builtin_expect((x), 0))
205   // #define Z7_unlikely [[unlikely]]
206   // #define Z7_likely [[likely]]
207 #else
208   #define Z7_LIKELY(x)   (x)
209   #define Z7_UNLIKELY(x) (x)
210   // #define Z7_likely
211 #endif
212
213
214 #if (defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 30600))
215
216 #if (Z7_CLANG_VERSION < 130000)
217 #define Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER \
218   _Pragma("GCC diagnostic push") \
219   _Pragma("GCC diagnostic ignored \"-Wreserved-id-macro\"")
220 #else
221 #define Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER \
222   _Pragma("GCC diagnostic push") \
223   _Pragma("GCC diagnostic ignored \"-Wreserved-macro-identifier\"")
224 #endif
225
226 #define Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER \
227   _Pragma("GCC diagnostic pop")
228 #else
229 #define Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
230 #define Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
231 #endif
232
233 #define UNUSED_VAR(x) (void)x;
234 /* #define UNUSED_VAR(x) x=x; */
235
236 #endif