Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcompilerdetection.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#if 0
7#pragma qt_class(QtCompilerDetection)
8#pragma qt_sync_skip_header_check
9#pragma qt_sync_stop_processing
10#endif
11
12#ifndef QCOMPILERDETECTION_H
13#define QCOMPILERDETECTION_H
14
15#include <QtCore/qprocessordetection.h>
16#include <QtCore/qsystemdetection.h>
17#include <QtCore/qtconfiginclude.h>
18
19/*
20 The compiler, must be one of: (Q_CC_x)
21
22 COVERITY - Coverity cov-scan
23 SYM - Digital Mars C/C++ (used to be Symantec C++)
24 MSVC - Microsoft Visual C/C++, Intel C++ for Windows
25 BOR - Borland/Turbo C++
26 WAT - Watcom C++
27 GNU - GNU C++
28 COMEAU - Comeau C++
29 EDG - Edison Design Group C++
30 OC - CenterLine C++
31 SUN - Forte Developer, or Sun Studio C++
32 MIPS - MIPSpro C++
33 DEC - DEC C++
34 HPACC - HP aC++
35 USLC - SCO OUDK and UDK
36 CDS - Reliant C++
37 KAI - KAI C++
38 INTEL - Intel C++ for Linux, Intel C++ for Windows
39 HIGHC - MetaWare High C/C++
40 PGI - Portland Group C++
41 GHS - Green Hills Optimizing C++ Compilers
42 RVCT - ARM Realview Compiler Suite
43 CLANG - C++ front-end for the LLVM compiler
44
45
46 Should be sorted most to least authoritative.
47*/
48
49#if defined(__COVERITY__)
50# define Q_CC_COVERITY
51# define Q_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE
52#endif
53
54/* Symantec C++ is now Digital Mars */
55#if defined(__DMC__) || defined(__SC__)
56# define Q_CC_SYM
57/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */
58# if defined(__SC__) && __SC__ < 0x750
59# error "Compiler not supported"
60# endif
61
62#elif defined(_MSC_VER)
63# define Q_CC_MSVC (_MSC_VER)
64# define Q_CC_MSVC_NET
65# define Q_CC_MSVC_ONLY Q_CC_MSVC
66# ifdef __clang__
67# undef Q_CC_MSVC_ONLY
68# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
69# define Q_CC_CLANG_ONLY Q_CC_CLANG
70# endif
71# define Q_OUTOFLINE_TEMPLATE inline
72# define Q_COMPILER_MANGLES_RETURN_TYPE
73# define Q_COMPILER_MANGLES_ACCESS_SPECIFIER
74# define Q_FUNC_INFO __FUNCSIG__
75# define Q_ASSUME_IMPL(expr) __assume(expr)
76# define Q_UNREACHABLE_IMPL() __assume(0)
77# define Q_DECL_EXPORT __declspec(dllexport)
78# define Q_DECL_IMPORT __declspec(dllimport)
79# if _MSC_VER < 1938 // stdext is deprecated since VS 2022 17.8
80# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500
81# endif
82# ifdef Q_CC_MSVC_ONLY
83# define Q_COMPILER_COMPLAINS_ABOUT_RETURN_AFTER_UNREACHABLE
84# endif
85
86#elif defined(__BORLANDC__) || defined(__TURBOC__)
87# define Q_CC_BOR
88# define Q_INLINE_TEMPLATE
89# if __BORLANDC__ < 0x502
90# error "Compiler not supported"
91# endif
92
93#elif defined(__WATCOMC__)
94# define Q_CC_WAT
95
96/* ARM Realview Compiler Suite
97 RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given),
98 so check for it before that */
99#elif defined(__ARMCC__) || defined(__CC_ARM)
100# define Q_CC_RVCT
101/* work-around for missing compiler intrinsics */
102# define __is_empty(X) false
103# define __is_pod(X) false
104# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
105# ifdef Q_OS_LINUX
106# define Q_DECL_EXPORT __attribute__((visibility("default")))
107# define Q_DECL_IMPORT __attribute__((visibility("default")))
108# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
109# else
110# define Q_DECL_EXPORT __declspec(dllexport)
111# define Q_DECL_IMPORT __declspec(dllimport)
112# endif
113
114#elif defined(__GNUC__)
115# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__)
116# if defined(__MINGW32__)
117# define Q_CC_MINGW
118# endif
119# if defined(__clang__)
120/* Clang also masquerades as GCC */
121# if defined(__apple_build_version__)
122 // The Clang version reported by Apple Clang in __clang_major__
123 // and __clang_minor__ does _not_ reflect the actual upstream
124 // version of the compiler. To allow consumers to use a single
125 // define to verify the Clang version we hard-code the versions
126 // based on the best available info we have about the actual
127 // version: http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions
128# if __apple_build_version__ >= 17000319 // Xcode 26.0
129# define Q_CC_CLANG 1915
130# elif __apple_build_version__ >= 17000013 // Xcode 16.3
131# define Q_CC_CLANG 1914
132# elif __apple_build_version__ >= 16000026 // Xcode 16.0
133# define Q_CC_CLANG 1706
134# elif __apple_build_version__ >= 15000040 // Xcode 15.0
135# define Q_CC_CLANG 1600
136# elif __apple_build_version__ >= 14030022 // Xcode 14.3
137# define Q_CC_CLANG 1500
138# elif __apple_build_version__ >= 14000029 // Xcode 14.0
139# define Q_CC_CLANG 1400
140# elif __apple_build_version__ >= 13160021 // Xcode 13.3
141# define Q_CC_CLANG 1300
142# elif __apple_build_version__ >= 13000029 // Xcode 13.0
143# define Q_CC_CLANG 1200
144# elif __apple_build_version__ >= 12050022 // Xcode 12.5
145# define Q_CC_CLANG 1110
146# elif __apple_build_version__ >= 12000032 // Xcode 12.0
147# define Q_CC_CLANG 1000
148# elif __apple_build_version__ >= 11030032 // Xcode 11.4
149# define Q_CC_CLANG 900
150# elif __apple_build_version__ >= 11000033 // Xcode 11.0
151# define Q_CC_CLANG 800
152# else
153# error "Unsupported Apple Clang version"
154# endif
155# else
156 // Non-Apple Clang, so we trust the versions reported
157# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
158# endif
159# define Q_CC_CLANG_ONLY Q_CC_CLANG
160# if __has_builtin(__builtin_assume)
161# define Q_ASSUME_IMPL(expr) __builtin_assume(expr)
162# else
163# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
164# endif
165# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
166# if !defined(__has_extension)
167# /* Compatibility with older Clang versions */
168# define __has_extension __has_feature
169# endif
170# if defined(__APPLE__)
171 /* Apple/clang specific features */
172# define Q_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
173# ifdef __OBJC__
174# define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased))
175# endif
176# endif
177# ifdef __EMSCRIPTEN__
178# define Q_CC_EMSCRIPTEN
179# endif
180# else
181/* Plain GCC */
182# define Q_CC_GNU_ONLY Q_CC_GNU
183# if Q_CC_GNU >= 405
184# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
185# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
186# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
187# endif
188# endif
189
190# ifdef Q_OS_WIN
191# define Q_DECL_EXPORT __declspec(dllexport)
192# define Q_DECL_IMPORT __declspec(dllimport)
193# else
194# define Q_DECL_EXPORT_OVERRIDABLE __attribute__((visibility("default"), weak))
195# ifdef QT_USE_PROTECTED_VISIBILITY
196# define Q_DECL_EXPORT __attribute__((visibility("protected")))
197# else
198# define Q_DECL_EXPORT __attribute__((visibility("default")))
199# endif
200# define Q_DECL_IMPORT __attribute__((visibility("default")))
201# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
202# endif
203
204# define Q_FUNC_INFO __PRETTY_FUNCTION__
205# define Q_TYPEOF(expr) __typeof__(expr)
206# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
207# define Q_DECL_UNUSED __attribute__((__unused__))
208# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
209# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
210# define Q_NORETURN __attribute__((__noreturn__))
211# define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__))
212# define Q_DECL_PURE_FUNCTION __attribute__((pure))
213# define Q_DECL_CONST_FUNCTION __attribute__((const))
214# define Q_DECL_COLD_FUNCTION __attribute__((cold))
215# define Q_PACKED __attribute__ ((__packed__))
216# ifndef __ARM_EABI__
217# define QT_NO_ARM_EABI
218# endif
219# if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG)
220# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
221# endif
222
223/* IBM compiler versions are a bit messy. There are actually two products:
224 the C product, and the C++ product. The C++ compiler is always packaged
225 with the latest version of the C compiler. Version numbers do not always
226 match. This little table (I'm not sure it's accurate) should be helpful:
227
228 C++ product C product
229
230 C Set 3.1 C Compiler 3.0
231 ... ...
232 C++ Compiler 3.6.6 C Compiler 4.3
233 ... ...
234 Visual Age C++ 4.0 ...
235 ... ...
236 Visual Age C++ 5.0 C Compiler 5.0
237 ... ...
238 Visual Age C++ 6.0 C Compiler 6.0
239
240 Now:
241 __xlC__ is the version of the C compiler in hexadecimal notation
242 is only an approximation of the C++ compiler version
243 __IBMCPP__ is the version of the C++ compiler in decimal notation
244 but it is not defined on older compilers like C Set 3.1 */
245#elif defined(__xlC__)
246# define Q_CC_XLC
247# if __xlC__ < 0x400
248# error "Compiler not supported"
249# elif __xlC__ >= 0x0600
250# define Q_TYPEOF(expr) __typeof__(expr)
251# define Q_PACKED __attribute__((__packed__))
252# endif
253
254/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed
255 on DEC C++ V5.5-004. New versions do define __EDG__ - observed on
256 Compaq C++ V6.3-002.
257 This compiler is different enough from other EDG compilers to handle
258 it separately anyway. */
259#elif defined(__DECCXX) || defined(__DECC)
260# define Q_CC_DEC
261/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older
262 DEC C++ V5 compilers. */
263# if defined(__EDG__)
264# define Q_CC_EDG
265# endif
266/* Compaq has disabled EDG's _BOOL macro and uses _BOOL_EXISTS instead
267 - observed on Compaq C++ V6.3-002.
268 In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
269# if !defined(_BOOL_EXISTS)
270# error "Compiler not supported"
271# endif
272/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
273/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on
274 DEC C++ V5.5-004. */
275# if __DECCXX_VER < 60060000
276# define Q_BROKEN_TEMPLATE_SPECIALIZATION
277# endif
278/* avoid undefined symbol problems with out-of-line template members */
279# define Q_OUTOFLINE_TEMPLATE inline
280
281/* The Portland Group C++ compiler is based on EDG and does define __EDG__
282 but the C compiler does not */
283#elif defined(__PGI)
284# define Q_CC_PGI
285# if defined(__EDG__)
286# define Q_CC_EDG
287# endif
288
289/* Compilers with EDG front end are similar. To detect them we test:
290 __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b
291 __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002
292 and PGI C++ 5.2-4 */
293#elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__))
294# define Q_CC_EDG
295/* From the EDG documentation (does not seem to apply to Compaq C++ or GHS C):
296 _BOOL
297 Defined in C++ mode when bool is a keyword. The name of this
298 predefined macro is specified by a configuration flag. _BOOL
299 is the default.
300 __BOOL_DEFINED
301 Defined in Microsoft C++ mode when bool is a keyword. */
302# if !defined(_BOOL) && !defined(__BOOL_DEFINED) && !defined(__ghs)
303# error "Compiler not supported"
304# endif
305
306/* The Comeau compiler is based on EDG and does define __EDG__ */
307# if defined(__COMO__)
308# define Q_CC_COMEAU
309
310/* The `using' keyword was introduced to avoid KAI C++ warnings
311 but it's now causing KAI C++ errors instead. The standard is
312 unclear about the use of this keyword, and in practice every
313 compiler is using its own set of rules. Forget it. */
314# elif defined(__KCC)
315# define Q_CC_KAI
316
317/* Uses CFront, make sure to read the manual how to tweak templates. */
318# elif defined(__ghs)
319# define Q_CC_GHS
320# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
321# define Q_PACKED __attribute__ ((__packed__))
322# define Q_FUNC_INFO __PRETTY_FUNCTION__
323# define Q_TYPEOF(expr) __typeof__(expr)
324# define Q_UNREACHABLE_IMPL()
325# if defined(__cplusplus)
326# define Q_COMPILER_AUTO_TYPE
327# define Q_COMPILER_STATIC_ASSERT
328# define Q_COMPILER_RANGE_FOR
329# if __GHS_VERSION_NUMBER >= 201505
330# define Q_COMPILER_ALIGNAS
331# define Q_COMPILER_ALIGNOF
332# define Q_COMPILER_ATOMICS
333# define Q_COMPILER_ATTRIBUTES
334# define Q_COMPILER_AUTO_FUNCTION
335# define Q_COMPILER_CLASS_ENUM
336# define Q_COMPILER_DECLTYPE
337# define Q_COMPILER_DEFAULT_MEMBERS
338# define Q_COMPILER_DELETE_MEMBERS
339# define Q_COMPILER_DELEGATING_CONSTRUCTORS
340# define Q_COMPILER_EXPLICIT_CONVERSIONS
341# define Q_COMPILER_EXPLICIT_OVERRIDES
342# define Q_COMPILER_EXTERN_TEMPLATES
343# define Q_COMPILER_INHERITING_CONSTRUCTORS
344# define Q_COMPILER_INITIALIZER_LISTS
345# define Q_COMPILER_LAMBDA
346# define Q_COMPILER_NONSTATIC_MEMBER_INIT
347# define Q_COMPILER_NOEXCEPT
348# define Q_COMPILER_NULLPTR
349# define Q_COMPILER_RANGE_FOR
350# define Q_COMPILER_RAW_STRINGS
351# define Q_COMPILER_REF_QUALIFIERS
352# define Q_COMPILER_RVALUE_REFS
353# define Q_COMPILER_STATIC_ASSERT
354# define Q_COMPILER_TEMPLATE_ALIAS
355# define Q_COMPILER_THREAD_LOCAL
356# define Q_COMPILER_UDL
357# define Q_COMPILER_UNICODE_STRINGS
358# define Q_COMPILER_UNIFORM_INIT
359# define Q_COMPILER_UNRESTRICTED_UNIONS
360# define Q_COMPILER_VARIADIC_MACROS
361# define Q_COMPILER_VARIADIC_TEMPLATES
362# endif
363# endif //__cplusplus
364
365# elif defined(__DCC__)
366# define Q_CC_DIAB
367# if !defined(__bool)
368# error "Compiler not supported"
369# endif
370
371/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */
372# elif defined(__USLC__) && defined(__SCO_VERSION__)
373# define Q_CC_USLC
374/* The latest UDK 7.1.1b does not need this, but previous versions do */
375# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010)
376# define Q_OUTOFLINE_TEMPLATE inline
377# endif
378
379/* Never tested! */
380# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
381# define Q_CC_OC
382
383/* CDS++ defines __EDG__ although this is not documented in the Reliant
384 documentation. It also follows conventions like _BOOL and this documented */
385# elif defined(sinix)
386# define Q_CC_CDS
387# endif
388
389/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler
390 (see __DCC__ above). This one is for C mode files (__EDG is not defined) */
391#elif defined(_DIAB_TOOL)
392# define Q_CC_DIAB
393# define Q_FUNC_INFO __PRETTY_FUNCTION__
394
395/* Never tested! */
396#elif defined(__HIGHC__)
397# define Q_CC_HIGHC
398
399#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
400# define Q_CC_SUN
401# define Q_COMPILER_MANGLES_RETURN_TYPE
402/* 5.0 compiler or better
403 'bool' is enabled by default but can be disabled using -features=nobool
404 in which case _BOOL is not defined
405 this is the default in 4.2 compatibility mode triggered by -compat=4 */
406# if __SUNPRO_CC >= 0x500
407# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
408 /* see http://developers.sun.com/sunstudio/support/Ccompare.html */
409# if __SUNPRO_CC >= 0x590
410# define Q_TYPEOF(expr) __typeof__(expr)
411# endif
412# if __SUNPRO_CC >= 0x550
413# define Q_DECL_EXPORT __global
414# endif
415# if !defined(_BOOL)
416# error "Compiler not supported"
417# endif
418/* 4.2 compiler or older */
419# else
420# error "Compiler not supported"
421# endif
422
423/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
424 documentation but nevertheless uses EDG conventions like _BOOL */
425#elif defined(sinix)
426# define Q_CC_EDG
427# define Q_CC_CDS
428# if !defined(_BOOL)
429# error "Compiler not supported"
430# endif
431# define Q_BROKEN_TEMPLATE_SPECIALIZATION
432
433#else
434# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
435#endif
436
437/*
438 * SG10's SD-6 feature detection and some useful extensions from Clang and GCC
439 * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
440 * http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros
441 * Not using wrapper macros, per http://eel.is/c++draft/cpp.cond#7.sentence-2
442 */
443#ifndef __has_builtin
444# define __has_builtin(x) 0
445#endif
446#ifndef __has_feature
447# define __has_feature(x) 0
448#endif
449#ifndef __has_attribute
450# define __has_attribute(x) 0
451#endif
452#ifndef __has_c_attribute
453# define __has_c_attribute(x) 0
454#endif
456# define __has_cpp_attribute(x) 0
457#endif
458#ifndef __has_include
459# define __has_include(x) 0
460#endif
461#ifndef __has_include_next
462# define __has_include_next(x) 0
463#endif
464
465/*
466 detecting ASAN can be helpful to disable slow tests
467 clang uses feature, gcc defines __SANITIZE_ADDRESS__
468 unconditionally check both in case other compilers mirror
469 either of those options
470 */
471#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
472# define QT_ASAN_ENABLED
473#endif
474
475/*
476 * C++11 support
477 *
478 * Paper Macro SD-6 macro
479 * N2341 Q_COMPILER_ALIGNAS
480 * N2341 Q_COMPILER_ALIGNOF
481 * N2427 Q_COMPILER_ATOMICS
482 * N2761 Q_COMPILER_ATTRIBUTES __cpp_attributes = 200809
483 * N2541 Q_COMPILER_AUTO_FUNCTION
484 * N1984 N2546 Q_COMPILER_AUTO_TYPE
485 * N2437 Q_COMPILER_CLASS_ENUM
486 * N2235 Q_COMPILER_CONSTEXPR __cpp_constexpr = 200704
487 * N2343 N3276 Q_COMPILER_DECLTYPE __cpp_decltype = 200707
488 * N2346 Q_COMPILER_DEFAULT_MEMBERS
489 * N2346 Q_COMPILER_DELETE_MEMBERS
490 * N1986 Q_COMPILER_DELEGATING_CONSTRUCTORS
491 * N2437 Q_COMPILER_EXPLICIT_CONVERSIONS
492 * N3206 N3272 Q_COMPILER_EXPLICIT_OVERRIDES
493 * N1987 Q_COMPILER_EXTERN_TEMPLATES
494 * N2540 Q_COMPILER_INHERITING_CONSTRUCTORS
495 * N2672 Q_COMPILER_INITIALIZER_LISTS
496 * N2658 N2927 Q_COMPILER_LAMBDA __cpp_lambdas = 200907
497 * N2756 Q_COMPILER_NONSTATIC_MEMBER_INIT
498 * N2855 N3050 Q_COMPILER_NOEXCEPT
499 * N2431 Q_COMPILER_NULLPTR
500 * N2930 Q_COMPILER_RANGE_FOR
501 * N2442 Q_COMPILER_RAW_STRINGS __cpp_raw_strings = 200710
502 * N2439 Q_COMPILER_REF_QUALIFIERS
503 * N2118 N2844 N3053 Q_COMPILER_RVALUE_REFS __cpp_rvalue_references = 200610
504 * N1720 Q_COMPILER_STATIC_ASSERT __cpp_static_assert = 200410
505 * N2258 Q_COMPILER_TEMPLATE_ALIAS
506 * N2659 Q_COMPILER_THREAD_LOCAL
507 * N2660 Q_COMPILER_THREADSAFE_STATICS
508 * N2765 Q_COMPILER_UDL __cpp_user_defined_literals = 200809
509 * N2442 Q_COMPILER_UNICODE_STRINGS __cpp_unicode_literals = 200710
510 * N2640 Q_COMPILER_UNIFORM_INIT
511 * N2544 Q_COMPILER_UNRESTRICTED_UNIONS
512 * N1653 Q_COMPILER_VARIADIC_MACROS
513 * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES __cpp_variadic_templates = 200704
514 *
515 *
516 * For the C++ standards C++14 and C++17, we use only the SD-6 macro.
517 *
518 * For any future version of the C++ standard, we use only the C++20 feature test macro.
519 * For library features, we assume <version> is present (this header includes it).
520 *
521 * For a full listing of feature test macros, see
522 * https://en.cppreference.com/w/cpp/feature_test
523 * Exceptions:
524 * Q_DECL_CONSTEXPR_DTOR constexpr in C++20 for explicit destructors __cpp_constexpr >= 201907L
525 * Q_CONSTEXPR_DTOR constexpr in C++20 for variables __cpp_constexpr >= 201907L otherwise const
526 * Q_DECL_EQ_DELETE_X(message) = delete("reason"), __cpp_deleted_function >= 202403L
527 *
528 * C++ extensions:
529 * Q_COMPILER_RESTRICTED_VLA variable-length arrays, prior to __cpp_runtime_arrays
530 */
531
532/*
533 * Now that we require C++17, we unconditionally expect threadsafe statics mandated since C++11
534 */
535#define Q_COMPILER_THREADSAFE_STATICS
536
537#if defined(Q_CC_CLANG)
538/* General C++ features */
539# define Q_COMPILER_RESTRICTED_VLA
540# if __has_feature(attribute_deprecated_with_message)
541# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
542# endif
543
544// Clang supports binary literals in C, C++98 and C++11 modes
545// It's been supported "since the dawn of time itself" (cf. commit 179883)
546# if __has_extension(cxx_binary_literals)
547# define Q_COMPILER_BINARY_LITERALS
548# endif
549
550// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
551# if Q_CC_CLANG >= 209
552# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
553 || (defined(__cplusplus) && (__cplusplus >= 201103L))
554 || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
555# define Q_COMPILER_VARIADIC_MACROS
556# endif
557# endif
558
559/* C++11 features, see http://clang.llvm.org/cxx_status.html */
560# if (defined(__cplusplus) && __cplusplus >= 201103L)
561 || defined(__GXX_EXPERIMENTAL_CXX0X__)
562 /* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */
563# if __has_feature(cxx_alignas)
564# define Q_COMPILER_ALIGNAS
565# define Q_COMPILER_ALIGNOF
566# endif
567# if __has_feature(cxx_atomic) && __has_include(<atomic>)
568# define Q_COMPILER_ATOMICS
569# endif
570# if __has_feature(cxx_attributes)
571# define Q_COMPILER_ATTRIBUTES
572# endif
573# if __has_feature(cxx_auto_type)
574# define Q_COMPILER_AUTO_FUNCTION
575# define Q_COMPILER_AUTO_TYPE
576# endif
577# if __has_feature(cxx_strong_enums)
578# define Q_COMPILER_CLASS_ENUM
579# endif
580# if __has_feature(cxx_constexpr) && Q_CC_CLANG > 302 /* CLANG 3.2 has bad/partial support */
581# define Q_COMPILER_CONSTEXPR
582# endif
583# if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */
584# define Q_COMPILER_DECLTYPE
585# endif
586# if __has_feature(cxx_defaulted_functions)
587# define Q_COMPILER_DEFAULT_MEMBERS
588# endif
589# if __has_feature(cxx_deleted_functions)
590# define Q_COMPILER_DELETE_MEMBERS
591# endif
592# if __has_feature(cxx_delegating_constructors)
593# define Q_COMPILER_DELEGATING_CONSTRUCTORS
594# endif
595# if __has_feature(cxx_explicit_conversions)
596# define Q_COMPILER_EXPLICIT_CONVERSIONS
597# endif
598# if __has_feature(cxx_override_control)
599# define Q_COMPILER_EXPLICIT_OVERRIDES
600# endif
601# if __has_feature(cxx_inheriting_constructors)
602# define Q_COMPILER_INHERITING_CONSTRUCTORS
603# endif
604# if __has_feature(cxx_generalized_initializers)
605# define Q_COMPILER_INITIALIZER_LISTS
606# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */
607# endif
608# if __has_feature(cxx_lambdas)
609# define Q_COMPILER_LAMBDA
610# endif
611# if __has_feature(cxx_noexcept)
612# define Q_COMPILER_NOEXCEPT
613# endif
614# if __has_feature(cxx_nonstatic_member_init)
615# define Q_COMPILER_NONSTATIC_MEMBER_INIT
616# endif
617# if __has_feature(cxx_nullptr)
618# define Q_COMPILER_NULLPTR
619# endif
620# if __has_feature(cxx_range_for)
621# define Q_COMPILER_RANGE_FOR
622# endif
623# if __has_feature(cxx_raw_string_literals)
624# define Q_COMPILER_RAW_STRINGS
625# endif
626# if __has_feature(cxx_reference_qualified_functions)
627# define Q_COMPILER_REF_QUALIFIERS
628# endif
629# if __has_feature(cxx_rvalue_references)
630# define Q_COMPILER_RVALUE_REFS
631# endif
632# if __has_feature(cxx_static_assert)
633# define Q_COMPILER_STATIC_ASSERT
634# endif
635# if __has_feature(cxx_alias_templates)
636# define Q_COMPILER_TEMPLATE_ALIAS
637# endif
638# if __has_feature(cxx_thread_local)
639# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */
640# define Q_COMPILER_THREAD_LOCAL
641# endif
642# endif
643# if __has_feature(cxx_user_literals)
644# define Q_COMPILER_UDL
645# endif
646# if __has_feature(cxx_unicode_literals)
647# define Q_COMPILER_UNICODE_STRINGS
648# endif
649# if __has_feature(cxx_unrestricted_unions)
650# define Q_COMPILER_UNRESTRICTED_UNIONS
651# endif
652# if __has_feature(cxx_variadic_templates)
653# define Q_COMPILER_VARIADIC_TEMPLATES
654# endif
655 /* Features that have no __has_feature() check */
656# if Q_CC_CLANG >= 209 /* since clang 2.9 */
657# define Q_COMPILER_EXTERN_TEMPLATES
658# endif
659# endif // (defined(__cplusplus) && __cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__)
660
661/* C++1y features, deprecated macros. Do not update this list. */
662# if defined(__cplusplus) && __cplusplus > 201103L
663//# if __has_feature(cxx_binary_literals)
664//# define Q_COMPILER_BINARY_LITERALS // see above
665//# endif
666# if __has_feature(cxx_generic_lambda)
667# define Q_COMPILER_GENERIC_LAMBDA
668# endif
669# if __has_feature(cxx_init_capture)
670# define Q_COMPILER_LAMBDA_CAPTURES
671# endif
672# if __has_feature(cxx_relaxed_constexpr)
673# define Q_COMPILER_RELAXED_CONSTEXPR_FUNCTIONS
674# endif
675# if __has_feature(cxx_decltype_auto) && __has_feature(cxx_return_type_deduction)
676# define Q_COMPILER_RETURN_TYPE_DEDUCTION
677# endif
678# if __has_feature(cxx_variable_templates)
679# define Q_COMPILER_VARIABLE_TEMPLATES
680# endif
681# if __has_feature(cxx_runtime_array)
682# define Q_COMPILER_VLA
683# endif
684# endif // if defined(__cplusplus) && __cplusplus > 201103L
685
686# if defined(__STDC_VERSION__)
687# if __has_feature(c_static_assert)
688# define Q_COMPILER_STATIC_ASSERT
689# endif
690# if __has_feature(c_thread_local) && __has_include(<threads.h>)
691# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */
692# define Q_COMPILER_THREAD_LOCAL
693# endif
694# endif
695# endif
696
697# ifndef Q_DECL_UNUSED
698# define Q_DECL_UNUSED __attribute__((__unused__))
699# endif
700# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED
701#endif // defined(Q_CC_CLANG)
702
703#if defined(Q_CC_GNU_ONLY)
704# define Q_COMPILER_RESTRICTED_VLA
705# if Q_CC_GNU >= 403
706// GCC supports binary literals in C, C++98 and C++11 modes
707# define Q_COMPILER_BINARY_LITERALS
708# endif
709# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__)
710 || (defined(__cplusplus) && (__cplusplus >= 201103L))
711 || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
712 // Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97)
713# define Q_COMPILER_VARIADIC_MACROS
714# endif
715# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
716# if Q_CC_GNU >= 403
717 /* C++11 features supported in GCC 4.3: */
718# define Q_COMPILER_DECLTYPE
719# define Q_COMPILER_RVALUE_REFS
720# define Q_COMPILER_STATIC_ASSERT
721# endif
722# if Q_CC_GNU >= 404
723 /* C++11 features supported in GCC 4.4: */
724# define Q_COMPILER_AUTO_FUNCTION
725# define Q_COMPILER_AUTO_TYPE
726# define Q_COMPILER_EXTERN_TEMPLATES
727# define Q_COMPILER_UNIFORM_INIT
728# define Q_COMPILER_UNICODE_STRINGS
729# define Q_COMPILER_VARIADIC_TEMPLATES
730# endif
731# if Q_CC_GNU >= 405
732 /* C++11 features supported in GCC 4.5: */
733# define Q_COMPILER_EXPLICIT_CONVERSIONS
734 /* GCC 4.4 implements initializer_list but does not define typedefs required
735 * by the standard. */
736# define Q_COMPILER_INITIALIZER_LISTS
737# define Q_COMPILER_LAMBDA
738# define Q_COMPILER_RAW_STRINGS
739# define Q_COMPILER_CLASS_ENUM
740# endif
741# if Q_CC_GNU >= 406
742 /* Pre-4.6 compilers implement a non-final snapshot of N2346, hence default and delete
743 * functions are supported only if they are public. Starting from 4.6, GCC handles
744 * final version - the access modifier is not relevant. */
745# define Q_COMPILER_DEFAULT_MEMBERS
746# define Q_COMPILER_DELETE_MEMBERS
747 /* C++11 features supported in GCC 4.6: */
748# define Q_COMPILER_NULLPTR
749# define Q_COMPILER_UNRESTRICTED_UNIONS
750# define Q_COMPILER_RANGE_FOR
751# endif
752# if Q_CC_GNU >= 407
753 /* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.
754 * However, the implementation is incomplete for most platforms until GCC 4.7:
755 * instead, std::atomic would use an external lock. Since we need an std::atomic
756 * that is behavior-compatible with QBasicAtomic, we only enable it here */
757# define Q_COMPILER_ATOMICS
758 /* GCC 4.6.x has problems dealing with noexcept expressions,
759 * so turn the feature on for 4.7 and above, only */
760# define Q_COMPILER_NOEXCEPT
761 /* C++11 features supported in GCC 4.7: */
762# define Q_COMPILER_NONSTATIC_MEMBER_INIT
763# define Q_COMPILER_DELEGATING_CONSTRUCTORS
764# define Q_COMPILER_EXPLICIT_OVERRIDES
765# define Q_COMPILER_TEMPLATE_ALIAS
766# define Q_COMPILER_UDL
767# endif
768# if Q_CC_GNU >= 408
769# define Q_COMPILER_ATTRIBUTES
770# define Q_COMPILER_ALIGNAS
771# define Q_COMPILER_ALIGNOF
772# define Q_COMPILER_INHERITING_CONSTRUCTORS
773# define Q_COMPILER_THREAD_LOCAL
774# if Q_CC_GNU > 408 || __GNUC_PATCHLEVEL__ >= 1
775# define Q_COMPILER_REF_QUALIFIERS
776# endif
777# endif
778# if Q_CC_GNU >= 500
779 /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole
780 * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */
781# define Q_COMPILER_CONSTEXPR
782# endif
783# endif
784# if __cplusplus > 201103L
785# if Q_CC_GNU >= 409
786 /* C++1y features in GCC 4.9 - deprecated, do not update this list */
787//# define Q_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension
788# define Q_COMPILER_LAMBDA_CAPTURES
789# define Q_COMPILER_RETURN_TYPE_DEDUCTION
790# endif
791# endif
792# if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
793# if Q_CC_GNU >= 407
794 /* C11 features supported in GCC 4.7: */
795# define Q_COMPILER_STATIC_ASSERT
796# endif
797# if Q_CC_GNU >= 409 && defined(__has_include)
798 /* C11 features supported in GCC 4.9: */
799# if __has_include(<threads.h>)
800# define Q_COMPILER_THREAD_LOCAL
801# endif
802# endif
803# endif
804#endif
805
806#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
807# if defined(__cplusplus)
808 /* C++11 features supported in VC8 = VC2005: */
809# define Q_COMPILER_VARIADIC_MACROS
810
811 /* 2005 supports the override and final contextual keywords, in
812 the same positions as the C++11 variants, but 'final' is
813 called 'sealed' instead:
814 http://msdn.microsoft.com/en-us/library/0w2w91tf%28v=vs.80%29.aspx
815 The behavior is slightly different in C++/CLI, which requires the
816 "virtual" keyword to be present too, so don't define for that.
817 So don't define Q_COMPILER_EXPLICIT_OVERRIDES (since it's not
818 the same as the C++11 version), but define the Q_DECL_* flags
819 accordingly. */
820 /* C++11 features supported in VC10 = VC2010: */
821# define Q_COMPILER_AUTO_FUNCTION
822# define Q_COMPILER_AUTO_TYPE
823# define Q_COMPILER_DECLTYPE
824# define Q_COMPILER_EXTERN_TEMPLATES
825# define Q_COMPILER_LAMBDA
826# define Q_COMPILER_NULLPTR
827# define Q_COMPILER_RVALUE_REFS
828# define Q_COMPILER_STATIC_ASSERT
829 /* C++11 features supported in VC11 = VC2012: */
830# define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */
831# define Q_COMPILER_CLASS_ENUM
832# define Q_COMPILER_ATOMICS
833 /* C++11 features in VC12 = VC2013 */
834# define Q_COMPILER_DELETE_MEMBERS
835# define Q_COMPILER_DELEGATING_CONSTRUCTORS
836# define Q_COMPILER_EXPLICIT_CONVERSIONS
837# define Q_COMPILER_NONSTATIC_MEMBER_INIT
838# define Q_COMPILER_RAW_STRINGS
839# define Q_COMPILER_TEMPLATE_ALIAS
840# define Q_COMPILER_VARIADIC_TEMPLATES
841# define Q_COMPILER_INITIALIZER_LISTS // VC 12 SP 2 RC
842 /* C++11 features in VC14 = VC2015 */
843# define Q_COMPILER_DEFAULT_MEMBERS
844# define Q_COMPILER_ALIGNAS
845# define Q_COMPILER_ALIGNOF
846# define Q_COMPILER_INHERITING_CONSTRUCTORS
847# define Q_COMPILER_NOEXCEPT
848# define Q_COMPILER_RANGE_FOR
849# define Q_COMPILER_REF_QUALIFIERS
850# define Q_COMPILER_THREAD_LOCAL
851# define Q_COMPILER_UDL
852# define Q_COMPILER_UNICODE_STRINGS
853# define Q_COMPILER_UNRESTRICTED_UNIONS
854# if _MSC_FULL_VER >= 190023419
855# define Q_COMPILER_ATTRIBUTES
856// Almost working, see https://connect.microsoft.com/VisualStudio/feedback/details/2011648
857//# define Q_COMPILER_CONSTEXPR
858# define Q_COMPILER_UNIFORM_INIT
859# endif
860# if _MSC_VER >= 1910
861# define Q_COMPILER_CONSTEXPR
862# endif
863// MSVC versions before 19.36 have a bug in C++20 comparison implementation.
864// This leads to ambiguities when resolving comparison operator overloads in
865// certain scenarios (the buggy MSVC versions were checked using our CI and
866// compiler explorer).
867# if _MSC_VER < 1936
868# define Q_COMPILER_LACKS_THREE_WAY_COMPARE_SYMMETRY
869# endif
870// QTBUG-124376: MSVC is slow at compiling qstrnlen()
871# define Q_COMPILER_SLOW_QSTRNLEN_COMPILATION
872# endif /* __cplusplus */
873#endif // defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
874
875#ifdef Q_COMPILER_UNICODE_STRINGS
876# define Q_STDLIB_UNICODE_STRINGS
877#elif defined(__cplusplus)
878# error "Qt6 requires Unicode string support in both the compiler and the standard library"
879#endif
880
881#ifdef __cplusplus
882# include <utility>
883# if defined(Q_OS_QNX)
884// By default, QNX 7.0 uses libc++ (from LLVM) and
885// QNX 6.X uses Dinkumware's libcpp. In all versions,
886// it is also possible to use GNU libstdc++.
887
888// For Dinkumware, some features must be disabled
889// (mostly because of library problems).
890// Dinkumware is assumed when __GLIBCXX__ (GNU libstdc++)
891// and _LIBCPP_VERSION (LLVM libc++) are both absent.
892# if !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION)
893
894// Older versions of libcpp (QNX 650) do not support C++11 features
895// _HAS_* macros are set to 1 by toolchains that actually include
896// Dinkum C++11 libcpp.
897
898# if !defined(_HAS_CPP0X) || !_HAS_CPP0X
899// Disable C++11 features that depend on library support
900# undef Q_COMPILER_INITIALIZER_LISTS
901# undef Q_COMPILER_RVALUE_REFS
902# undef Q_COMPILER_REF_QUALIFIERS
903# undef Q_COMPILER_NOEXCEPT
904// Disable C++11 library features:
905# undef Q_STDLIB_UNICODE_STRINGS
906# endif // !_HAS_CPP0X
907# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T
908# undef Q_COMPILER_NULLPTR
909# endif //!_HAS_NULLPTR_T
910# if !defined(_HAS_CONSTEXPR) || !_HAS_CONSTEXPR
911// The libcpp is missing constexpr keywords on important functions like std::numeric_limits<>::min()
912// Disable constexpr support on QNX even if the compiler supports it
913# undef Q_COMPILER_CONSTEXPR
914# endif // !_HAS_CONSTEXPR
915# endif // !__GLIBCXX__ && !_LIBCPP_VERSION
916# endif // Q_OS_QNX
917# if defined(Q_CC_CLANG) && defined(Q_OS_DARWIN)
918# if defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
919// Apple has not updated libstdc++ since 2007, which means it does not have
920// <initializer_list> or std::move. Let's disable these features
921# undef Q_COMPILER_INITIALIZER_LISTS
922# undef Q_COMPILER_RVALUE_REFS
923# undef Q_COMPILER_REF_QUALIFIERS
924// Also disable <atomic>, since it's clearly not there
925# undef Q_COMPILER_ATOMICS
926# endif
927# if defined(__cpp_lib_memory_resource)
928 && ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000)
929 || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 170000))
930# undef __cpp_lib_memory_resource // Only supported on macOS 14 and iOS 17
931# endif
932# endif // defined(Q_CC_CLANG) && defined(Q_OS_DARWIN)
933#endif
934
935// Don't break code that is already using Q_COMPILER_DEFAULT_DELETE_MEMBERS
936#if defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
937# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
938#endif
939
940/*
941 * Compatibility macros for C++11/14 keywords and expressions.
942 * Don't use in new code and port away whenever you have a chance.
943 */
944#define Q_ALIGNOF(x) alignof(x)
945#define Q_DECL_ALIGN(n) alignas(n)
946#define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
947#ifdef __cplusplus
948# define Q_CONSTEXPR constexpr
949# define Q_DECL_CONSTEXPR constexpr
950# define Q_DECL_EQ_DEFAULT = default
951# define Q_DECL_EQ_DELETE = delete
952# define Q_DECL_FINAL final
953# define Q_DECL_NOEXCEPT noexcept
954# define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x)
955# define Q_DECL_OVERRIDE override
956# define Q_DECL_RELAXED_CONSTEXPR constexpr
957# define Q_NULLPTR nullptr
958# define Q_RELAXED_CONSTEXPR constexpr
959#else
960# define Q_CONSTEXPR const
961# define Q_DECL_CONSTEXPR
962# define Q_DECL_RELAXED_CONSTEXPR
963# define Q_NULLPTR NULL
964# define Q_RELAXED_CONSTEXPR const
965# ifdef Q_CC_GNU
966# define Q_DECL_NOEXCEPT __attribute__((__nothrow__))
967# else
968# define Q_DECL_NOEXCEPT
969# endif
970#endif
971
972#if (defined(__cplusplus) && __has_cpp_attribute(nodiscard) /* P0188R1 */) ||
973 (!defined(__cplusplus) && __has_c_attribute(nodiscard) /* N2267 */)
974# undef Q_REQUIRED_RESULT
975# define Q_REQUIRED_RESULT [[nodiscard]]
976#endif
977
978#if (defined(__cplusplus) && __has_cpp_attribute(nodiscard) >= 201907L /* used for both P1771 and P1301... */)
979 || (!defined(__cplusplus) && __has_c_attribute(nodiscard) /* N2448 */)
980// [[nodiscard]] constructor (P1771)
981# ifndef Q_NODISCARD_CTOR
982# define Q_NODISCARD_CTOR [[nodiscard]]
983# endif
984// [[nodiscard("reason")]] (P1301, N2448 for C)
985# ifndef Q_NODISCARD_X
986# define Q_NODISCARD_X(message) [[nodiscard(message)]]
987# endif
988# ifndef Q_NODISCARD_CTOR_X
989# define Q_NODISCARD_CTOR_X(message) [[nodiscard(message)]]
990# endif
991#endif
992
993#if (defined(__cplusplus) && __has_cpp_attribute(maybe_unused)) ||
994 (!defined(__cplusplus) && __has_c_attribute(maybe_unused))
995# undef Q_DECL_UNUSED
996# define Q_DECL_UNUSED [[maybe_unused]]
997#endif
998
999#if (defined(__cplusplus) && __has_cpp_attribute(noreturn)) ||
1000 (!defined(__cplusplus) && __has_c_attribute(noreturn))
1001# undef Q_NORETURN
1002# define Q_NORETURN [[noreturn]]
1003#endif
1004
1005#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU < 1300
1006// Leave Q_DECL_DEPRECATED defined with __attribute__ because
1007// GCC 12 and earlier has issues combining __attribute__ and [[]] syntax.
1008// We phrase the deprecation macros as __attribute__ so that they can be combined with visibility.
1009#elif (defined(__cplusplus) && __has_cpp_attribute(deprecated)) ||
1010 (!defined(__cplusplus) && __has_c_attribute(deprecated))
1011# ifdef Q_DECL_DEPRECATED
1012# undef Q_DECL_DEPRECATED
1013# endif
1014# ifdef Q_DECL_DEPRECATED_X
1015# undef Q_DECL_DEPRECATED_X
1016# endif
1017# define Q_DECL_DEPRECATED [[deprecated]]
1018# define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]]
1019#endif
1020
1021#define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED
1022#define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x)
1023
1024#ifdef Q_CC_CLANG /* preferred, since Clang's supports `text` and MSVC's doesn't */
1025# define Q_DECL_DEPRECATED_MACRO(macro, text) QT_DO_PRAGMA(clang deprecated(macro, text))
1026#elif defined(Q_CC_MSVC)
1027# define Q_DECL_DEPRECATED_MACRO(macro, text) __pragma(deprecated(#macro))
1028#endif
1029
1030#ifndef Q_DECL_CONSTEXPR_DTOR
1031# if __cpp_constexpr >= 201907L
1032# define Q_DECL_CONSTEXPR_DTOR constexpr
1033# else
1034# define Q_DECL_CONSTEXPR_DTOR inline
1035# endif
1036#endif
1037
1038#ifndef Q_CONSTEXPR_DTOR
1039# if __cpp_constexpr >= 201907L
1040# define Q_CONSTEXPR_DTOR constexpr
1041# else
1042# define Q_CONSTEXPR_DTOR const
1043# endif
1044#endif
1045
1046#ifndef Q_DECL_EQ_DELETE_X
1047// Clang < 20 advertises the feature-testing macro but issues a warning
1048// if one isn't also using C++26,
1049// https://github.com/llvm/llvm-project/issues/109311
1050# if defined(__cpp_deleted_function) && __cpp_deleted_function >= 202403L
1051 && (!defined(Q_CC_CLANG_ONLY) || Q_CC_CLANG_ONLY >= 2010 || __cplusplus > 202302L) // C++26
1052# define Q_DECL_EQ_DELETE_X(reason) = delete(reason)
1053# else
1054# define Q_DECL_EQ_DELETE_X(reason) = delete
1055# endif
1056#endif
1057
1058#ifndef Q_LIKELY_BRANCH
1059# if __has_cpp_attribute(likely)
1060# define Q_LIKELY_BRANCH [[likely]]
1061# define Q_UNLIKELY_BRANCH [[unlikely]]
1062# else
1063# define Q_LIKELY_BRANCH
1064# define Q_UNLIKELY_BRANCH
1065# endif
1066#endif
1067
1068#ifndef Q_DECL_NONBLOCKING_FUNCTION
1069# if defined(__cplusplus)
1070# if __has_cpp_attribute(clang::nonblocking)
1071# define Q_DECL_NONBLOCKING_FUNCTION [[clang::nonblocking]]
1072# else
1073# define Q_DECL_NONBLOCKING_FUNCTION
1074# endif
1075# else
1076# define Q_DECL_NONBLOCKING_FUNCTION
1077# endif
1078#endif
1079
1080#ifndef Q_DECL_NONALLOCATING_FUNCTION
1081# if defined(__cplusplus)
1082# if __has_cpp_attribute(clang::nonallocating)
1083# define Q_DECL_NONALLOCATING_FUNCTION [[clang::nonallocating]]
1084# else
1085# define Q_DECL_NONALLOCATING_FUNCTION
1086# endif
1087# else
1088# define Q_DECL_NONALLOCATING_FUNCTION
1089# endif
1090#endif
1091
1092/*
1093 * Fallback macros to certain compiler features
1094 */
1095
1096#ifndef Q_NORETURN
1097# define Q_NORETURN
1098#endif
1099#ifndef Q_LIKELY
1100# define Q_LIKELY(x) (x)
1101#endif
1102#ifndef Q_UNLIKELY
1103# define Q_UNLIKELY(x) (x)
1104#endif
1105#ifndef Q_ASSUME_IMPL
1106# define Q_ASSUME_IMPL(expr) qt_noop()
1107#endif
1108#ifndef Q_UNREACHABLE_IMPL
1109# define Q_UNREACHABLE_IMPL() qt_noop()
1110#endif
1111#ifndef Q_ALLOC_SIZE
1112# define Q_ALLOC_SIZE(x)
1113#endif
1114#ifndef Q_REQUIRED_RESULT
1115# define Q_REQUIRED_RESULT
1116#endif
1117#ifndef Q_NODISCARD_X
1118# define Q_NODISCARD_X(message) Q_REQUIRED_RESULT
1119#endif
1120#ifndef Q_NODISCARD_CTOR
1121# define Q_NODISCARD_CTOR
1122#endif
1123#ifndef Q_NODISCARD_CTOR_X
1124# define Q_NODISCARD_CTOR_X(message) Q_NODISCARD_CTOR
1125#endif
1126#ifndef Q_DECL_DEPRECATED
1127# define Q_DECL_DEPRECATED
1128#endif
1129#ifndef Q_DECL_VARIABLE_DEPRECATED
1130# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
1131#endif
1132#ifndef Q_DECL_DEPRECATED_X
1133# define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED
1134#endif
1136# define Q_DECL_DEPRECATED_MACRO(macro, text)
1137#endif
1138#ifndef Q_DECL_EXPORT
1139# define Q_DECL_EXPORT
1140#endif
1142# define Q_DECL_EXPORT_OVERRIDABLE Q_DECL_EXPORT
1143#endif
1144#ifndef Q_DECL_IMPORT
1145# define Q_DECL_IMPORT
1146#endif
1147#ifndef Q_DECL_HIDDEN
1148# define Q_DECL_HIDDEN
1149#endif
1150#ifndef Q_DECL_UNUSED
1151# define Q_DECL_UNUSED
1152#endif
1154# define Q_DECL_UNUSED_MEMBER
1155#endif
1156#ifndef Q_FUNC_INFO
1157# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)
1158# define Q_FUNC_INFO __FILE__ "(line number unavailable)"
1159# else
1160# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__)
1161# endif
1162#endif
1163#ifndef Q_DECL_CF_RETURNS_RETAINED
1164# define Q_DECL_CF_RETURNS_RETAINED
1165#endif
1166#ifndef Q_DECL_NS_RETURNS_AUTORELEASED
1167# define Q_DECL_NS_RETURNS_AUTORELEASED
1168#endif
1170# define Q_DECL_PURE_FUNCTION
1171#endif
1173# define Q_DECL_CONST_FUNCTION Q_DECL_PURE_FUNCTION
1174#endif
1176# define Q_DECL_COLD_FUNCTION
1177#endif
1178#ifndef QT_MAKE_UNCHECKED_ARRAY_ITERATOR
1179# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) (x)
1180#endif
1181#ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR
1182# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x)
1183#endif
1184
1185/*
1186 * "Weak overloads" - makes an otherwise confliciting overload weaker
1187 * (by making it a template)
1188 */
1189#ifndef Q_QDOC
1190# define Q_WEAK_OVERLOAD template <typename = void>
1191#else
1192# define Q_WEAK_OVERLOAD
1193#endif
1194
1195/*
1196 * If one wants to add functions that use post-C++17 APIs, one needs to:
1197 *
1198 * 1) make them fully inline; and
1199 * 2) guard them using the necessary feature-testing macros.
1200 *
1201 * This decouples the C++ version used to build Qt with the one used by
1202 * end-user applications; Qt and the application can either choose any C++
1203 * version.
1204 *
1205 * A problem arises on MSVC for member functions of exported classes. Client
1206 * code that tries to use such a function will see it as exported, and simply
1207 * try to consume the function's *symbol*. However, if Qt has been built in
1208 * C++17, it won't have such a symbol, and linking will fail.
1209 *
1210 * The workaround: declare such functions as function templates.
1211 * (Obviously a function template does not need this marker.)
1212*/
1213#ifndef Q_QDOC
1214# define QT_POST_CXX17_API_IN_EXPORTED_CLASS template <typename = void>
1215#else
1216# define QT_POST_CXX17_API_IN_EXPORTED_CLASS
1217#endif
1218
1219/*
1220 * Warning/diagnostic handling
1221 */
1222
1223#define QT_DO_PRAGMA(text) _Pragma(#text)
1224#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
1225# undef QT_DO_PRAGMA /* not needed */
1226# define QT_WARNING_PUSH __pragma(warning(push))
1227# define QT_WARNING_POP __pragma(warning(pop))
1228# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number))
1229# define QT_WARNING_DISABLE_INTEL(number)
1230# define QT_WARNING_DISABLE_CLANG(text)
1231# define QT_WARNING_DISABLE_GCC(text)
1232# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_MSVC(4996)
1233 QT_WARNING_DISABLE_MSVC(4995)
1234# define QT_WARNING_DISABLE_FLOAT_COMPARE
1235# define QT_WARNING_DISABLE_INVALID_OFFSETOF
1236#elif defined(Q_CC_CLANG)
1237# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
1238# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
1239# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
1240# define QT_WARNING_DISABLE_GCC(text)
1241# define QT_WARNING_DISABLE_INTEL(number)
1242# define QT_WARNING_DISABLE_MSVC(number)
1243# if defined(__has_warning) && __has_warning("-Wdeprecated-pragma")
1244# define QT_WARNING_DISABLE_DEPRECATED_MACRO QT_WARNING_DISABLE_CLANG("-Wdeprecated-pragma")
1245# else
1246# define QT_WARNING_DISABLE_DEPRECATED_MACRO
1247# endif
1248# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
1249 QT_WARNING_DISABLE_DEPRECATED_MACRO
1250# define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
1251# define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_CLANG("-Winvalid-offsetof")
1252#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
1253# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
1254# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
1255# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
1256# define QT_WARNING_DISABLE_CLANG(text)
1257# define QT_WARNING_DISABLE_INTEL(number)
1258# define QT_WARNING_DISABLE_MSVC(number)
1259# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
1260# define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_GCC("-Wfloat-equal")
1261# define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_GCC("-Winvalid-offsetof")
1262#else // All other compilers, GCC < 4.6 and MSVC < 2008
1263# define QT_WARNING_DISABLE_GCC(text)
1264# define QT_WARNING_PUSH
1265# define QT_WARNING_POP
1266# define QT_WARNING_DISABLE_INTEL(number)
1267# define QT_WARNING_DISABLE_MSVC(number)
1268# define QT_WARNING_DISABLE_CLANG(text)
1269# define QT_WARNING_DISABLE_GCC(text)
1270# define QT_WARNING_DISABLE_DEPRECATED
1271# define QT_WARNING_DISABLE_FLOAT_COMPARE
1272# define QT_WARNING_DISABLE_INVALID_OFFSETOF
1273#endif
1274/* GCC and (older) Clang differ in the name of frame-larger-than: */
1275#define QT_WARNING_DISABLE_LARGE_STACK_FRAME
1276 QT_WARNING_DISABLE_CLANG("-Wframe-larger-than")
1277 QT_WARNING_DISABLE_GCC("-Wframe-larger-than=")
1278 /* end */
1279
1280#ifndef QT_IGNORE_DEPRECATIONS
1281#define QT_IGNORE_DEPRECATIONS(statement)
1284 statement
1286#endif
1287
1288// The body must be a statement:
1289#define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP
1290
1291// This macro can be used to calculate member offsets for types with a non standard layout.
1292// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
1293// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()
1294// call in a macro that disables the compiler warning.
1295#define Q_OFFSETOF(Class, member)
1296 []() -> size_t {
1298 return offsetof(Class, member);
1300 }()
1301
1302/*
1303 Proper for-scoping in MIPSpro CC
1304*/
1305#ifndef QT_NO_KEYWORDS
1306# if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64))
1307# define for if (0) {} else for
1308# endif
1309#endif
1310
1311#ifdef Q_COMPILER_RVALUE_REFS
1312#define qMove(x) std::move(x)
1313#else
1314#define qMove(x) (x)
1315#endif
1316
1317#if defined(__cplusplus)
1318#if __has_cpp_attribute(clang::fallthrough)
1319# define Q_FALLTHROUGH() [[clang::fallthrough]]
1320#elif __has_cpp_attribute(gnu::fallthrough)
1321# define Q_FALLTHROUGH() [[gnu::fallthrough]]
1322#elif __has_cpp_attribute(fallthrough)
1323# define Q_FALLTHROUGH() [[fallthrough]]
1324#endif
1325#else // !defined(__cplusplus)
1326# if __has_c_attribute(fallthrough)
1327# define Q_FALLTHROUGH() [[fallthrough]]
1328# endif
1329#endif // !defined(__cplusplus)
1330#ifndef Q_FALLTHROUGH
1331# ifdef Q_CC_GNU
1332# define Q_FALLTHROUGH() __attribute__((fallthrough))
1333# else
1334# define Q_FALLTHROUGH() (void)0
1335# endif
1336#endif
1337
1338#if defined(__has_attribute) && __has_attribute(uninitialized)
1339# define Q_DECL_UNINITIALIZED __attribute__((uninitialized))
1340#else
1341# define Q_DECL_UNINITIALIZED
1342#endif
1343
1344
1345/*
1346 Sanitize compiler feature availability
1347*/
1348#if !defined(Q_PROCESSOR_X86)
1349# undef QT_COMPILER_SUPPORTS_SSE2
1350# undef QT_COMPILER_SUPPORTS_SSE3
1351# undef QT_COMPILER_SUPPORTS_SSSE3
1352# undef QT_COMPILER_SUPPORTS_SSE4_1
1353# undef QT_COMPILER_SUPPORTS_SSE4_2
1354# undef QT_COMPILER_SUPPORTS_AVX
1355# undef QT_COMPILER_SUPPORTS_AVX2
1356# undef QT_COMPILER_SUPPORTS_F16C
1357#endif
1358#if !defined(Q_PROCESSOR_ARM)
1359# undef QT_COMPILER_SUPPORTS_NEON
1360#endif
1361#if !defined(Q_PROCESSOR_MIPS)
1362# undef QT_COMPILER_SUPPORTS_MIPS_DSP
1363# undef QT_COMPILER_SUPPORTS_MIPS_DSPR2
1364#endif
1365
1366// Compiler version check
1367#if defined(__cplusplus) && (__cplusplus < 201703L)
1368# ifdef Q_CC_MSVC
1369# error "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler."
1370# else
1371# error "Qt requires a C++17 compiler"
1372# endif
1373#endif // __cplusplus
1374
1375#if defined(__cplusplus) && defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
1376# if Q_CC_MSVC < 1930
1377# error "Qt requires at least Visual Studio 2022 (MSVC version 19.30 or newer). Please upgrade."
1378# endif
1379
1380// On MSVC we require /permissive- set by user code. Check that we are
1381// under its rules -- for instance, check that std::nullptr_t->bool is
1382// not an implicit conversion, as per
1383// https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-160#nullptr_t-is-only-convertible-to-bool-as-a-direct-initialization
1384static_assert(!std::is_convertible_v<std::nullptr_t, bool>,
1385 "On MSVC you must pass the /permissive- option to the compiler.");
1386#endif
1387
1388#if defined(QT_BOOTSTRAPPED) || defined(QT_USE_PROTECTED_VISIBILITY) || !defined(__ELF__) || defined(__PIC__)
1389// this is fine
1390#elif defined(__PIE__)
1391# error "-fPIE is not sufficient if Qt was configured with the -DFEATURE_reduce_relocations=ON "
1392 "CMake option. Compile your code with -fPIC and without -fPIE or compile Qt with "
1393 "-DFEATURE_no_direct_extern_access=ON."
1394#elif defined(QT_REDUCE_RELOCATIONS)
1395# error "You must build your code with position independent code if Qt was configured with the "
1396 "-DFEATURE_reduce_relocations=ON CMake option. Compile your code with -fPIC and "
1397 "without -fPIE or compile Qt with -DFEATURE_no_direct_extern_access=ON."
1398#endif
1399
1400#ifdef Q_PROCESSOR_X86_32
1401# if defined(Q_CC_GNU)
1402# define QT_FASTCALL __attribute__((regparm(3)))
1403# elif defined(Q_CC_MSVC)
1404# define QT_FASTCALL __fastcall
1405# else
1406# define QT_FASTCALL
1407# endif
1408#else
1409# define QT_FASTCALL
1410#endif
1411
1412// enable gcc warnings for printf-style functions
1413#if defined(Q_CC_GNU) && !defined(__INSURE__)
1414# if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
1415# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
1416 __attribute__((format(gnu_printf, (A), (B))))
1417# else
1418# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
1419 __attribute__((format(printf, (A), (B))))
1420# endif
1421#else
1422# define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
1423#endif
1424
1425#ifdef Q_CC_MSVC
1426# define Q_NEVER_INLINE __declspec(noinline)
1427# define Q_ALWAYS_INLINE __forceinline
1428#elif defined(Q_CC_GNU)
1429# define Q_NEVER_INLINE __attribute__((noinline))
1430# define Q_ALWAYS_INLINE inline __attribute__((always_inline))
1431#else
1432# define Q_NEVER_INLINE
1433# define Q_ALWAYS_INLINE inline
1434#endif
1435
1436//defines the type for the WNDPROC on windows
1437//the alignment needs to be forced for sse2 to not crash with mingw
1438#if defined(Q_OS_WIN)
1439# if defined(Q_CC_MINGW) && defined(Q_PROCESSOR_X86_32)
1440# define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer))
1441# else
1442# define QT_ENSURE_STACK_ALIGNED_FOR_SSE
1443# endif
1444# define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE
1445#endif
1446
1447#ifdef __cpp_conditional_explicit
1448#define Q_IMPLICIT explicit(false)
1449#else
1450#define Q_IMPLICIT
1451#endif
1452
1453#if defined(__cplusplus)
1454
1455#ifdef __cpp_constinit
1456# if defined(Q_CC_MSVC) && _MSC_VER < 1940 && !defined(Q_CC_CLANG)
1457 // https://developercommunity.visualstudio.com/t/C:-constinit-for-an-optional-fails-if-/1406069
1458# define Q_CONSTINIT
1459# else
1460# define Q_CONSTINIT constinit
1461# endif
1462#elif defined(__has_cpp_attribute) && __has_cpp_attribute(clang::require_constant_initialization)
1463# define Q_CONSTINIT [[clang::require_constant_initialization]]
1464#elif defined(Q_CC_GNU_ONLY) && Q_CC_GNU >= 1000
1465# define Q_CONSTINIT __constinit
1466#else
1467# define Q_CONSTINIT
1468#endif
1469
1470#ifndef Q_OUTOFLINE_TEMPLATE
1471# define Q_OUTOFLINE_TEMPLATE
1472#endif
1473#ifndef Q_INLINE_TEMPLATE
1474# define Q_INLINE_TEMPLATE inline
1475#endif
1476
1477/*
1478 Avoid some particularly useless warnings from some stupid compilers.
1479 To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
1480 the line "#define QT_NO_WARNINGS". See also QTBUG-26877.
1481*/
1482#if !defined(QT_CC_WARNINGS)
1483# define QT_NO_WARNINGS
1484#endif
1485#if defined(QT_NO_WARNINGS)
1486# if defined(Q_CC_MSVC)
1487QT_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
1488QT_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */
1489QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
1490QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */
1491QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
1492QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
1493QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */
1494QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */
1495QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */
1496QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
1497# elif defined(Q_CC_CLANG_ONLY)
1498# if __has_warning("-Wcharacter-conversion")
1499 QT_WARNING_DISABLE_CLANG("-Wcharacter-conversion") /* until https://github.com/llvm/llvm-project/issues/163719 is fixed */
1500# endif
1501# elif defined(Q_CC_BOR)
1502# pragma option -w-inl
1503# pragma option -w-aus
1504# pragma warn -inl
1505# pragma warn -pia
1506# pragma warn -ccc
1507# pragma warn -rch
1508# pragma warn -sig
1509# endif
1510#endif
1511
1512#if !defined(QT_NO_EXCEPTIONS)
1513# if !defined(Q_MOC_RUN)
1514# if defined(Q_CC_GNU) && !defined(__cpp_exceptions)
1515# define QT_NO_EXCEPTIONS
1516# endif
1517# elif defined(QT_BOOTSTRAPPED)
1518# define QT_NO_EXCEPTIONS
1519# endif
1520#endif
1521
1522// libstdc++ shipped with gcc < 11 does not have a fix for defect LWG 3346
1523#if __cplusplus >= 202002L && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 11)
1524# define QT_COMPILER_HAS_LWG3346
1525#endif
1526
1527#if defined(__cplusplus) && __cplusplus >= 202002L // P0846 doesn't have a feature macro :/
1528# if !defined(Q_CC_MSVC_ONLY) || Q_CC_MSVC >= 1939 // claims C++20 support but lacks P0846
1529 // 1939 is known to work
1530 // 1936 is known to fail
1531# define QT_COMPILER_HAS_P0846
1532# endif
1533#endif
1534
1535#ifdef QT_COMPILER_HAS_P0846
1536# define QT_ENABLE_P0846_SEMANTICS_FOR(func)
1537#else
1538 class QT_CLASS_JUST_FOR_P0846_SIMULATION;
1539# define QT_ENABLE_P0846_SEMANTICS_FOR(func)
1540 template <typename T>
1541 void func (QT_CLASS_JUST_FOR_P0846_SIMULATION *);
1542 /* end */
1543#endif // !P0846
1544
1545#endif // __cplusplus
1546
1547#endif // QCOMPILERDETECTION_H
\inmodule QtGui
Definition qimage.h:38
QSvgPaintEngine * engine
\inmodule QtSvg
bool isClippingEffective() const
QStringList savedPatternBrushes
QSvgPaintEnginePrivate(QSvgGenerator::SvgVersion version)
std::optional< QPainterPath > clipPath
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
bool end() override
Reimplement this function to finish painting on the current paint device.
void generateImage(QTextStream &stream, const QRectF &r, const QImage &pm)
void setSize(const QSize &size)
QIODevice * outputDevice() const
int resolution() const
void drawEllipse(const QRectF &r) override
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
void setDocumentTitle(const QString &title)
QString documentDescription() const
void drawPath(const QPainterPath &path) override
The default implementation ignores the path and does nothing.
void updateClipState(const QPaintEngineState &state)
QString documentTitle() const
void drawTextItem(const QPointF &pt, const QTextItem &item) override
This function draws the text item textItem at position p.
void setViewBox(const QRectF &viewBox)
void setResolution(int resolution)
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
void setDocumentDescription(const QString &description)
QRectF viewBox() const
void setOutputDevice(QIODevice *device)
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void updateState(const QPaintEngineState &state) override
Reimplement this function to update the state of a paint engine.
QPaintEngine::Type type() const override
Reimplement this function to return the paint engine \l{Type}.
void drawRects(const QRectF *rects, int rectCount) override
Draws the first rectCount rectangles in the buffer rects.
QSize size() const
Combined button and popup list for selecting options.
#define QT_WARNING_POP
#define Q_NODISCARD_CTOR
#define Q_FALLTHROUGH()
#define __has_include_next(x)
#define Q_NODISCARD_X(message)
#define Q_ASSUME_IMPL(expr)
#define Q_DECL_DEPRECATED_X(text)
#define Q_UNREACHABLE_IMPL()
#define __has_c_attribute(x)
#define Q_UNLIKELY(x)
#define Q_NORETURN
#define Q_DECL_EXPORT
#define __has_builtin(x)
#define Q_DECL_NOEXCEPT
#define __has_attribute(x)
#define Q_DECL_PURE_FUNCTION
#define Q_DECL_UNUSED
#define Q_DECL_HIDDEN
#define Q_DECL_CONST_FUNCTION
#define QT_WARNING_DISABLE_DEPRECATED
#define Q_LIKELY(x)
#define Q_DECL_DEPRECATED
#define QT_DO_PRAGMA(text)
#define Q_DECL_COLD_FUNCTION
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_DISABLE_INVALID_OFFSETOF
#define Q_FUNC_INFO
#define Q_DECL_UNUSED_MEMBER
#define QT_WARNING_PUSH
#define Q_DECL_DEPRECATED_MACRO(macro, text)
#define Q_NODISCARD_CTOR_X(message)
#define Q_REQUIRED_RESULT
#define Q_DECL_IMPORT
#define QT_WARNING_DISABLE_CLANG(text)
#define __has_include(x)
#define Q_DECL_EXPORT_OVERRIDABLE
#define __has_cpp_attribute(x)
#define __has_feature(x)
#define __has_extension(X)
Definition qnumeric_p.h:30
bool qHasPixmapTexture(const QBrush &)
Definition qbrush.cpp:207
static void translate_dashPattern(const QList< qreal > &pattern, qreal width, QString *pattern_string)
static QPaintEngine::PaintEngineFeatures svgEngineFeatures()
static QT_BEGIN_NAMESPACE void translate_color(const QColor &color, QString *color_string, QString *opacity_string)