Debian Codegraph @

third-party/simde/simde-diagnostic.h

raw
1 /* SPDX-License-Identifier: MIT
2 *
3 * Permission is hereby granted, free of charge, to any person
4 * obtaining a copy of this software and associated documentation
5 * files (the "Software"), to deal in the Software without
6 * restriction, including without limitation the rights to use, copy,
7 * modify, merge, publish, distribute, sublicense, and/or sell copies
8 * of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be
12 * included in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 * Copyright:
24 * 2017-2020 Evan Nemerson <[email protected]>
25 */
26
27 /* SIMDe targets a very wide range of standards and compilers, and our
28 * goal is to compile cleanly even with extremely aggressive warnings
29 * (i.e., -Weverything in clang, -Wextra in GCC, /W4 for MSVC, etc.)
30 * treated as errors.
31 *
32 * While our preference is to resolve the underlying issue a given
33 * diagnostic is warning us about, sometimes that's not possible.
34 * Fixing a warning in one compiler may cause problems in another.
35 * Sometimes a warning doesn't really apply to us (false positives),
36 * and sometimes adhering to a warning would mean dropping a feature
37 * we *know* the compiler supports since we have tested specifically
38 * for the compiler or feature.
39 *
40 * When practical, warnings are only disabled for specific code. For
41 * a list of warnings which are enabled by default in all SIMDe code,
42 * see SIMDE_DISABLE_UNWANTED_DIAGNOSTICS. Note that we restore the
43 * warning stack when SIMDe is done parsing, so code which includes
44 * SIMDe is not deprived of these warnings.
45 */
46
47 #if !defined(SIMDE_DIAGNOSTIC_H)
48 #define SIMDE_DIAGNOSTIC_H
49
50 #include "hedley.h"
51 #include "simde-detect-clang.h"
52 #include "simde-arch.h"
53
54 /* This is only to help us implement functions like _mm_undefined_ps. */
55 #if defined(SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_)
56 #undef SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_
57 #endif
58 #if HEDLEY_HAS_WARNING("-Wuninitialized")
59 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("clang diagnostic ignored \"-Wuninitialized\"")
60 #elif HEDLEY_GCC_VERSION_CHECK(4,2,0)
61 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
62 #elif HEDLEY_PGI_VERSION_CHECK(19,10,0)
63 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("diag_suppress 549")
64 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
65 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("error_messages(off,SEC_UNINITIALIZED_MEM_READ,SEC_UNDEFINED_RETURN_VALUE,unassigned)")
66 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0)
67 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("error_messages(off,SEC_UNINITIALIZED_MEM_READ,SEC_UNDEFINED_RETURN_VALUE)")
68 #elif HEDLEY_SUNPRO_VERSION_CHECK(5,12,0) && defined(__cplusplus)
69 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("error_messages(off,unassigned)")
70 #elif \
71 HEDLEY_TI_VERSION_CHECK(16,9,9) || \
72 HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
73 HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
74 HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,2)
75 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("diag_suppress 551")
76 #elif HEDLEY_INTEL_VERSION_CHECK(13,0,0)
77 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("warning(disable:592)")
78 #elif HEDLEY_MSVC_VERSION_CHECK(19,0,0) && !defined(__MSVC_RUNTIME_CHECKS)
79 #define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ __pragma(warning(disable:4700))
80 #endif
81
82 /* GCC emits a lot of "notes" about the ABI being different for things
83 * in newer versions of GCC. We don't really care because all our
84 * functions are inlined and don't generate ABI. */
85 #if HEDLEY_GCC_VERSION_CHECK(7,0,0)
86 #define SIMDE_DIAGNOSTIC_DISABLE_PSABI_ _Pragma("GCC diagnostic ignored \"-Wpsabi\"")
87 #else
88 #define SIMDE_DIAGNOSTIC_DISABLE_PSABI_
89 #endif
90
91 /* Since MMX uses x87 FP registers, you're supposed to call _mm_empty()
92 * after each MMX function before any floating point instructions.
93 * Some compilers warn about functions which use MMX functions but
94 * don't call _mm_empty(). However, since SIMDe is implementyng the
95 * MMX API we shouldn't be calling _mm_empty(); we leave it to the
96 * caller to invoke simde_mm_empty(). */
97 #if HEDLEY_INTEL_VERSION_CHECK(19,0,0)
98 #define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ _Pragma("warning(disable:13200 13203)")
99 #elif defined(HEDLEY_MSVC_VERSION)
100 #define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ __pragma(warning(disable:4799))
101 #else
102 #define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_
103 #endif
104
105 /* Intel is pushing people to use OpenMP SIMD instead of Cilk+, so they
106 * emit a diagnostic if you use #pragma simd instead of
107 * #pragma omp simd. SIMDe supports OpenMP SIMD, you just need to
108 * compile with -qopenmp or -qopenmp-simd and define
109 * SIMDE_ENABLE_OPENMP. Cilk+ is just a fallback. */
110 #if HEDLEY_INTEL_VERSION_CHECK(18,0,0)
111 #define SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_ _Pragma("warning(disable:3948)")
112 #else
113 #define SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_
114 #endif
115
116 /* MSVC emits a diagnostic when we call a function (like
117 * simde_mm_set_epi32) while initializing a struct. We currently do
118 * this a *lot* in the tests. */
119 #if \
120 defined(HEDLEY_MSVC_VERSION)
121 #define SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_ __pragma(warning(disable:4204))
122 #else
123 #define SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_
124 #endif
125
126 /* This warning needs a lot of work. It is triggered if all you do is
127 * pass the value to memcpy/__builtin_memcpy, or if you initialize a
128 * member of the union, even if that member takes up the entire union.
129 * Last tested with clang-10, hopefully things will improve in the
130 * future; if clang fixes this I'd love to enable it. */
131 #if \
132 HEDLEY_HAS_WARNING("-Wconditional-uninitialized")
133 #define SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_ _Pragma("clang diagnostic ignored \"-Wconditional-uninitialized\"")
134 #else
135 #define SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_
136 #endif
137
138 /* This warning is meant to catch things like `0.3 + 0.4 == 0.7`, which
139 * will is false. However, SIMDe uses these operations exclusively
140 * for things like _mm_cmpeq_ps, for which we really do want to check
141 * for equality (or inequality).
142 *
143 * If someone wants to put together a SIMDE_FLOAT_EQUAL(a, op, b) macro
144 * which just wraps a check in some code do disable this diagnostic I'd
145 * be happy to accept it. */
146 #if \
147 HEDLEY_HAS_WARNING("-Wfloat-equal") || \
148 HEDLEY_GCC_VERSION_CHECK(3,0,0)
149 #define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ _Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
150 #else
151 #define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_
152 #endif
153
154 /* This is because we use HEDLEY_STATIC_ASSERT for static assertions.
155 * If Hedley can't find an implementation it will preprocess to
156 * nothing, which means there will be a trailing semi-colon. */
157 #if HEDLEY_HAS_WARNING("-Wextra-semi")
158 #define SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_ _Pragma("clang diagnostic ignored \"-Wextra-semi\"")
159 #elif HEDLEY_GCC_VERSION_CHECK(8,1,0) && defined(__cplusplus)
160 #define SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_ _Pragma("GCC diagnostic ignored \"-Wextra-semi\"")
161 #else
162 #define SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_
163 #endif
164
165 /* We do use a few variadic macros, which technically aren't available
166 * until C99 and C++11, but every compiler I'm aware of has supported
167 * them for much longer. That said, usage is isolated to the test
168 * suite and compilers known to support them. */
169 #if HEDLEY_HAS_WARNING("-Wvariadic-macros") || HEDLEY_GCC_VERSION_CHECK(4,0,0)
170 #if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic")
171 #define SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_ \
172 _Pragma("clang diagnostic ignored \"-Wvariadic-macros\"") \
173 _Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"")
174 #else
175 #define SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_ _Pragma("GCC diagnostic ignored \"-Wvariadic-macros\"")
176 #endif
177 #else
178 #define SIMDE_DIAGNOSTIC_DISABLE_VARIADIC_MACROS_
179 #endif
180
181 /* emscripten requires us to use a __wasm_unimplemented_simd128__ macro
182 * before we can access certain SIMD intrinsics, but this diagnostic
183 * warns about it being a reserved name. It is a reserved name, but
184 * it's reserved for the compiler and we are using it to convey
185 * information to the compiler.
186 *
187 * This is also used when enabling native aliases since we don't get to
188 * choose the macro names. */
189 #if HEDLEY_HAS_WARNING("-Wreserved-id-macro")
190 #define SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_MACRO_ _Pragma("clang diagnostic ignored \"-Wreserved-id-macro\"")
191 #else
192 #define SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_MACRO_
193 #endif
194
195 /* Similar to above; types like simde__m128i are reserved due to the
196 * double underscore, but we didn't choose them, Intel did. */
197 #if HEDLEY_HAS_WARNING("-Wreserved-identifier")
198 #define SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_ _Pragma("clang diagnostic ignored \"-Wreserved-identifier\"")
199 #else
200 #define SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_
201 #endif
202
203 /* clang 3.8 warns about the packed attribute being unnecessary when
204 * used in the _mm_loadu_* functions. That *may* be true for version
205 * 3.8, but for later versions it is crucial in order to make unaligned
206 * access safe. */
207 #if HEDLEY_HAS_WARNING("-Wpacked")
208 #define SIMDE_DIAGNOSTIC_DISABLE_PACKED_ _Pragma("clang diagnostic ignored \"-Wpacked\"")
209 #else
210 #define SIMDE_DIAGNOSTIC_DISABLE_PACKED_
211 #endif
212
213 /* Triggered when assigning a float to a double implicitly. We use
214 * explicit casts in SIMDe, this is only used in the test suite. */
215 #if HEDLEY_HAS_WARNING("-Wdouble-promotion")
216 #define SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_ _Pragma("clang diagnostic ignored \"-Wdouble-promotion\"")
217 #else
218 #define SIMDE_DIAGNOSTIC_DISABLE_DOUBLE_PROMOTION_
219 #endif
220
221 /* Several compilers treat conformant array parameters as VLAs. We
222 * test to make sure we're in C mode (C++ doesn't support CAPs), and
223 * that the version of the standard supports CAPs. We also reject
224 * some buggy compilers like MSVC (the logic is in Hedley if you want
225 * to take a look), but with certain warnings enabled some compilers
226 * still like to emit a diagnostic. */
227 #if HEDLEY_HAS_WARNING("-Wvla")
228 #define SIMDE_DIAGNOSTIC_DISABLE_VLA_ _Pragma("clang diagnostic ignored \"-Wvla\"")
229 #elif HEDLEY_GCC_VERSION_CHECK(4,3,0)
230 #define SIMDE_DIAGNOSTIC_DISABLE_VLA_ _Pragma("GCC diagnostic ignored \"-Wvla\"")
231 #else
232 #define SIMDE_DIAGNOSTIC_DISABLE_VLA_
233 #endif
234
235 /* If you add an unused attribute to a function and don't use it, clang
236 * may emit this. */
237 #if HEDLEY_HAS_WARNING("-Wused-but-marked-unused")
238 #define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED_ _Pragma("clang diagnostic ignored \"-Wused-but-marked-unused\"")
239 #else
240 #define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED_
241 #endif
242
243 #if HEDLEY_HAS_WARNING("-Wpass-failed")
244 #define SIMDE_DIAGNOSTIC_DISABLE_PASS_FAILED_ _Pragma("clang diagnostic ignored \"-Wpass-failed\"")
245 #else
246 #define SIMDE_DIAGNOSTIC_DISABLE_PASS_FAILED_
247 #endif
248
249 #if HEDLEY_HAS_WARNING("-Wpadded")
250 #define SIMDE_DIAGNOSTIC_DISABLE_PADDED_ _Pragma("clang diagnostic ignored \"-Wpadded\"")
251 #elif HEDLEY_MSVC_VERSION_CHECK(19,0,0) /* Likely goes back further */
252 #define SIMDE_DIAGNOSTIC_DISABLE_PADDED_ __pragma(warning(disable:4324))
253 #else
254 #define SIMDE_DIAGNOSTIC_DISABLE_PADDED_
255 #endif
256
257 #if HEDLEY_HAS_WARNING("-Wzero-as-null-pointer-constant")
258 #define SIMDE_DIAGNOSTIC_DISABLE_ZERO_AS_NULL_POINTER_CONSTANT_ _Pragma("clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
259 #else
260 #define SIMDE_DIAGNOSTIC_DISABLE_ZERO_AS_NULL_POINTER_CONSTANT_
261 #endif
262
263 #if HEDLEY_HAS_WARNING("-Wold-style-cast")
264 #define SIMDE_DIAGNOSTIC_DISABLE_OLD_STYLE_CAST_ _Pragma("clang diagnostic ignored \"-Wold-style-cast\"")
265 #else
266 #define SIMDE_DIAGNOSTIC_DISABLE_OLD_STYLE_CAST_
267 #endif
268
269 #if HEDLEY_HAS_WARNING("-Wcast-function-type") || HEDLEY_GCC_VERSION_CHECK(8,0,0)
270 #define SIMDE_DIAGNOSTIC_DISABLE_CAST_FUNCTION_TYPE_ _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
271 #else
272 #define SIMDE_DIAGNOSTIC_DISABLE_CAST_FUNCTION_TYPE_
273 #endif
274
275 /* clang will emit this warning when we use C99 extensions whan not in
276 * C99 mode, even though it does support this. In such cases we check
277 * the compiler and version first, so we know it's not a problem. */
278 #if HEDLEY_HAS_WARNING("-Wc99-extensions")
279 #define SIMDE_DIAGNOSTIC_DISABLE_C99_EXTENSIONS_ _Pragma("clang diagnostic ignored \"-Wc99-extensions\"")
280 #else
281 #define SIMDE_DIAGNOSTIC_DISABLE_C99_EXTENSIONS_
282 #endif
283
284 /* Similar problm as above; we rely on some basic C99 support, but clang
285 * has started warning obut this even in C17 mode with -Weverything. */
286 #if HEDLEY_HAS_WARNING("-Wdeclaration-after-statement")
287 #define SIMDE_DIAGNOSTIC_DISABLE_DECLARATION_AFTER_STATEMENT_ _Pragma("clang diagnostic ignored \"-Wdeclaration-after-statement\"")
288 #else
289 #define SIMDE_DIAGNOSTIC_DISABLE_DECLARATION_AFTER_STATEMENT_
290 #endif
291
292 /* https://github.com/simd-everywhere/simde/issues/277 */
293 #if defined(HEDLEY_GCC_VERSION) && HEDLEY_GCC_VERSION_CHECK(4,6,0) && !HEDLEY_GCC_VERSION_CHECK(6,4,0) && defined(__cplusplus)
294 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_UNUSED_BUT_SET_VARIBALE_ _Pragma("GCC diagnostic ignored \"-Wunused-but-set-variable\"")
295 #else
296 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_UNUSED_BUT_SET_VARIBALE_
297 #endif
298
299 /* This is the warning that you normally define _CRT_SECURE_NO_WARNINGS
300 * to silence, but you have to do that before including anything and
301 * that would require reordering includes. */
302 #if defined(_MSC_VER)
303 #define SIMDE_DIAGNOSTIC_DISABLE_ANNEX_K_ __pragma(warning(disable:4996))
304 #else
305 #define SIMDE_DIAGNOSTIC_DISABLE_ANNEX_K_
306 #endif
307
308 /* Some compilers, such as clang, may use `long long` for 64-bit
309 * integers, but `long long` triggers a diagnostic with
310 * -Wc++98-compat-pedantic which says 'long long' is incompatible with
311 * C++98. */
312 #if HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic")
313 #if HEDLEY_HAS_WARNING("-Wc++11-long-long")
314 #define SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC_ \
315 _Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"") \
316 _Pragma("clang diagnostic ignored \"-Wc++11-long-long\"")
317 #else
318 #define SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC_ _Pragma("clang diagnostic ignored \"-Wc++98-compat-pedantic\"")
319 #endif
320 #else
321 #define SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC_
322 #endif
323
324 /* Some problem as above */
325 #if HEDLEY_HAS_WARNING("-Wc++11-long-long")
326 #define SIMDE_DIAGNOSTIC_DISABLE_CPP11_LONG_LONG_ _Pragma("clang diagnostic ignored \"-Wc++11-long-long\"")
327 #else
328 #define SIMDE_DIAGNOSTIC_DISABLE_CPP11_LONG_LONG_
329 #endif
330
331 /* emscripten emits this whenever stdin/stdout/stderr is used in a
332 * macro. */
333 #if HEDLEY_HAS_WARNING("-Wdisabled-macro-expansion")
334 #define SIMDE_DIAGNOSTIC_DISABLE_DISABLED_MACRO_EXPANSION_ _Pragma("clang diagnostic ignored \"-Wdisabled-macro-expansion\"")
335 #else
336 #define SIMDE_DIAGNOSTIC_DISABLE_DISABLED_MACRO_EXPANSION_
337 #endif
338
339 /* Clang uses C11 generic selections to implement some AltiVec
340 * functions, which triggers this diagnostic when not compiling
341 * in C11 mode */
342 #if HEDLEY_HAS_WARNING("-Wc11-extensions")
343 #define SIMDE_DIAGNOSTIC_DISABLE_C11_EXTENSIONS_ _Pragma("clang diagnostic ignored \"-Wc11-extensions\"")
344 #else
345 #define SIMDE_DIAGNOSTIC_DISABLE_C11_EXTENSIONS_
346 #endif
347
348 /* Clang sometimes triggers this warning in macros in the AltiVec and
349 * NEON headers, or due to missing functions. */
350 #if HEDLEY_HAS_WARNING("-Wvector-conversion")
351 #define SIMDE_DIAGNOSTIC_DISABLE_VECTOR_CONVERSION_ _Pragma("clang diagnostic ignored \"-Wvector-conversion\"")
352 /* For NEON, the situation with -Wvector-conversion in clang < 10 is
353 * bad enough that we just disable the warning altogether. On x86,
354 * clang has similar issues on several sse4.2+ intrinsics before 3.8. */
355 #if \
356 (defined(SIMDE_ARCH_ARM) && SIMDE_DETECT_CLANG_VERSION_NOT(10,0,0)) || \
357 SIMDE_DETECT_CLANG_VERSION_NOT(3,8,0)
358 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_VECTOR_CONVERSION_ SIMDE_DIAGNOSTIC_DISABLE_VECTOR_CONVERSION_
359 #endif
360 #else
361 #define SIMDE_DIAGNOSTIC_DISABLE_VECTOR_CONVERSION_
362 #endif
363 #if !defined(SIMDE_DIAGNOSTIC_DISABLE_BUGGY_VECTOR_CONVERSION_)
364 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_VECTOR_CONVERSION_
365 #endif
366
367 /* Prior to 5.0, clang didn't support disabling diagnostics in
368 * statement exprs. As a result, some macros we use don't
369 * properly silence warnings. */
370 #if SIMDE_DETECT_CLANG_VERSION_NOT(5,0,0) && HEDLEY_HAS_WARNING("-Wcast-qual") && HEDLEY_HAS_WARNING("-Wcast-align")
371 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_CASTS_ _Pragma("clang diagnostic ignored \"-Wcast-qual\"") _Pragma("clang diagnostic ignored \"-Wcast-align\"")
372 #elif SIMDE_DETECT_CLANG_VERSION_NOT(5,0,0) && HEDLEY_HAS_WARNING("-Wcast-qual")
373 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_CASTS_ _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
374 #elif SIMDE_DETECT_CLANG_VERSION_NOT(5,0,0) && HEDLEY_HAS_WARNING("-Wcast-align")
375 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_CASTS_ _Pragma("clang diagnostic ignored \"-Wcast-align\"")
376 #else
377 #define SIMDE_DIAGNOSTIC_DISABLE_BUGGY_CASTS_
378 #endif
379
380 /* SLEEF triggers this a *lot* in their headers */
381 #if HEDLEY_HAS_WARNING("-Wignored-qualifiers")
382 #define SIMDE_DIAGNOSTIC_DISABLE_IGNORED_QUALIFIERS_ _Pragma("clang diagnostic ignored \"-Wignored-qualifiers\"")
383 #elif HEDLEY_GCC_VERSION_CHECK(4,3,0)
384 #define SIMDE_DIAGNOSTIC_DISABLE_IGNORED_QUALIFIERS_ _Pragma("GCC diagnostic ignored \"-Wignored-qualifiers\"")
385 #else
386 #define SIMDE_DIAGNOSTIC_DISABLE_IGNORED_QUALIFIERS_
387 #endif
388
389 /* GCC emits this under some circumstances when using __int128 */
390 #if HEDLEY_GCC_VERSION_CHECK(4,8,0)
391 #define SIMDE_DIAGNOSTIC_DISABLE_PEDANTIC_ _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
392 #else
393 #define SIMDE_DIAGNOSTIC_DISABLE_PEDANTIC_
394 #endif
395
396 /* MSVC doesn't like (__assume(0), code) and will warn about code being
397 * unreachable, but we want it there because not all compilers
398 * understand the unreachable macro and will complain if it is missing.
399 * I'm planning on adding a new macro to Hedley to handle this a bit
400 * more elegantly, but until then... */
401 #if defined(HEDLEY_MSVC_VERSION)
402 #define SIMDE_DIAGNOSTIC_DISABLE_UNREACHABLE_ __pragma(warning(disable:4702))
403 #else
404 #define SIMDE_DIAGNOSTIC_DISABLE_UNREACHABLE_
405 #endif
406
407 /* This is a false positive from GCC in a few places. */
408 #if HEDLEY_GCC_VERSION_CHECK(4,7,0)
409 #define SIMDE_DIAGNOSTIC_DISABLE_MAYBE_UNINITIAZILED_ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
410 #else
411 #define SIMDE_DIAGNOSTIC_DISABLE_MAYBE_UNINITIAZILED_
412 #endif
413
414 #if defined(SIMDE_ENABLE_NATIVE_ALIASES)
415 #define SIMDE_DISABLE_UNWANTED_DIAGNOSTICS_NATIVE_ALIASES_ \
416 SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_MACRO_
417 #else
418 #define SIMDE_DISABLE_UNWANTED_DIAGNOSTICS_NATIVE_ALIASES_
419 #endif
420
421 /* Some native functions on E2K with instruction set < v6 are declared
422 * as deprecated due to inefficiency. Still they are more efficient
423 * than SIMDe implementation. So we're using them, and switching off
424 * these deprecation warnings. */
425 #if defined(HEDLEY_MCST_LCC_VERSION)
426 # define SIMDE_LCC_DISABLE_DEPRECATED_WARNINGS _Pragma("diag_suppress 1215,1444")
427 # define SIMDE_LCC_REVERT_DEPRECATED_WARNINGS _Pragma("diag_default 1215,1444")
428 #else
429 # define SIMDE_LCC_DISABLE_DEPRECATED_WARNINGS
430 # define SIMDE_LCC_REVERT_DEPRECATED_WARNINGS
431 #endif
432
433 #define SIMDE_DISABLE_UNWANTED_DIAGNOSTICS \
434 HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION \
435 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS_NATIVE_ALIASES_ \
436 SIMDE_DIAGNOSTIC_DISABLE_PSABI_ \
437 SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ \
438 SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_ \
439 SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_ \
440 SIMDE_DIAGNOSTIC_DISABLE_DECLARATION_AFTER_STATEMENT_ \
441 SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ \
442 SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_ \
443 SIMDE_DIAGNOSTIC_DISABLE_EXTRA_SEMI_ \
444 SIMDE_DIAGNOSTIC_DISABLE_VLA_ \
445 SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED_ \
446 SIMDE_DIAGNOSTIC_DISABLE_PASS_FAILED_ \
447 SIMDE_DIAGNOSTIC_DISABLE_CPP98_COMPAT_PEDANTIC_ \
448 SIMDE_DIAGNOSTIC_DISABLE_CPP11_LONG_LONG_ \
449 SIMDE_DIAGNOSTIC_DISABLE_BUGGY_UNUSED_BUT_SET_VARIBALE_ \
450 SIMDE_DIAGNOSTIC_DISABLE_BUGGY_CASTS_ \
451 SIMDE_DIAGNOSTIC_DISABLE_BUGGY_VECTOR_CONVERSION_ \
452 SIMDE_DIAGNOSTIC_DISABLE_RESERVED_ID_
453
454 #endif /* !defined(SIMDE_DIAGNOSTIC_H) */