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