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#ifndef Q_DECL_CONSTEXPR_DTOR
1025# if __cpp_constexpr >= 201907L
1026# define Q_DECL_CONSTEXPR_DTOR constexpr
1027# else
1028# define Q_DECL_CONSTEXPR_DTOR inline
1029# endif
1030#endif
1031
1032#ifndef Q_CONSTEXPR_DTOR
1033# if __cpp_constexpr >= 201907L
1034# define Q_CONSTEXPR_DTOR constexpr
1035# else
1036# define Q_CONSTEXPR_DTOR const
1037# endif
1038#endif
1039
1040#ifndef Q_DECL_EQ_DELETE_X
1041// Clang < 20 advertises the feature-testing macro but issues a warning
1042// if one isn't also using C++26,
1043// https://github.com/llvm/llvm-project/issues/109311
1044# if defined(__cpp_deleted_function) && __cpp_deleted_function >= 202403L
1045 && (!defined(Q_CC_CLANG_ONLY) || Q_CC_CLANG_ONLY >= 2010 || __cplusplus > 202302L) // C++26
1046# define Q_DECL_EQ_DELETE_X(reason) = delete(reason)
1047# else
1048# define Q_DECL_EQ_DELETE_X(reason) = delete
1049# endif
1050#endif
1051
1052#ifndef Q_LIKELY_BRANCH
1053# if __has_cpp_attribute(likely)
1054# define Q_LIKELY_BRANCH [[likely]]
1055# define Q_UNLIKELY_BRANCH [[unlikely]]
1056# else
1057# define Q_LIKELY_BRANCH
1058# define Q_UNLIKELY_BRANCH
1059# endif
1060#endif
1061
1062/*
1063 * Fallback macros to certain compiler features
1064 */
1065
1066#ifndef Q_NORETURN
1067# define Q_NORETURN
1068#endif
1069#ifndef Q_LIKELY
1070# define Q_LIKELY(x) (x)
1071#endif
1072#ifndef Q_UNLIKELY
1073# define Q_UNLIKELY(x) (x)
1074#endif
1075#ifndef Q_ASSUME_IMPL
1076# define Q_ASSUME_IMPL(expr) qt_noop()
1077#endif
1078#ifndef Q_UNREACHABLE_IMPL
1079# define Q_UNREACHABLE_IMPL() qt_noop()
1080#endif
1081#ifndef Q_ALLOC_SIZE
1082# define Q_ALLOC_SIZE(x)
1083#endif
1084#ifndef Q_REQUIRED_RESULT
1085# define Q_REQUIRED_RESULT
1086#endif
1087#ifndef Q_NODISCARD_X
1088# define Q_NODISCARD_X(message) Q_REQUIRED_RESULT
1089#endif
1090#ifndef Q_NODISCARD_CTOR
1091# define Q_NODISCARD_CTOR
1092#endif
1093#ifndef Q_NODISCARD_CTOR_X
1094# define Q_NODISCARD_CTOR_X(message) Q_NODISCARD_CTOR
1095#endif
1096#ifndef Q_DECL_DEPRECATED
1097# define Q_DECL_DEPRECATED
1098#endif
1099#ifndef Q_DECL_VARIABLE_DEPRECATED
1100# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
1101#endif
1102#ifndef Q_DECL_DEPRECATED_X
1103# define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED
1104#endif
1105#ifndef Q_DECL_EXPORT
1106# define Q_DECL_EXPORT
1107#endif
1109# define Q_DECL_EXPORT_OVERRIDABLE Q_DECL_EXPORT
1110#endif
1111#ifndef Q_DECL_IMPORT
1112# define Q_DECL_IMPORT
1113#endif
1114#ifndef Q_DECL_HIDDEN
1115# define Q_DECL_HIDDEN
1116#endif
1117#ifndef Q_DECL_UNUSED
1118# define Q_DECL_UNUSED
1119#endif
1121# define Q_DECL_UNUSED_MEMBER
1122#endif
1123#ifndef Q_FUNC_INFO
1124# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)
1125# define Q_FUNC_INFO __FILE__ "(line number unavailable)"
1126# else
1127# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__)
1128# endif
1129#endif
1130#ifndef Q_DECL_CF_RETURNS_RETAINED
1131# define Q_DECL_CF_RETURNS_RETAINED
1132#endif
1133#ifndef Q_DECL_NS_RETURNS_AUTORELEASED
1134# define Q_DECL_NS_RETURNS_AUTORELEASED
1135#endif
1137# define Q_DECL_PURE_FUNCTION
1138#endif
1140# define Q_DECL_CONST_FUNCTION Q_DECL_PURE_FUNCTION
1141#endif
1143# define Q_DECL_COLD_FUNCTION
1144#endif
1145#ifndef QT_MAKE_UNCHECKED_ARRAY_ITERATOR
1146# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) (x)
1147#endif
1148#ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR
1149# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x)
1150#endif
1151
1152/*
1153 * "Weak overloads" - makes an otherwise confliciting overload weaker
1154 * (by making it a template)
1155 */
1156#ifndef Q_QDOC
1157# define Q_WEAK_OVERLOAD template <typename = void>
1158#else
1159# define Q_WEAK_OVERLOAD
1160#endif
1161
1162/*
1163 * If one wants to add functions that use post-C++17 APIs, one needs to:
1164 *
1165 * 1) make them fully inline; and
1166 * 2) guard them using the necessary feature-testing macros.
1167 *
1168 * This decouples the C++ version used to build Qt with the one used by
1169 * end-user applications; Qt and the application can either choose any C++
1170 * version.
1171 *
1172 * A problem arises on MSVC for member functions of exported classes. Client
1173 * code that tries to use such a function will see it as exported, and simply
1174 * try to consume the function's *symbol*. However, if Qt has been built in
1175 * C++17, it won't have such a symbol, and linking will fail.
1176 *
1177 * The workaround: declare such functions as function templates.
1178 * (Obviously a function template does not need this marker.)
1179*/
1180#ifndef Q_QDOC
1181# define QT_POST_CXX17_API_IN_EXPORTED_CLASS template <typename = void>
1182#else
1183# define QT_POST_CXX17_API_IN_EXPORTED_CLASS
1184#endif
1185
1186/*
1187 * Warning/diagnostic handling
1188 */
1189
1190#define QT_DO_PRAGMA(text) _Pragma(#text)
1191#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
1192# undef QT_DO_PRAGMA /* not needed */
1193# define QT_WARNING_PUSH __pragma(warning(push))
1194# define QT_WARNING_POP __pragma(warning(pop))
1195# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number))
1196# define QT_WARNING_DISABLE_INTEL(number)
1197# define QT_WARNING_DISABLE_CLANG(text)
1198# define QT_WARNING_DISABLE_GCC(text)
1199# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_MSVC(4996)
1200# define QT_WARNING_DISABLE_FLOAT_COMPARE
1201# define QT_WARNING_DISABLE_INVALID_OFFSETOF
1202#elif defined(Q_CC_CLANG)
1203# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
1204# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
1205# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
1206# define QT_WARNING_DISABLE_GCC(text)
1207# define QT_WARNING_DISABLE_INTEL(number)
1208# define QT_WARNING_DISABLE_MSVC(number)
1209# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
1210# define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
1211# define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_CLANG("-Winvalid-offsetof")
1212#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
1213# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
1214# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
1215# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
1216# define QT_WARNING_DISABLE_CLANG(text)
1217# define QT_WARNING_DISABLE_INTEL(number)
1218# define QT_WARNING_DISABLE_MSVC(number)
1219# define QT_WARNING_DISABLE_DEPRECATED QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
1220# define QT_WARNING_DISABLE_FLOAT_COMPARE QT_WARNING_DISABLE_GCC("-Wfloat-equal")
1221# define QT_WARNING_DISABLE_INVALID_OFFSETOF QT_WARNING_DISABLE_GCC("-Winvalid-offsetof")
1222#else // All other compilers, GCC < 4.6 and MSVC < 2008
1223# define QT_WARNING_DISABLE_GCC(text)
1224# define QT_WARNING_PUSH
1225# define QT_WARNING_POP
1226# define QT_WARNING_DISABLE_INTEL(number)
1227# define QT_WARNING_DISABLE_MSVC(number)
1228# define QT_WARNING_DISABLE_CLANG(text)
1229# define QT_WARNING_DISABLE_GCC(text)
1230# define QT_WARNING_DISABLE_DEPRECATED
1231# define QT_WARNING_DISABLE_FLOAT_COMPARE
1232# define QT_WARNING_DISABLE_INVALID_OFFSETOF
1233#endif
1234
1235#ifndef QT_IGNORE_DEPRECATIONS
1236#define QT_IGNORE_DEPRECATIONS(statement)
1239 statement
1241#endif
1242
1243// The body must be a statement:
1244#define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP
1245
1246// This macro can be used to calculate member offsets for types with a non standard layout.
1247// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
1248// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()
1249// call in a macro that disables the compiler warning.
1250#define Q_OFFSETOF(Class, member)
1251 []() -> size_t {
1253 return offsetof(Class, member);
1255 }()
1256
1257/*
1258 Proper for-scoping in MIPSpro CC
1259*/
1260#ifndef QT_NO_KEYWORDS
1261# if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64))
1262# define for if (0) {} else for
1263# endif
1264#endif
1265
1266#ifdef Q_COMPILER_RVALUE_REFS
1267#define qMove(x) std::move(x)
1268#else
1269#define qMove(x) (x)
1270#endif
1271
1272#if defined(__cplusplus)
1273#if __has_cpp_attribute(clang::fallthrough)
1274# define Q_FALLTHROUGH() [[clang::fallthrough]]
1275#elif __has_cpp_attribute(gnu::fallthrough)
1276# define Q_FALLTHROUGH() [[gnu::fallthrough]]
1277#elif __has_cpp_attribute(fallthrough)
1278# define Q_FALLTHROUGH() [[fallthrough]]
1279#endif
1280#else // !defined(__cplusplus)
1281# if __has_c_attribute(fallthrough)
1282# define Q_FALLTHROUGH() [[fallthrough]]
1283# endif
1284#endif // !defined(__cplusplus)
1285#ifndef Q_FALLTHROUGH
1286# ifdef Q_CC_GNU
1287# define Q_FALLTHROUGH() __attribute__((fallthrough))
1288# else
1289# define Q_FALLTHROUGH() (void)0
1290# endif
1291#endif
1292
1293#if defined(__has_attribute) && __has_attribute(uninitialized)
1294# define Q_DECL_UNINITIALIZED __attribute__((uninitialized))
1295#else
1296# define Q_DECL_UNINITIALIZED
1297#endif
1298
1299
1300/*
1301 Sanitize compiler feature availability
1302*/
1303#if !defined(Q_PROCESSOR_X86)
1304# undef QT_COMPILER_SUPPORTS_SSE2
1305# undef QT_COMPILER_SUPPORTS_SSE3
1306# undef QT_COMPILER_SUPPORTS_SSSE3
1307# undef QT_COMPILER_SUPPORTS_SSE4_1
1308# undef QT_COMPILER_SUPPORTS_SSE4_2
1309# undef QT_COMPILER_SUPPORTS_AVX
1310# undef QT_COMPILER_SUPPORTS_AVX2
1311# undef QT_COMPILER_SUPPORTS_F16C
1312#endif
1313#if !defined(Q_PROCESSOR_ARM)
1314# undef QT_COMPILER_SUPPORTS_NEON
1315#endif
1316#if !defined(Q_PROCESSOR_MIPS)
1317# undef QT_COMPILER_SUPPORTS_MIPS_DSP
1318# undef QT_COMPILER_SUPPORTS_MIPS_DSPR2
1319#endif
1320
1321// Compiler version check
1322#if defined(__cplusplus) && (__cplusplus < 201703L)
1323# ifdef Q_CC_MSVC
1324# 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."
1325# else
1326# error "Qt requires a C++17 compiler"
1327# endif
1328#endif // __cplusplus
1329
1330#if defined(__cplusplus) && defined(Q_CC_MSVC) && !defined(Q_CC_CLANG)
1331# if Q_CC_MSVC < 1930
1332# error "Qt requires at least Visual Studio 2022 (MSVC version 19.30 or newer). 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 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_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:30
#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