1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2020 The Qt Company Ltd. |
4 | ** Copyright (C) 2016 Intel Corporation. |
5 | ** Contact: https://www.qt.io/licensing/ |
6 | ** |
7 | ** This file is part of the QtCore module of the Qt Toolkit. |
8 | ** |
9 | ** $QT_BEGIN_LICENSE:LGPL$ |
10 | ** Commercial License Usage |
11 | ** Licensees holding valid commercial Qt licenses may use this file in |
12 | ** accordance with the commercial license agreement provided with the |
13 | ** Software or, alternatively, in accordance with the terms contained in |
14 | ** a written agreement between you and The Qt Company. For licensing terms |
15 | ** and conditions see https://www.qt.io/terms-conditions. For further |
16 | ** information use the contact form at https://www.qt.io/contact-us. |
17 | ** |
18 | ** GNU Lesser General Public License Usage |
19 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
20 | ** General Public License version 3 as published by the Free Software |
21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
22 | ** packaging of this file. Please review the following information to |
23 | ** ensure the GNU Lesser General Public License version 3 requirements |
24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
25 | ** |
26 | ** GNU General Public License Usage |
27 | ** Alternatively, this file may be used under the terms of the GNU |
28 | ** General Public License version 2.0 or (at your option) the GNU General |
29 | ** Public license version 3 or any later version approved by the KDE Free |
30 | ** Qt Foundation. The licenses are as published by the Free Software |
31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
32 | ** included in the packaging of this file. Please review the following |
33 | ** information to ensure the GNU General Public License requirements will |
34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
35 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
36 | ** |
37 | ** $QT_END_LICENSE$ |
38 | ** |
39 | ****************************************************************************/ |
40 | |
41 | #ifndef QGLOBAL_H |
42 | # include <QtCore/qglobal.h> |
43 | #endif |
44 | |
45 | #ifndef QCOMPILERDETECTION_H |
46 | #define QCOMPILERDETECTION_H |
47 | |
48 | /* |
49 | The compiler, must be one of: (Q_CC_x) |
50 | |
51 | SYM - Digital Mars C/C++ (used to be Symantec C++) |
52 | MSVC - Microsoft Visual C/C++, Intel C++ for Windows |
53 | BOR - Borland/Turbo C++ |
54 | WAT - Watcom C++ |
55 | GNU - GNU C++ |
56 | COMEAU - Comeau C++ |
57 | EDG - Edison Design Group C++ |
58 | OC - CenterLine C++ |
59 | SUN - Forte Developer, or Sun Studio C++ |
60 | MIPS - MIPSpro C++ |
61 | DEC - DEC C++ |
62 | HPACC - HP aC++ |
63 | USLC - SCO OUDK and UDK |
64 | CDS - Reliant C++ |
65 | KAI - KAI C++ |
66 | INTEL - Intel C++ for Linux, Intel C++ for Windows |
67 | HIGHC - MetaWare High C/C++ |
68 | PGI - Portland Group C++ |
69 | GHS - Green Hills Optimizing C++ Compilers |
70 | RVCT - ARM Realview Compiler Suite |
71 | CLANG - C++ front-end for the LLVM compiler |
72 | |
73 | |
74 | Should be sorted most to least authoritative. |
75 | */ |
76 | |
77 | /* Symantec C++ is now Digital Mars */ |
78 | #if defined(__DMC__) || defined(__SC__) |
79 | # define Q_CC_SYM |
80 | /* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ |
81 | # if defined(__SC__) && __SC__ < 0x750 |
82 | # error "Compiler not supported" |
83 | # endif |
84 | |
85 | #elif defined(_MSC_VER) |
86 | # ifdef __clang__ |
87 | # define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) |
88 | # endif |
89 | # define Q_CC_MSVC (_MSC_VER) |
90 | # define Q_CC_MSVC_NET |
91 | # define Q_OUTOFLINE_TEMPLATE inline |
92 | # define Q_COMPILER_MANGLES_RETURN_TYPE |
93 | # define Q_FUNC_INFO __FUNCSIG__ |
94 | # define Q_ASSUME_IMPL(expr) __assume(expr) |
95 | # define Q_UNREACHABLE_IMPL() __assume(0) |
96 | # define Q_NORETURN __declspec(noreturn) |
97 | # define Q_DECL_DEPRECATED __declspec(deprecated) |
98 | # ifndef Q_CC_CLANG |
99 | # define Q_DECL_DEPRECATED_X(text) __declspec(deprecated(text)) |
100 | # endif |
101 | # define Q_DECL_EXPORT __declspec(dllexport) |
102 | # define Q_DECL_IMPORT __declspec(dllimport) |
103 | # define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) stdext::make_unchecked_array_iterator(x) // Since _MSC_VER >= 1800 |
104 | # define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500 |
105 | /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ |
106 | # if defined(__INTEL_COMPILER) |
107 | # define Q_DECL_VARIABLE_DEPRECATED |
108 | # define Q_CC_INTEL __INTEL_COMPILER |
109 | # endif |
110 | |
111 | #elif defined(__BORLANDC__) || defined(__TURBOC__) |
112 | # define Q_CC_BOR |
113 | # define Q_INLINE_TEMPLATE |
114 | # if __BORLANDC__ < 0x502 |
115 | # error "Compiler not supported" |
116 | # endif |
117 | |
118 | #elif defined(__WATCOMC__) |
119 | # define Q_CC_WAT |
120 | |
121 | /* ARM Realview Compiler Suite |
122 | RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given), |
123 | so check for it before that */ |
124 | #elif defined(__ARMCC__) || defined(__CC_ARM) |
125 | # define Q_CC_RVCT |
126 | /* work-around for missing compiler intrinsics */ |
127 | # define __is_empty(X) false |
128 | # define __is_pod(X) false |
129 | # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) |
130 | # ifdef Q_OS_LINUX |
131 | # define Q_DECL_EXPORT __attribute__((visibility("default"))) |
132 | # define Q_DECL_IMPORT __attribute__((visibility("default"))) |
133 | # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) |
134 | # else |
135 | # define Q_DECL_EXPORT __declspec(dllexport) |
136 | # define Q_DECL_IMPORT __declspec(dllimport) |
137 | # endif |
138 | |
139 | #elif defined(__GNUC__) |
140 | # define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__) |
141 | # if defined(__MINGW32__) |
142 | # define Q_CC_MINGW |
143 | # endif |
144 | # if defined(__INTEL_COMPILER) |
145 | /* Intel C++ also masquerades as GCC */ |
146 | # define Q_CC_INTEL (__INTEL_COMPILER) |
147 | # ifdef __clang__ |
148 | /* Intel C++ masquerades as Clang masquerading as GCC */ |
149 | # define Q_CC_CLANG 305 |
150 | # endif |
151 | # define Q_ASSUME_IMPL(expr) __assume(expr) |
152 | # define Q_UNREACHABLE_IMPL() __builtin_unreachable() |
153 | # if __INTEL_COMPILER >= 1300 && !defined(__APPLE__) |
154 | # define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) |
155 | # endif |
156 | # elif defined(__clang__) |
157 | /* Clang also masquerades as GCC */ |
158 | # if defined(__apple_build_version__) |
159 | # /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */ |
160 | # if __apple_build_version__ >= 8020041 |
161 | # define Q_CC_CLANG 309 |
162 | # elif __apple_build_version__ >= 8000038 |
163 | # define Q_CC_CLANG 308 |
164 | # elif __apple_build_version__ >= 7000053 |
165 | # define Q_CC_CLANG 306 |
166 | # elif __apple_build_version__ >= 6000051 |
167 | # define Q_CC_CLANG 305 |
168 | # elif __apple_build_version__ >= 5030038 |
169 | # define Q_CC_CLANG 304 |
170 | # elif __apple_build_version__ >= 5000275 |
171 | # define Q_CC_CLANG 303 |
172 | # elif __apple_build_version__ >= 4250024 |
173 | # define Q_CC_CLANG 302 |
174 | # elif __apple_build_version__ >= 3180045 |
175 | # define Q_CC_CLANG 301 |
176 | # elif __apple_build_version__ >= 2111001 |
177 | # define Q_CC_CLANG 300 |
178 | # else |
179 | # error "Unknown Apple Clang version" |
180 | # endif |
181 | # else |
182 | # define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__) |
183 | # endif |
184 | # if __has_builtin(__builtin_assume) |
185 | # define Q_ASSUME_IMPL(expr) __builtin_assume(expr) |
186 | # else |
187 | # define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() |
188 | # endif |
189 | # define Q_UNREACHABLE_IMPL() __builtin_unreachable() |
190 | # if !defined(__has_extension) |
191 | # /* Compatibility with older Clang versions */ |
192 | # define __has_extension __has_feature |
193 | # endif |
194 | # if defined(__APPLE__) |
195 | /* Apple/clang specific features */ |
196 | # define Q_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) |
197 | # ifdef __OBJC__ |
198 | # define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) |
199 | # endif |
200 | # endif |
201 | # ifdef __EMSCRIPTEN__ |
202 | # define Q_CC_EMSCRIPTEN |
203 | # endif |
204 | # else |
205 | /* Plain GCC */ |
206 | # if Q_CC_GNU >= 405 |
207 | # define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable() |
208 | # define Q_UNREACHABLE_IMPL() __builtin_unreachable() |
209 | # define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) |
210 | # endif |
211 | # endif |
212 | |
213 | # ifdef Q_OS_WIN |
214 | # define Q_DECL_EXPORT __declspec(dllexport) |
215 | # define Q_DECL_IMPORT __declspec(dllimport) |
216 | # elif defined(QT_VISIBILITY_AVAILABLE) |
217 | # define Q_DECL_EXPORT __attribute__((visibility("default"))) |
218 | # define Q_DECL_IMPORT __attribute__((visibility("default"))) |
219 | # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) |
220 | # endif |
221 | |
222 | # define Q_FUNC_INFO __PRETTY_FUNCTION__ |
223 | # define Q_TYPEOF(expr) __typeof__(expr) |
224 | # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) |
225 | # define Q_DECL_UNUSED __attribute__((__unused__)) |
226 | # define Q_LIKELY(expr) __builtin_expect(!!(expr), true) |
227 | # define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false) |
228 | # define Q_NORETURN __attribute__((__noreturn__)) |
229 | # define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__)) |
230 | # define Q_DECL_PURE_FUNCTION __attribute__((pure)) |
231 | # define Q_DECL_CONST_FUNCTION __attribute__((const)) |
232 | # define Q_DECL_COLD_FUNCTION __attribute__((cold)) |
233 | # if !defined(QT_MOC_CPP) |
234 | # define Q_PACKED __attribute__ ((__packed__)) |
235 | # ifndef __ARM_EABI__ |
236 | # define QT_NO_ARM_EABI |
237 | # endif |
238 | # endif |
239 | # if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG) |
240 | # define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x))) |
241 | # endif |
242 | |
243 | /* IBM compiler versions are a bit messy. There are actually two products: |
244 | the C product, and the C++ product. The C++ compiler is always packaged |
245 | with the latest version of the C compiler. Version numbers do not always |
246 | match. This little table (I'm not sure it's accurate) should be helpful: |
247 | |
248 | C++ product C product |
249 | |
250 | C Set 3.1 C Compiler 3.0 |
251 | ... ... |
252 | C++ Compiler 3.6.6 C Compiler 4.3 |
253 | ... ... |
254 | Visual Age C++ 4.0 ... |
255 | ... ... |
256 | Visual Age C++ 5.0 C Compiler 5.0 |
257 | ... ... |
258 | Visual Age C++ 6.0 C Compiler 6.0 |
259 | |
260 | Now: |
261 | __xlC__ is the version of the C compiler in hexadecimal notation |
262 | is only an approximation of the C++ compiler version |
263 | __IBMCPP__ is the version of the C++ compiler in decimal notation |
264 | but it is not defined on older compilers like C Set 3.1 */ |
265 | #elif defined(__xlC__) |
266 | # define Q_CC_XLC |
267 | # define Q_FULL_TEMPLATE_INSTANTIATION |
268 | # if __xlC__ < 0x400 |
269 | # error "Compiler not supported" |
270 | # elif __xlC__ >= 0x0600 |
271 | # define Q_TYPEOF(expr) __typeof__(expr) |
272 | # define Q_PACKED __attribute__((__packed__)) |
273 | # endif |
274 | |
275 | /* Older versions of DEC C++ do not define __EDG__ or __EDG - observed |
276 | on DEC C++ V5.5-004. New versions do define __EDG__ - observed on |
277 | Compaq C++ V6.3-002. |
278 | This compiler is different enough from other EDG compilers to handle |
279 | it separately anyway. */ |
280 | #elif defined(__DECCXX) || defined(__DECC) |
281 | # define Q_CC_DEC |
282 | /* Compaq C++ V6 compilers are EDG-based but I'm not sure about older |
283 | DEC C++ V5 compilers. */ |
284 | # if defined(__EDG__) |
285 | # define Q_CC_EDG |
286 | # endif |
287 | /* Compaq has disabled EDG's _BOOL macro and uses _BOOL_EXISTS instead |
288 | - observed on Compaq C++ V6.3-002. |
289 | In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ |
290 | # if !defined(_BOOL_EXISTS) |
291 | # error "Compiler not supported" |
292 | # endif |
293 | /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ |
294 | /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on |
295 | DEC C++ V5.5-004. */ |
296 | # if __DECCXX_VER < 60060000 |
297 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
298 | # endif |
299 | /* avoid undefined symbol problems with out-of-line template members */ |
300 | # define Q_OUTOFLINE_TEMPLATE inline |
301 | |
302 | /* The Portland Group C++ compiler is based on EDG and does define __EDG__ |
303 | but the C compiler does not */ |
304 | #elif defined(__PGI) |
305 | # define Q_CC_PGI |
306 | # if defined(__EDG__) |
307 | # define Q_CC_EDG |
308 | # endif |
309 | |
310 | /* Compilers with EDG front end are similar. To detect them we test: |
311 | __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b |
312 | __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 |
313 | and PGI C++ 5.2-4 */ |
314 | #elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__)) |
315 | # define Q_CC_EDG |
316 | /* From the EDG documentation (does not seem to apply to Compaq C++ or GHS C): |
317 | _BOOL |
318 | Defined in C++ mode when bool is a keyword. The name of this |
319 | predefined macro is specified by a configuration flag. _BOOL |
320 | is the default. |
321 | __BOOL_DEFINED |
322 | Defined in Microsoft C++ mode when bool is a keyword. */ |
323 | # if !defined(_BOOL) && !defined(__BOOL_DEFINED) && !defined(__ghs) |
324 | # error "Compiler not supported" |
325 | # endif |
326 | |
327 | /* The Comeau compiler is based on EDG and does define __EDG__ */ |
328 | # if defined(__COMO__) |
329 | # define Q_CC_COMEAU |
330 | |
331 | /* The `using' keyword was introduced to avoid KAI C++ warnings |
332 | but it's now causing KAI C++ errors instead. The standard is |
333 | unclear about the use of this keyword, and in practice every |
334 | compiler is using its own set of rules. Forget it. */ |
335 | # elif defined(__KCC) |
336 | # define Q_CC_KAI |
337 | |
338 | /* Using the `using' keyword avoids Intel C++ for Linux warnings */ |
339 | # elif defined(__INTEL_COMPILER) |
340 | # define Q_CC_INTEL (__INTEL_COMPILER) |
341 | |
342 | /* Uses CFront, make sure to read the manual how to tweak templates. */ |
343 | # elif defined(__ghs) |
344 | # define Q_CC_GHS |
345 | # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) |
346 | # define Q_PACKED __attribute__ ((__packed__)) |
347 | # define Q_FUNC_INFO __PRETTY_FUNCTION__ |
348 | # define Q_TYPEOF(expr) __typeof__(expr) |
349 | # define Q_UNREACHABLE_IMPL() |
350 | # if defined(__cplusplus) |
351 | # define Q_COMPILER_AUTO_TYPE |
352 | # define Q_COMPILER_STATIC_ASSERT |
353 | # define Q_COMPILER_RANGE_FOR |
354 | # if __GHS_VERSION_NUMBER >= 201505 |
355 | # define Q_COMPILER_ALIGNAS |
356 | # define Q_COMPILER_ALIGNOF |
357 | # define Q_COMPILER_ATOMICS |
358 | # define Q_COMPILER_ATTRIBUTES |
359 | # define Q_COMPILER_AUTO_FUNCTION |
360 | # define Q_COMPILER_CLASS_ENUM |
361 | # define Q_COMPILER_DECLTYPE |
362 | # define Q_COMPILER_DEFAULT_MEMBERS |
363 | # define Q_COMPILER_DELETE_MEMBERS |
364 | # define Q_COMPILER_DELEGATING_CONSTRUCTORS |
365 | # define Q_COMPILER_EXPLICIT_CONVERSIONS |
366 | # define Q_COMPILER_EXPLICIT_OVERRIDES |
367 | # define Q_COMPILER_EXTERN_TEMPLATES |
368 | # define Q_COMPILER_INHERITING_CONSTRUCTORS |
369 | # define Q_COMPILER_INITIALIZER_LISTS |
370 | # define Q_COMPILER_LAMBDA |
371 | # define Q_COMPILER_NONSTATIC_MEMBER_INIT |
372 | # define Q_COMPILER_NOEXCEPT |
373 | # define Q_COMPILER_NULLPTR |
374 | # define Q_COMPILER_RANGE_FOR |
375 | # define Q_COMPILER_RAW_STRINGS |
376 | # define Q_COMPILER_REF_QUALIFIERS |
377 | # define Q_COMPILER_RVALUE_REFS |
378 | # define Q_COMPILER_STATIC_ASSERT |
379 | # define Q_COMPILER_TEMPLATE_ALIAS |
380 | # define Q_COMPILER_THREAD_LOCAL |
381 | # define Q_COMPILER_THREADSAFE_STATICS |
382 | # define Q_COMPILER_UDL |
383 | # define Q_COMPILER_UNICODE_STRINGS |
384 | # define Q_COMPILER_UNIFORM_INIT |
385 | # define Q_COMPILER_UNRESTRICTED_UNIONS |
386 | # define Q_COMPILER_VARIADIC_MACROS |
387 | # define Q_COMPILER_VARIADIC_TEMPLATES |
388 | # endif |
389 | # endif //__cplusplus |
390 | |
391 | # elif defined(__DCC__) |
392 | # define Q_CC_DIAB |
393 | # if !defined(__bool) |
394 | # error "Compiler not supported" |
395 | # endif |
396 | |
397 | /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ |
398 | # elif defined(__USLC__) && defined(__SCO_VERSION__) |
399 | # define Q_CC_USLC |
400 | /* The latest UDK 7.1.1b does not need this, but previous versions do */ |
401 | # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) |
402 | # define Q_OUTOFLINE_TEMPLATE inline |
403 | # endif |
404 | |
405 | /* Never tested! */ |
406 | # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) |
407 | # define Q_CC_OC |
408 | |
409 | /* CDS++ defines __EDG__ although this is not documented in the Reliant |
410 | documentation. It also follows conventions like _BOOL and this documented */ |
411 | # elif defined(sinix) |
412 | # define Q_CC_CDS |
413 | |
414 | /* The MIPSpro compiler defines __EDG */ |
415 | # elif defined(__sgi) |
416 | # define Q_CC_MIPS |
417 | # define Q_NO_TEMPLATE_FRIENDS |
418 | # if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740) |
419 | # define Q_OUTOFLINE_TEMPLATE inline |
420 | # pragma set woff 3624,3625,3649 /* turn off some harmless warnings */ |
421 | # endif |
422 | # endif |
423 | |
424 | /* VxWorks' DIAB toolchain has an additional EDG type C++ compiler |
425 | (see __DCC__ above). This one is for C mode files (__EDG is not defined) */ |
426 | #elif defined(_DIAB_TOOL) |
427 | # define Q_CC_DIAB |
428 | # define Q_FUNC_INFO __PRETTY_FUNCTION__ |
429 | |
430 | /* Never tested! */ |
431 | #elif defined(__HIGHC__) |
432 | # define Q_CC_HIGHC |
433 | |
434 | #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) |
435 | # define Q_CC_SUN |
436 | # define Q_COMPILER_MANGLES_RETURN_TYPE |
437 | /* 5.0 compiler or better |
438 | 'bool' is enabled by default but can be disabled using -features=nobool |
439 | in which case _BOOL is not defined |
440 | this is the default in 4.2 compatibility mode triggered by -compat=4 */ |
441 | # if __SUNPRO_CC >= 0x500 |
442 | # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS |
443 | /* see http://developers.sun.com/sunstudio/support/Ccompare.html */ |
444 | # if __SUNPRO_CC >= 0x590 |
445 | # define Q_TYPEOF(expr) __typeof__(expr) |
446 | # endif |
447 | # if __SUNPRO_CC >= 0x550 |
448 | # define Q_DECL_EXPORT __global |
449 | # endif |
450 | # if __SUNPRO_CC < 0x5a0 |
451 | # define Q_NO_TEMPLATE_FRIENDS |
452 | # endif |
453 | # if !defined(_BOOL) |
454 | # error "Compiler not supported" |
455 | # endif |
456 | /* 4.2 compiler or older */ |
457 | # else |
458 | # error "Compiler not supported" |
459 | # endif |
460 | |
461 | /* CDS++ does not seem to define __EDG__ or __EDG according to Reliant |
462 | documentation but nevertheless uses EDG conventions like _BOOL */ |
463 | #elif defined(sinix) |
464 | # define Q_CC_EDG |
465 | # define Q_CC_CDS |
466 | # if !defined(_BOOL) |
467 | # error "Compiler not supported" |
468 | # endif |
469 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
470 | |
471 | #elif defined(Q_OS_HPUX) |
472 | /* __HP_aCC was not defined in first aCC releases */ |
473 | # if defined(__HP_aCC) || __cplusplus >= 199707L |
474 | # define Q_NO_TEMPLATE_FRIENDS |
475 | # define Q_CC_HPACC |
476 | # define Q_FUNC_INFO __PRETTY_FUNCTION__ |
477 | # if __HP_aCC-0 < 060000 |
478 | # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS |
479 | # define Q_DECL_EXPORT __declspec(dllexport) |
480 | # define Q_DECL_IMPORT __declspec(dllimport) |
481 | # endif |
482 | # if __HP_aCC-0 >= 062000 |
483 | # define Q_DECL_EXPORT __attribute__((visibility("default"))) |
484 | # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) |
485 | # define Q_DECL_IMPORT Q_DECL_EXPORT |
486 | # endif |
487 | # else |
488 | # error "Compiler not supported" |
489 | # endif |
490 | |
491 | #else |
492 | # error "Qt has not been tested with this compiler - see http://www.qt-project.org/" |
493 | #endif |
494 | |
495 | /* |
496 | * SG10's SD-6 feature detection and some useful extensions from Clang and GCC |
497 | * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations |
498 | * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros |
499 | * Not using wrapper macros, per http://eel.is/c++draft/cpp.cond#7.sentence-2 |
500 | */ |
501 | #ifndef __has_builtin |
502 | # define __has_builtin(x) 0 |
503 | #endif |
504 | #ifndef __has_feature |
505 | # define __has_feature(x) 0 |
506 | #endif |
507 | #ifndef __has_attribute |
508 | # define __has_attribute(x) 0 |
509 | #endif |
510 | #ifndef __has_cpp_attribute |
511 | # define __has_cpp_attribute(x) 0 |
512 | #endif |
513 | #ifndef __has_include |
514 | # define __has_include(x) 0 |
515 | #endif |
516 | #ifndef __has_include_next |
517 | # define __has_include_next(x) 0 |
518 | #endif |
519 | |
520 | // Kept around until all submodules have transitioned |
521 | #define QT_HAS_BUILTIN(x) __has_builtin(x) |
522 | #define QT_HAS_FEATURE(x) __has_feature(x) |
523 | #define QT_HAS_ATTRIBUTE(x) __has_attribute(x) |
524 | #define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) |
525 | #define QT_HAS_INCLUDE(x) __has_include(x) |
526 | #define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x) |
527 | |
528 | /* |
529 | * C++11 support |
530 | * |
531 | * Paper Macro SD-6 macro |
532 | * N2341 Q_COMPILER_ALIGNAS |
533 | * N2341 Q_COMPILER_ALIGNOF |
534 | * N2427 Q_COMPILER_ATOMICS |
535 | * N2761 Q_COMPILER_ATTRIBUTES __cpp_attributes = 200809 |
536 | * N2541 Q_COMPILER_AUTO_FUNCTION |
537 | * N1984 N2546 Q_COMPILER_AUTO_TYPE |
538 | * N2437 Q_COMPILER_CLASS_ENUM |
539 | * N2235 Q_COMPILER_CONSTEXPR __cpp_constexpr = 200704 |
540 | * N2343 N3276 Q_COMPILER_DECLTYPE __cpp_decltype = 200707 |
541 | * N2346 Q_COMPILER_DEFAULT_MEMBERS |
542 | * N2346 Q_COMPILER_DELETE_MEMBERS |
543 | * N1986 Q_COMPILER_DELEGATING_CONSTRUCTORS |
544 | * N2437 Q_COMPILER_EXPLICIT_CONVERSIONS |
545 | * N3206 N3272 Q_COMPILER_EXPLICIT_OVERRIDES |
546 | * N1987 Q_COMPILER_EXTERN_TEMPLATES |
547 | * N2540 Q_COMPILER_INHERITING_CONSTRUCTORS |
548 | * N2672 Q_COMPILER_INITIALIZER_LISTS |
549 | * N2658 N2927 Q_COMPILER_LAMBDA __cpp_lambdas = 200907 |
550 | * N2756 Q_COMPILER_NONSTATIC_MEMBER_INIT |
551 | * N2855 N3050 Q_COMPILER_NOEXCEPT |
552 | * N2431 Q_COMPILER_NULLPTR |
553 | * N2930 Q_COMPILER_RANGE_FOR |
554 | * N2442 Q_COMPILER_RAW_STRINGS __cpp_raw_strings = 200710 |
555 | * N2439 Q_COMPILER_REF_QUALIFIERS |
556 | * N2118 N2844 N3053 Q_COMPILER_RVALUE_REFS __cpp_rvalue_references = 200610 |
557 | * N1720 Q_COMPILER_STATIC_ASSERT __cpp_static_assert = 200410 |
558 | * N2258 Q_COMPILER_TEMPLATE_ALIAS |
559 | * N2659 Q_COMPILER_THREAD_LOCAL |
560 | * N2660 Q_COMPILER_THREADSAFE_STATICS |
561 | * N2765 Q_COMPILER_UDL __cpp_user_defined_literals = 200809 |
562 | * N2442 Q_COMPILER_UNICODE_STRINGS __cpp_unicode_literals = 200710 |
563 | * N2640 Q_COMPILER_UNIFORM_INIT |
564 | * N2544 Q_COMPILER_UNRESTRICTED_UNIONS |
565 | * N1653 Q_COMPILER_VARIADIC_MACROS |
566 | * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES __cpp_variadic_templates = 200704 |
567 | * |
568 | * For any future version of the C++ standard, we use only the SD-6 macro. |
569 | * For full listing, see |
570 | * http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations |
571 | * |
572 | * C++ extensions: |
573 | * Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays |
574 | */ |
575 | |
576 | #ifdef __cplusplus |
577 | # if __cplusplus < 201103L && !defined(Q_CC_MSVC) |
578 | # error Qt requires a C++11 compiler and yours does not seem to be that. |
579 | # endif |
580 | #endif |
581 | |
582 | #if defined(Q_CC_INTEL) && !defined(Q_CC_MSVC) |
583 | # define Q_COMPILER_RESTRICTED_VLA |
584 | # define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too |
585 | # define Q_COMPILER_THREADSAFE_STATICS |
586 | # if __INTEL_COMPILER < 1200 |
587 | # define Q_NO_TEMPLATE_FRIENDS |
588 | # endif |
589 | # if __INTEL_COMPILER >= 1310 && !defined(_WIN32) |
590 | // ICC supports C++14 binary literals in C, C++98, and C++11 modes |
591 | // at least since 13.1, but I can't test further back |
592 | # define Q_COMPILER_BINARY_LITERALS |
593 | # endif |
594 | # if __cplusplus >= 201103L || defined(__INTEL_CXX11_MODE__) |
595 | # if __INTEL_COMPILER >= 1200 |
596 | # define Q_COMPILER_AUTO_TYPE |
597 | # define Q_COMPILER_CLASS_ENUM |
598 | # define Q_COMPILER_DECLTYPE |
599 | # define Q_COMPILER_DEFAULT_MEMBERS |
600 | # define Q_COMPILER_DELETE_MEMBERS |
601 | # define Q_COMPILER_EXTERN_TEMPLATES |
602 | # define Q_COMPILER_LAMBDA |
603 | # define Q_COMPILER_RVALUE_REFS |
604 | # define Q_COMPILER_STATIC_ASSERT |
605 | # define Q_COMPILER_VARIADIC_MACROS |
606 | # endif |
607 | # if __INTEL_COMPILER >= 1210 |
608 | # define Q_COMPILER_ATTRIBUTES |
609 | # define Q_COMPILER_AUTO_FUNCTION |
610 | # define Q_COMPILER_NULLPTR |
611 | # define Q_COMPILER_TEMPLATE_ALIAS |
612 | # ifndef _CHAR16T // MSVC headers |
613 | # define Q_COMPILER_UNICODE_STRINGS |
614 | # endif |
615 | # define Q_COMPILER_VARIADIC_TEMPLATES |
616 | # endif |
617 | # if __INTEL_COMPILER >= 1300 |
618 | # define Q_COMPILER_ATOMICS |
619 | // constexpr support is only partial |
620 | //# define Q_COMPILER_CONSTEXPR |
621 | # define Q_COMPILER_INITIALIZER_LISTS |
622 | # define Q_COMPILER_UNIFORM_INIT |
623 | # define Q_COMPILER_NOEXCEPT |
624 | # endif |
625 | # if __INTEL_COMPILER >= 1400 |
626 | // causes issues with QArrayData and QtPrivate::RefCount - Intel issue ID 6000056211, bug DPD200534796 |
627 | //# define Q_COMPILER_CONSTEXPR |
628 | # define Q_COMPILER_DELEGATING_CONSTRUCTORS |
629 | # define Q_COMPILER_EXPLICIT_CONVERSIONS |
630 | # define Q_COMPILER_EXPLICIT_OVERRIDES |
631 | # define Q_COMPILER_NONSTATIC_MEMBER_INIT |
632 | # define Q_COMPILER_RANGE_FOR |
633 | # define Q_COMPILER_RAW_STRINGS |
634 | # define Q_COMPILER_REF_QUALIFIERS |
635 | # define Q_COMPILER_UNICODE_STRINGS |
636 | # define Q_COMPILER_UNRESTRICTED_UNIONS |
637 | # endif |
638 | # if __INTEL_COMPILER >= 1500 |
639 | # if __INTEL_COMPILER * 100 + __INTEL_COMPILER_UPDATE >= 150001 |
640 | // the bug mentioned above is fixed in 15.0.1 |
641 | # define Q_COMPILER_CONSTEXPR |
642 | # endif |
643 | # define Q_COMPILER_ALIGNAS |
644 | # define Q_COMPILER_ALIGNOF |
645 | # define Q_COMPILER_INHERITING_CONSTRUCTORS |
646 | # define Q_COMPILER_THREAD_LOCAL |
647 | # define Q_COMPILER_UDL |
648 | # endif |
649 | # elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L |
650 | // C11 features supported. Only tested with ICC 17 and up. |
651 | # define Q_COMPILER_STATIC_ASSERT |
652 | # if __has_include(<threads.h>) |
653 | # define Q_COMPILER_THREAD_LOCAL |
654 | # endif |
655 | # endif |
656 | #endif |
657 | |
658 | #if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !defined(Q_CC_MSVC) |
659 | /* General C++ features */ |
660 | # define Q_COMPILER_RESTRICTED_VLA |
661 | # define Q_COMPILER_THREADSAFE_STATICS |
662 | # if __has_feature(attribute_deprecated_with_message) |
663 | # define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text))) |
664 | # endif |
665 | |
666 | // Clang supports binary literals in C, C++98 and C++11 modes |
667 | // It's been supported "since the dawn of time itself" (cf. commit 179883) |
668 | # if __has_extension(cxx_binary_literals) |
669 | # define Q_COMPILER_BINARY_LITERALS |
670 | # endif |
671 | |
672 | // Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9 |
673 | # if Q_CC_CLANG >= 209 |
674 | # if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \ |
675 | || (defined(__cplusplus) && (__cplusplus >= 201103L)) \ |
676 | || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) |
677 | # define Q_COMPILER_VARIADIC_MACROS |
678 | # endif |
679 | # endif |
680 | |
681 | /* C++11 features, see http://clang.llvm.org/cxx_status.html */ |
682 | # if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) |
683 | /* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */ |
684 | # if __has_feature(cxx_alignas) |
685 | # define Q_COMPILER_ALIGNAS |
686 | # define Q_COMPILER_ALIGNOF |
687 | # endif |
688 | # if __has_feature(cxx_atomic) && __has_include(<atomic>) |
689 | # define Q_COMPILER_ATOMICS |
690 | # endif |
691 | # if __has_feature(cxx_attributes) |
692 | # define Q_COMPILER_ATTRIBUTES |
693 | # endif |
694 | # if __has_feature(cxx_auto_type) |
695 | # define Q_COMPILER_AUTO_FUNCTION |
696 | # define Q_COMPILER_AUTO_TYPE |
697 | # endif |
698 | # if __has_feature(cxx_strong_enums) |
699 | # define Q_COMPILER_CLASS_ENUM |
700 | # endif |
701 | # if __has_feature(cxx_constexpr) && Q_CC_CLANG > 302 /* CLANG 3.2 has bad/partial support */ |
702 | # define Q_COMPILER_CONSTEXPR |
703 | # endif |
704 | # if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */ |
705 | # define Q_COMPILER_DECLTYPE |
706 | # endif |
707 | # if __has_feature(cxx_defaulted_functions) |
708 | # define Q_COMPILER_DEFAULT_MEMBERS |
709 | # endif |
710 | # if __has_feature(cxx_deleted_functions) |
711 | # define Q_COMPILER_DELETE_MEMBERS |
712 | # endif |
713 | # if __has_feature(cxx_delegating_constructors) |
714 | # define Q_COMPILER_DELEGATING_CONSTRUCTORS |
715 | # endif |
716 | # if __has_feature(cxx_explicit_conversions) |
717 | # define Q_COMPILER_EXPLICIT_CONVERSIONS |
718 | # endif |
719 | # if __has_feature(cxx_override_control) |
720 | # define Q_COMPILER_EXPLICIT_OVERRIDES |
721 | # endif |
722 | # if __has_feature(cxx_inheriting_constructors) |
723 | # define Q_COMPILER_INHERITING_CONSTRUCTORS |
724 | # endif |
725 | # if __has_feature(cxx_generalized_initializers) |
726 | # define Q_COMPILER_INITIALIZER_LISTS |
727 | # define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */ |
728 | # endif |
729 | # if __has_feature(cxx_lambdas) |
730 | # define Q_COMPILER_LAMBDA |
731 | # endif |
732 | # if __has_feature(cxx_noexcept) |
733 | # define Q_COMPILER_NOEXCEPT |
734 | # endif |
735 | # if __has_feature(cxx_nonstatic_member_init) |
736 | # define Q_COMPILER_NONSTATIC_MEMBER_INIT |
737 | # endif |
738 | # if __has_feature(cxx_nullptr) |
739 | # define Q_COMPILER_NULLPTR |
740 | # endif |
741 | # if __has_feature(cxx_range_for) |
742 | # define Q_COMPILER_RANGE_FOR |
743 | # endif |
744 | # if __has_feature(cxx_raw_string_literals) |
745 | # define Q_COMPILER_RAW_STRINGS |
746 | # endif |
747 | # if __has_feature(cxx_reference_qualified_functions) |
748 | # define Q_COMPILER_REF_QUALIFIERS |
749 | # endif |
750 | # if __has_feature(cxx_rvalue_references) |
751 | # define Q_COMPILER_RVALUE_REFS |
752 | # endif |
753 | # if __has_feature(cxx_static_assert) |
754 | # define Q_COMPILER_STATIC_ASSERT |
755 | # endif |
756 | # if __has_feature(cxx_alias_templates) |
757 | # define Q_COMPILER_TEMPLATE_ALIAS |
758 | # endif |
759 | # if __has_feature(cxx_thread_local) |
760 | # if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */ |
761 | # define Q_COMPILER_THREAD_LOCAL |
762 | # endif |
763 | # endif |
764 | # if __has_feature(cxx_user_literals) |
765 | # define Q_COMPILER_UDL |
766 | # endif |
767 | # if __has_feature(cxx_unicode_literals) |
768 | # define Q_COMPILER_UNICODE_STRINGS |
769 | # endif |
770 | # if __has_feature(cxx_unrestricted_unions) |
771 | # define Q_COMPILER_UNRESTRICTED_UNIONS |
772 | # endif |
773 | # if __has_feature(cxx_variadic_templates) |
774 | # define Q_COMPILER_VARIADIC_TEMPLATES |
775 | # endif |
776 | /* Features that have no __has_feature() check */ |
777 | # if Q_CC_CLANG >= 209 /* since clang 2.9 */ |
778 | # define Q_COMPILER_EXTERN_TEMPLATES |
779 | # endif |
780 | # endif |
781 | |
782 | /* C++1y features, deprecated macros. Do not update this list. */ |
783 | # if __cplusplus > 201103L |
784 | //# if __has_feature(cxx_binary_literals) |
785 | //# define Q_COMPILER_BINARY_LITERALS // see above |
786 | //# endif |
787 | # if __has_feature(cxx_generic_lambda) |
788 | # define Q_COMPILER_GENERIC_LAMBDA |
789 | # endif |
790 | # if __has_feature(cxx_init_capture) |
791 | # define Q_COMPILER_LAMBDA_CAPTURES |
792 | # endif |
793 | # if __has_feature(cxx_relaxed_constexpr) |
794 | # define Q_COMPILER_RELAXED_CONSTEXPR_FUNCTIONS |
795 | # endif |
796 | # if __has_feature(cxx_decltype_auto) && __has_feature(cxx_return_type_deduction) |
797 | # define Q_COMPILER_RETURN_TYPE_DEDUCTION |
798 | # endif |
799 | # if __has_feature(cxx_variable_templates) |
800 | # define Q_COMPILER_VARIABLE_TEMPLATES |
801 | # endif |
802 | # if __has_feature(cxx_runtime_array) |
803 | # define Q_COMPILER_VLA |
804 | # endif |
805 | # endif |
806 | |
807 | # if defined(__STDC_VERSION__) |
808 | # if __has_feature(c_static_assert) |
809 | # define Q_COMPILER_STATIC_ASSERT |
810 | # endif |
811 | # if __has_feature(c_thread_local) && __has_include(<threads.h>) |
812 | # if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */ |
813 | # define Q_COMPILER_THREAD_LOCAL |
814 | # endif |
815 | # endif |
816 | # endif |
817 | |
818 | #endif // Q_CC_CLANG && !Q_CC_INTEL && !Q_CC_MSVC |
819 | |
820 | #if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) |
821 | # ifndef Q_DECL_UNUSED |
822 | # define Q_DECL_UNUSED __attribute__((__unused__)) |
823 | # endif |
824 | # define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED |
825 | #endif |
826 | |
827 | #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) |
828 | # define Q_COMPILER_RESTRICTED_VLA |
829 | # define Q_COMPILER_THREADSAFE_STATICS |
830 | # if Q_CC_GNU >= 403 |
831 | // GCC supports binary literals in C, C++98 and C++11 modes |
832 | # define Q_COMPILER_BINARY_LITERALS |
833 | # endif |
834 | # if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \ |
835 | || (defined(__cplusplus) && (__cplusplus >= 201103L)) \ |
836 | || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) |
837 | // Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97) |
838 | # define Q_COMPILER_VARIADIC_MACROS |
839 | # endif |
840 | # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L |
841 | # if Q_CC_GNU >= 403 |
842 | /* C++11 features supported in GCC 4.3: */ |
843 | # define Q_COMPILER_DECLTYPE |
844 | # define Q_COMPILER_RVALUE_REFS |
845 | # define Q_COMPILER_STATIC_ASSERT |
846 | # endif |
847 | # if Q_CC_GNU >= 404 |
848 | /* C++11 features supported in GCC 4.4: */ |
849 | # define Q_COMPILER_AUTO_FUNCTION |
850 | # define Q_COMPILER_AUTO_TYPE |
851 | # define Q_COMPILER_EXTERN_TEMPLATES |
852 | # define Q_COMPILER_UNIFORM_INIT |
853 | # define Q_COMPILER_UNICODE_STRINGS |
854 | # define Q_COMPILER_VARIADIC_TEMPLATES |
855 | # endif |
856 | # if Q_CC_GNU >= 405 |
857 | /* C++11 features supported in GCC 4.5: */ |
858 | # define Q_COMPILER_EXPLICIT_CONVERSIONS |
859 | /* GCC 4.4 implements initializer_list but does not define typedefs required |
860 | * by the standard. */ |
861 | # define Q_COMPILER_INITIALIZER_LISTS |
862 | # define Q_COMPILER_LAMBDA |
863 | # define Q_COMPILER_RAW_STRINGS |
864 | # define Q_COMPILER_CLASS_ENUM |
865 | # endif |
866 | # if Q_CC_GNU >= 406 |
867 | /* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete |
868 | * functions are supported only if they are public. Starting from 4.6, GCC handles |
869 | * final version - the access modifier is not relevant. */ |
870 | # define Q_COMPILER_DEFAULT_MEMBERS |
871 | # define Q_COMPILER_DELETE_MEMBERS |
872 | /* C++11 features supported in GCC 4.6: */ |
873 | # define Q_COMPILER_NULLPTR |
874 | # define Q_COMPILER_UNRESTRICTED_UNIONS |
875 | # define Q_COMPILER_RANGE_FOR |
876 | # endif |
877 | # if Q_CC_GNU >= 407 |
878 | /* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics. |
879 | * However, the implementation is incomplete for most platforms until GCC 4.7: |
880 | * instead, std::atomic would use an external lock. Since we need an std::atomic |
881 | * that is behavior-compatible with QBasicAtomic, we only enable it here */ |
882 | # define Q_COMPILER_ATOMICS |
883 | /* GCC 4.6.x has problems dealing with noexcept expressions, |
884 | * so turn the feature on for 4.7 and above, only */ |
885 | # define Q_COMPILER_NOEXCEPT |
886 | /* C++11 features supported in GCC 4.7: */ |
887 | # define Q_COMPILER_NONSTATIC_MEMBER_INIT |
888 | # define Q_COMPILER_DELEGATING_CONSTRUCTORS |
889 | # define Q_COMPILER_EXPLICIT_OVERRIDES |
890 | # define Q_COMPILER_TEMPLATE_ALIAS |
891 | # define Q_COMPILER_UDL |
892 | # endif |
893 | # if Q_CC_GNU >= 408 |
894 | # define Q_COMPILER_ATTRIBUTES |
895 | # define Q_COMPILER_ALIGNAS |
896 | # define Q_COMPILER_ALIGNOF |
897 | # define Q_COMPILER_INHERITING_CONSTRUCTORS |
898 | # define Q_COMPILER_THREAD_LOCAL |
899 | # if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1 |
900 | # define Q_COMPILER_REF_QUALIFIERS |
901 | # endif |
902 | # endif |
903 | # if Q_CC_GNU >= 500 |
904 | /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole |
905 | * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */ |
906 | # define Q_COMPILER_CONSTEXPR |
907 | # endif |
908 | # endif |
909 | # if __cplusplus > 201103L |
910 | # if Q_CC_GNU >= 409 |
911 | /* C++1y features in GCC 4.9 - deprecated, do not update this list */ |
912 | //# define Q_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension |
913 | # define Q_COMPILER_LAMBDA_CAPTURES |
914 | # define Q_COMPILER_RETURN_TYPE_DEDUCTION |
915 | # endif |
916 | # endif |
917 | # if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L |
918 | # if Q_CC_GNU >= 407 |
919 | /* C11 features supported in GCC 4.7: */ |
920 | # define Q_COMPILER_STATIC_ASSERT |
921 | # endif |
922 | # if Q_CC_GNU >= 409 && defined(__has_include) |
923 | /* C11 features supported in GCC 4.9: */ |
924 | # if __has_include(<threads.h>) |
925 | # define Q_COMPILER_THREAD_LOCAL |
926 | # endif |
927 | # endif |
928 | # endif |
929 | #endif |
930 | |
931 | #if defined(Q_CC_MSVC) |
932 | # if defined(__cplusplus) |
933 | /* C++11 features supported in VC8 = VC2005: */ |
934 | # define Q_COMPILER_VARIADIC_MACROS |
935 | |
936 | /* 2005 supports the override and final contextual keywords, in |
937 | the same positions as the C++11 variants, but 'final' is |
938 | called 'sealed' instead: |
939 | http://msdn.microsoft.com/en-us/library/0w2w91tf%28v=vs.80%29.aspx |
940 | The behavior is slightly different in C++/CLI, which requires the |
941 | "virtual" keyword to be present too, so don't define for that. |
942 | So don't define Q_COMPILER_EXPLICIT_OVERRIDES (since it's not |
943 | the same as the C++11 version), but define the Q_DECL_* flags |
944 | accordingly. */ |
945 | /* C++11 features supported in VC10 = VC2010: */ |
946 | # define Q_COMPILER_AUTO_FUNCTION |
947 | # define Q_COMPILER_AUTO_TYPE |
948 | # define Q_COMPILER_DECLTYPE |
949 | # define Q_COMPILER_EXTERN_TEMPLATES |
950 | # define Q_COMPILER_LAMBDA |
951 | # define Q_COMPILER_NULLPTR |
952 | # define Q_COMPILER_RVALUE_REFS |
953 | # define Q_COMPILER_STATIC_ASSERT |
954 | /* C++11 features supported in VC11 = VC2012: */ |
955 | # define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */ |
956 | # define Q_COMPILER_CLASS_ENUM |
957 | # define Q_COMPILER_ATOMICS |
958 | /* C++11 features in VC12 = VC2013 */ |
959 | # define Q_COMPILER_DELETE_MEMBERS |
960 | # define Q_COMPILER_DELEGATING_CONSTRUCTORS |
961 | # define Q_COMPILER_EXPLICIT_CONVERSIONS |
962 | # define Q_COMPILER_NONSTATIC_MEMBER_INIT |
963 | # define Q_COMPILER_RAW_STRINGS |
964 | # define Q_COMPILER_TEMPLATE_ALIAS |
965 | # define Q_COMPILER_VARIADIC_TEMPLATES |
966 | # define Q_COMPILER_INITIALIZER_LISTS // VC 12 SP 2 RC |
967 | /* C++11 features in VC14 = VC2015 */ |
968 | # define Q_COMPILER_DEFAULT_MEMBERS |
969 | # define Q_COMPILER_ALIGNAS |
970 | # define Q_COMPILER_ALIGNOF |
971 | # define Q_COMPILER_INHERITING_CONSTRUCTORS |
972 | # define Q_COMPILER_NOEXCEPT |
973 | # define Q_COMPILER_RANGE_FOR |
974 | # define Q_COMPILER_REF_QUALIFIERS |
975 | # define Q_COMPILER_THREAD_LOCAL |
976 | # define Q_COMPILER_UDL |
977 | # define Q_COMPILER_UNICODE_STRINGS |
978 | # define Q_COMPILER_UNRESTRICTED_UNIONS |
979 | # if _MSC_FULL_VER >= 190023419 |
980 | # define Q_COMPILER_ATTRIBUTES |
981 | // Almost working, see https://connect.microsoft.com/VisualStudio/feedback/details/2011648 |
982 | //# define Q_COMPILER_CONSTEXPR |
983 | # define Q_COMPILER_THREADSAFE_STATICS |
984 | # define Q_COMPILER_UNIFORM_INIT |
985 | # endif |
986 | # if _MSC_VER >= 1910 |
987 | # define Q_COMPILER_CONSTEXPR |
988 | # endif |
989 | # endif /* __cplusplus */ |
990 | #endif /* Q_CC_MSVC */ |
991 | |
992 | #ifdef Q_COMPILER_UNICODE_STRINGS |
993 | # define Q_STDLIB_UNICODE_STRINGS |
994 | #elif defined(__cplusplus) |
995 | # error "Qt6 requires Unicode string support in both the compiler and the standard library" |
996 | #endif |
997 | |
998 | #ifdef __cplusplus |
999 | # include <utility> |
1000 | # if defined(Q_OS_QNX) |
1001 | // By default, QNX 7.0 uses libc++ (from LLVM) and |
1002 | // QNX 6.X uses Dinkumware's libcpp. In all versions, |
1003 | // it is also possible to use GNU libstdc++. |
1004 | |
1005 | // For Dinkumware, some features must be disabled |
1006 | // (mostly because of library problems). |
1007 | // Dinkumware is assumed when __GLIBCXX__ (GNU libstdc++) |
1008 | // and _LIBCPP_VERSION (LLVM libc++) are both absent. |
1009 | # if !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION) |
1010 | |
1011 | // Older versions of libcpp (QNX 650) do not support C++11 features |
1012 | // _HAS_* macros are set to 1 by toolchains that actually include |
1013 | // Dinkum C++11 libcpp. |
1014 | |
1015 | # if !defined(_HAS_CPP0X) || !_HAS_CPP0X |
1016 | // Disable C++11 features that depend on library support |
1017 | # undef Q_COMPILER_INITIALIZER_LISTS |
1018 | # undef Q_COMPILER_RVALUE_REFS |
1019 | # undef Q_COMPILER_REF_QUALIFIERS |
1020 | # undef Q_COMPILER_NOEXCEPT |
1021 | // Disable C++11 library features: |
1022 | # undef Q_STDLIB_UNICODE_STRINGS |
1023 | # endif // !_HAS_CPP0X |
1024 | # if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T |
1025 | # undef Q_COMPILER_NULLPTR |
1026 | # endif //!_HAS_NULLPTR_T |
1027 | # if !defined(_HAS_CONSTEXPR) || !_HAS_CONSTEXPR |
1028 | // The libcpp is missing constexpr keywords on important functions like std::numeric_limits<>::min() |
1029 | // Disable constexpr support on QNX even if the compiler supports it |
1030 | # undef Q_COMPILER_CONSTEXPR |
1031 | # endif // !_HAS_CONSTEXPR |
1032 | # endif // !__GLIBCXX__ && !_LIBCPP_VERSION |
1033 | # endif // Q_OS_QNX |
1034 | # if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \ |
1035 | && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402) |
1036 | // Apple has not updated libstdc++ since 2007, which means it does not have |
1037 | // <initializer_list> or std::move. Let's disable these features |
1038 | # undef Q_COMPILER_INITIALIZER_LISTS |
1039 | # undef Q_COMPILER_RVALUE_REFS |
1040 | # undef Q_COMPILER_REF_QUALIFIERS |
1041 | // Also disable <atomic>, since it's clearly not there |
1042 | # undef Q_COMPILER_ATOMICS |
1043 | # endif |
1044 | # if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500 |
1045 | // ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode |
1046 | // (probably because libc++'s <atomic> on OS X failed to compile), but they're missing some |
1047 | // critical definitions. (Reported as Intel Issue ID 6000117277) |
1048 | # define __USE_CONSTEXPR 1 |
1049 | # define __USE_NOEXCEPT 1 |
1050 | # endif |
1051 | # if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC) |
1052 | // Apple's low-level implementation of the C++ support library |
1053 | // (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The |
1054 | // C++11 standard requires the deadlocks to be removed, so this will eventually |
1055 | // be fixed; for now, let's disable this. |
1056 | # undef Q_COMPILER_THREADSAFE_STATICS |
1057 | # endif |
1058 | #endif |
1059 | |
1060 | /* |
1061 | * C++11 keywords and expressions |
1062 | */ |
1063 | #ifdef Q_COMPILER_NULLPTR |
1064 | # define Q_NULLPTR nullptr |
1065 | #else |
1066 | # define Q_NULLPTR NULL |
1067 | #endif |
1068 | |
1069 | #ifdef Q_COMPILER_DEFAULT_MEMBERS |
1070 | # define Q_DECL_EQ_DEFAULT = default |
1071 | #else |
1072 | # define Q_DECL_EQ_DEFAULT |
1073 | #endif |
1074 | |
1075 | #ifdef Q_COMPILER_DELETE_MEMBERS |
1076 | # define Q_DECL_EQ_DELETE = delete |
1077 | #else |
1078 | # define Q_DECL_EQ_DELETE |
1079 | #endif |
1080 | |
1081 | // Don't break code that is already using Q_COMPILER_DEFAULT_DELETE_MEMBERS |
1082 | #if defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS) |
1083 | # define Q_COMPILER_DEFAULT_DELETE_MEMBERS |
1084 | #endif |
1085 | |
1086 | #if defined Q_COMPILER_CONSTEXPR |
1087 | # if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 |
1088 | # define Q_DECL_CONSTEXPR constexpr |
1089 | # define Q_DECL_RELAXED_CONSTEXPR constexpr |
1090 | # define Q_CONSTEXPR constexpr |
1091 | # define Q_RELAXED_CONSTEXPR constexpr |
1092 | # else |
1093 | # define Q_DECL_CONSTEXPR constexpr |
1094 | # define Q_DECL_RELAXED_CONSTEXPR |
1095 | # define Q_CONSTEXPR constexpr |
1096 | # define Q_RELAXED_CONSTEXPR const |
1097 | # endif |
1098 | #else |
1099 | # define Q_DECL_CONSTEXPR |
1100 | # define Q_DECL_RELAXED_CONSTEXPR |
1101 | # define Q_CONSTEXPR const |
1102 | # define Q_RELAXED_CONSTEXPR const |
1103 | #endif |
1104 | |
1105 | #ifdef Q_COMPILER_EXPLICIT_OVERRIDES |
1106 | # define Q_DECL_OVERRIDE override |
1107 | # define Q_DECL_FINAL final |
1108 | #else |
1109 | # ifndef Q_DECL_OVERRIDE |
1110 | # define Q_DECL_OVERRIDE |
1111 | # endif |
1112 | # ifndef Q_DECL_FINAL |
1113 | # define Q_DECL_FINAL |
1114 | # endif |
1115 | #endif |
1116 | |
1117 | #ifdef Q_COMPILER_NOEXCEPT |
1118 | # define Q_DECL_NOEXCEPT noexcept |
1119 | # define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x) |
1120 | #else |
1121 | # define Q_DECL_NOEXCEPT |
1122 | # define Q_DECL_NOEXCEPT_EXPR(x) |
1123 | #endif |
1124 | #define Q_DECL_NOTHROW Q_DECL_NOEXCEPT |
1125 | |
1126 | #ifndef Q_ALIGNOF |
1127 | # define Q_ALIGNOF(x) alignof(x) |
1128 | #endif |
1129 | |
1130 | #ifndef Q_DECL_ALIGN |
1131 | # define Q_DECL_ALIGN(n) alignas(n) |
1132 | #endif |
1133 | |
1134 | #if __has_cpp_attribute(nodiscard) && (!defined(Q_CC_CLANG) || __cplusplus > 201402L) // P0188R1 |
1135 | // Can't use [[nodiscard]] with Clang and C++11/14, see https://bugs.llvm.org/show_bug.cgi?id=33518 |
1136 | # undef Q_REQUIRED_RESULT |
1137 | # define Q_REQUIRED_RESULT [[nodiscard]] |
1138 | #endif |
1139 | |
1140 | #if __has_cpp_attribute(maybe_unused) |
1141 | # undef Q_DECL_UNUSED |
1142 | # define Q_DECL_UNUSED [[maybe_unused]] |
1143 | #endif |
1144 | |
1145 | #if __has_cpp_attribute(deprecated) |
1146 | # ifdef Q_DECL_DEPRECATED |
1147 | # undef Q_DECL_DEPRECATED |
1148 | # endif |
1149 | # ifdef Q_DECL_DEPRECATED_X |
1150 | # undef Q_DECL_DEPRECATED_X |
1151 | # endif |
1152 | # define Q_DECL_DEPRECATED [[deprecated]] |
1153 | # define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]] |
1154 | #endif |
1155 | |
1156 | #if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411 |
1157 | # define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED |
1158 | # define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x) |
1159 | #endif |
1160 | |
1161 | /* |
1162 | * Fallback macros to certain compiler features |
1163 | */ |
1164 | |
1165 | #ifndef Q_NORETURN |
1166 | # define Q_NORETURN |
1167 | #endif |
1168 | #ifndef Q_LIKELY |
1169 | # define Q_LIKELY(x) (x) |
1170 | #endif |
1171 | #ifndef Q_UNLIKELY |
1172 | # define Q_UNLIKELY(x) (x) |
1173 | #endif |
1174 | #ifndef Q_ASSUME_IMPL |
1175 | # define Q_ASSUME_IMPL(expr) qt_noop() |
1176 | #endif |
1177 | #ifndef Q_UNREACHABLE_IMPL |
1178 | # define Q_UNREACHABLE_IMPL() qt_noop() |
1179 | #endif |
1180 | #ifndef Q_ALLOC_SIZE |
1181 | # define Q_ALLOC_SIZE(x) |
1182 | #endif |
1183 | #ifndef Q_REQUIRED_RESULT |
1184 | # define Q_REQUIRED_RESULT |
1185 | #endif |
1186 | #ifndef Q_DECL_DEPRECATED |
1187 | # define Q_DECL_DEPRECATED |
1188 | #endif |
1189 | #ifndef Q_DECL_VARIABLE_DEPRECATED |
1190 | # define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED |
1191 | #endif |
1192 | #ifndef Q_DECL_DEPRECATED_X |
1193 | # define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED |
1194 | #endif |
1195 | #ifndef Q_DECL_ENUMERATOR_DEPRECATED |
1196 | # define Q_DECL_ENUMERATOR_DEPRECATED |
1197 | #endif |
1198 | #ifndef Q_DECL_ENUMERATOR_DEPRECATED_X |
1199 | # define Q_DECL_ENUMERATOR_DEPRECATED_X(x) |
1200 | #endif |
1201 | #ifndef Q_DECL_EXPORT |
1202 | # define Q_DECL_EXPORT |
1203 | #endif |
1204 | #ifndef Q_DECL_IMPORT |
1205 | # define Q_DECL_IMPORT |
1206 | #endif |
1207 | #ifndef Q_DECL_HIDDEN |
1208 | # define Q_DECL_HIDDEN |
1209 | #endif |
1210 | #ifndef Q_DECL_UNUSED |
1211 | # define Q_DECL_UNUSED |
1212 | #endif |
1213 | #ifndef Q_DECL_UNUSED_MEMBER |
1214 | # define Q_DECL_UNUSED_MEMBER |
1215 | #endif |
1216 | #ifndef Q_FUNC_INFO |
1217 | # if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) |
1218 | # define Q_FUNC_INFO __FILE__ "(line number unavailable)" |
1219 | # else |
1220 | # define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__) |
1221 | # endif |
1222 | #endif |
1223 | #ifndef Q_DECL_CF_RETURNS_RETAINED |
1224 | # define Q_DECL_CF_RETURNS_RETAINED |
1225 | #endif |
1226 | #ifndef Q_DECL_NS_RETURNS_AUTORELEASED |
1227 | # define Q_DECL_NS_RETURNS_AUTORELEASED |
1228 | #endif |
1229 | #ifndef Q_DECL_PURE_FUNCTION |
1230 | # define Q_DECL_PURE_FUNCTION |
1231 | #endif |
1232 | #ifndef Q_DECL_CONST_FUNCTION |
1233 | # define Q_DECL_CONST_FUNCTION Q_DECL_PURE_FUNCTION |
1234 | #endif |
1235 | #ifndef Q_DECL_COLD_FUNCTION |
1236 | # define Q_DECL_COLD_FUNCTION |
1237 | #endif |
1238 | #ifndef QT_MAKE_UNCHECKED_ARRAY_ITERATOR |
1239 | # define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) (x) |
1240 | #endif |
1241 | #ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR |
1242 | # define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x) |
1243 | #endif |
1244 | |
1245 | /* |
1246 | * "Weak overloads" - makes an otherwise confliciting overload weaker |
1247 | * (by making it a template) |
1248 | */ |
1249 | #define Q_WEAK_OVERLOAD template <typename = void> |
1250 | |
1251 | /* |
1252 | * Warning/diagnostic handling |
1253 | */ |
1254 | |
1255 | #define QT_DO_PRAGMA(text) _Pragma(#text) |
1256 | #if defined(Q_CC_INTEL) && defined(Q_CC_MSVC) |
1257 | /* icl.exe: Intel compiler on Windows */ |
1258 | # undef QT_DO_PRAGMA /* not needed */ |
1259 | # define QT_WARNING_PUSH __pragma(warning(push)) |
1260 | # define QT_WARNING_POP __pragma(warning(pop)) |
1261 | # define QT_WARNING_DISABLE_MSVC(number) |
1262 | # define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) |
1263 | # define QT_WARNING_DISABLE_CLANG(text) |
1264 | # define QT_WARNING_DISABLE_GCC(text) |
1265 | # define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1478 1786) |
1266 | # define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_INTEL(1572) |
1267 | # define QT_WARNING_DISABLE_INVALID_OFFSETOF |
1268 | #elif defined(Q_CC_INTEL) |
1269 | /* icc: Intel compiler on Linux or OS X */ |
1270 | # define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) |
1271 | # define QT_WARNING_POP QT_DO_PRAGMA(warning(pop)) |
1272 | # define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable: number)) |
1273 | # define QT_WARNING_DISABLE_MSVC(number) |
1274 | # define QT_WARNING_DISABLE_CLANG(text) |
1275 | # define QT_WARNING_DISABLE_GCC(text) |
1276 | # define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_INTEL(1478 1786) |
1277 | # define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_INTEL(1572) |
1278 | # define QT_WARNING_DISABLE_INVALID_OFFSETOF |
1279 | #elif defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) |
1280 | # undef QT_DO_PRAGMA /* not needed */ |
1281 | # define QT_WARNING_PUSH __pragma(warning(push)) |
1282 | # define QT_WARNING_POP __pragma(warning(pop)) |
1283 | # define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) |
1284 | # define QT_WARNING_DISABLE_INTEL(number) |
1285 | # define QT_WARNING_DISABLE_CLANG(text) |
1286 | # define QT_WARNING_DISABLE_GCC(text) |
1287 | # define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_MSVC(4996) |
1288 | # define QT_WARNING_DISABLE_FLOAT_COMPARE |
1289 | # define QT_WARNING_DISABLE_INVALID_OFFSETOF |
1290 | #elif defined(Q_CC_CLANG) |
1291 | # define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) |
1292 | # define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) |
1293 | # define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) |
1294 | # define QT_WARNING_DISABLE_GCC(text) |
1295 | # define QT_WARNING_DISABLE_INTEL(number) |
1296 | # define QT_WARNING_DISABLE_MSVC(number) |
1297 | # define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") |
1298 | # define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_CLANG("-Wfloat-equal") |
1299 | # define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_CLANG("-Winvalid-offsetof") |
1300 | #elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) |
1301 | # define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) |
1302 | # define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) |
1303 | # define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) |
1304 | # define QT_WARNING_DISABLE_CLANG(text) |
1305 | # define QT_WARNING_DISABLE_INTEL(number) |
1306 | # define QT_WARNING_DISABLE_MSVC(number) |
1307 | # define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") |
1308 | # define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_GCC("-Wfloat-equal") |
1309 | # define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_GCC("-Winvalid-offsetof") |
1310 | #else // All other compilers, GCC < 4.6 and MSVC < 2008 |
1311 | # define QT_WARNING_DISABLE_GCC(text) |
1312 | # define QT_WARNING_PUSH |
1313 | # define QT_WARNING_POP |
1314 | # define QT_WARNING_DISABLE_INTEL(number) |
1315 | # define QT_WARNING_DISABLE_MSVC(number) |
1316 | # define QT_WARNING_DISABLE_CLANG(text) |
1317 | # define QT_WARNING_DISABLE_GCC(text) |
1318 | # define QT_WARNING_DISABLE_DEPRECATED |
1319 | # define QT_WARNING_DISABLE_FLOAT_COMPARE |
1320 | #endif |
1321 | |
1322 | #ifndef QT_IGNORE_DEPRECATIONS |
1323 | #define QT_IGNORE_DEPRECATIONS(statement) \ |
1324 | QT_WARNING_PUSH \ |
1325 | QT_WARNING_DISABLE_DEPRECATED \ |
1326 | statement \ |
1327 | QT_WARNING_POP |
1328 | #endif |
1329 | |
1330 | /* |
1331 | Proper for-scoping in MIPSpro CC |
1332 | */ |
1333 | #ifndef QT_NO_KEYWORDS |
1334 | # if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64)) |
1335 | # define for if (0) {} else for |
1336 | # endif |
1337 | #endif |
1338 | |
1339 | #ifdef Q_COMPILER_RVALUE_REFS |
1340 | #define qMove(x) std::move(x) |
1341 | #else |
1342 | #define qMove(x) (x) |
1343 | #endif |
1344 | |
1345 | #define Q_UNREACHABLE() \ |
1346 | do {\ |
1347 | Q_ASSERT_X(false, "Q_UNREACHABLE()", "Q_UNREACHABLE was reached");\ |
1348 | Q_UNREACHABLE_IMPL();\ |
1349 | } while (false) |
1350 | |
1351 | #define Q_ASSUME(Expr) \ |
1352 | do {\ |
1353 | const bool valueOfExpression = Expr;\ |
1354 | Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\ |
1355 | Q_ASSUME_IMPL(valueOfExpression);\ |
1356 | } while (false) |
1357 | |
1358 | #if defined(__cplusplus) |
1359 | #if __has_cpp_attribute(clang::fallthrough) |
1360 | # define Q_FALLTHROUGH() [[clang::fallthrough]] |
1361 | #elif __has_cpp_attribute(gnu::fallthrough) |
1362 | # define Q_FALLTHROUGH() [[gnu::fallthrough]] |
1363 | #elif __has_cpp_attribute(fallthrough) |
1364 | # define Q_FALLTHROUGH() [[fallthrough]] |
1365 | #endif |
1366 | #endif |
1367 | #ifndef Q_FALLTHROUGH |
1368 | # if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL) |
1369 | # define Q_FALLTHROUGH() __attribute__((fallthrough)) |
1370 | # else |
1371 | # define Q_FALLTHROUGH() (void)0 |
1372 | #endif |
1373 | #endif |
1374 | |
1375 | |
1376 | /* |
1377 | Sanitize compiler feature availability |
1378 | */ |
1379 | #if !defined(Q_PROCESSOR_X86) |
1380 | # undef QT_COMPILER_SUPPORTS_SSE2 |
1381 | # undef QT_COMPILER_SUPPORTS_SSE3 |
1382 | # undef QT_COMPILER_SUPPORTS_SSSE3 |
1383 | # undef QT_COMPILER_SUPPORTS_SSE4_1 |
1384 | # undef QT_COMPILER_SUPPORTS_SSE4_2 |
1385 | # undef QT_COMPILER_SUPPORTS_AVX |
1386 | # undef QT_COMPILER_SUPPORTS_AVX2 |
1387 | # undef QT_COMPILER_SUPPORTS_F16C |
1388 | #endif |
1389 | #if !defined(Q_PROCESSOR_ARM) |
1390 | # undef QT_COMPILER_SUPPORTS_NEON |
1391 | #endif |
1392 | #if !defined(Q_PROCESSOR_MIPS) |
1393 | # undef QT_COMPILER_SUPPORTS_MIPS_DSP |
1394 | # undef QT_COMPILER_SUPPORTS_MIPS_DSPR2 |
1395 | #endif |
1396 | |
1397 | #endif // QCOMPILERDETECTION_H |
1398 | |