-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbsdetect.h
1876 lines (1755 loc) · 63.6 KB
/
bsdetect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef BSDETECT
#define BSDETECT
// this is from Qt 5.6.3:
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2014 Intel Corporation
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*
The operating system, must be one of: (Q_OS_x)
DARWIN - Any Darwin system
MACOS - macOS
IOS - iOS
MSDOS - MS-DOS and Windows
OS2 - OS/2
OS2EMX - XFree86 on OS/2 (not PM)
WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
WINCE - WinCE (Windows CE 5.0)
WINRT - WinRT (Windows 8 Runtime)
CYGWIN - Cygwin
SOLARIS - Sun Solaris
HPUX - HP-UX
ULTRIX - DEC Ultrix
LINUX - Linux [has variants]
FREEBSD - FreeBSD [has variants]
NETBSD - NetBSD
OPENBSD - OpenBSD
BSDI - BSD/OS
INTERIX - Interix
IRIX - SGI Irix
OSF - HP Tru64 UNIX
SCO - SCO OpenServer 5
UNIXWARE - UnixWare 7, Open UNIX 8
AIX - AIX
HURD - GNU Hurd
DGUX - DG/UX
RELIANT - Reliant UNIX
DYNIX - DYNIX/ptx
QNX - QNX [has variants]
QNX6 - QNX RTP 6.1
LYNX - LynxOS
BSD4 - Any BSD 4.4 system
UNIX - Any UNIX BSD/SYSV system
ANDROID - Android platform
HAIKU - Haiku
The following operating systems have variants:
LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android
- only Q_OS_LINUX is defined if building for other Linux systems
QNX - both Q_OS_QNX and Q_OS_BLACKBERRY are defined when building for Blackberry 10
- only Q_OS_QNX is defined if building for other QNX targets
FREEBSD - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland
- Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
*/
#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
# define Q_OS_DARWIN
# define Q_OS_BSD4
# ifdef __LP64__
# define Q_OS_DARWIN64
# else
# define Q_OS_DARWIN32
# endif
#elif defined(__ANDROID__) || defined(ANDROID)
# define Q_OS_ANDROID
# define Q_OS_LINUX
#elif defined(__CYGWIN__)
# define Q_OS_CYGWIN
#elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
# define Q_OS_WIN32
# define Q_OS_WIN64
#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
# if defined(WINCE) || defined(_WIN32_WCE)
# define Q_OS_WINCE
# elif defined(WINAPI_FAMILY)
# ifndef WINAPI_FAMILY_PC_APP
# define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP
# endif
# if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
# define Q_OS_WINPHONE
# define Q_OS_WINRT
# elif WINAPI_FAMILY==WINAPI_FAMILY_PC_APP
# define Q_OS_WINRT
# else
# define Q_OS_WIN32
# endif
# else
# define Q_OS_WIN32
# endif
#elif defined(__sun) || defined(sun)
# define Q_OS_SOLARIS
#elif defined(hpux) || defined(__hpux)
# define Q_OS_HPUX
#elif defined(__ultrix) || defined(ultrix)
# define Q_OS_ULTRIX
#elif defined(sinix)
# define Q_OS_RELIANT
#elif defined(__native_client__)
# define Q_OS_NACL
#elif defined(__linux__) || defined(__linux)
# define Q_OS_LINUX
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
# ifndef __FreeBSD_kernel__
# define Q_OS_FREEBSD
# endif
# define Q_OS_FREEBSD_KERNEL
# define Q_OS_BSD4
#elif defined(__NetBSD__)
# define Q_OS_NETBSD
# define Q_OS_BSD4
#elif defined(__OpenBSD__)
# define Q_OS_OPENBSD
# define Q_OS_BSD4
#elif defined(__bsdi__)
# define Q_OS_BSDI
# define Q_OS_BSD4
#elif defined(__INTERIX)
# define Q_OS_INTERIX
# define Q_OS_BSD4
#elif defined(__sgi)
# define Q_OS_IRIX
#elif defined(__osf__)
# define Q_OS_OSF
#elif defined(_AIX)
# define Q_OS_AIX
#elif defined(__Lynx__)
# define Q_OS_LYNX
#elif defined(__GNU__)
# define Q_OS_HURD
#elif defined(__DGUX__)
# define Q_OS_DGUX
#elif defined(__QNXNTO__)
# define Q_OS_QNX
#elif defined(_SEQUENT_)
# define Q_OS_DYNIX
#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */
# define Q_OS_SCO
#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */
# define Q_OS_UNIXWARE
#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */
# define Q_OS_UNIXWARE
#elif defined(__INTEGRITY)
# define Q_OS_INTEGRITY
#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
# define Q_OS_VXWORKS
#elif defined(__HAIKU__)
# define Q_OS_HAIKU
#elif defined(__MAKEDEPEND__)
#else
# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
#endif
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
# define Q_OS_WIN
#endif
#if defined(Q_OS_DARWIN)
# define Q_OS_MAC
# if defined(Q_OS_DARWIN64)
# define Q_OS_MAC64
# elif defined(Q_OS_DARWIN32)
# define Q_OS_MAC32
# endif
# include <TargetConditionals.h>
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
# define Q_OS_IOS
# elif defined(TARGET_OS_MAC) && TARGET_OS_MAC
# define Q_OS_MACOS
# define Q_OS_OSX // compatibility synonym
# define Q_OS_MACX // compatibility synonym
# endif
#endif
#if defined(Q_OS_WIN)
# undef Q_OS_UNIX
#elif !defined(Q_OS_UNIX)
# define Q_OS_UNIX
#endif
#ifdef Q_OS_DARWIN
# include <Availability.h>
# include <AvailabilityMacros.h>
#
# ifdef Q_OS_MACOS
# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
# undef __MAC_OS_X_VERSION_MIN_REQUIRED
# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
# endif
# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
# undef MAC_OS_X_VERSION_MIN_REQUIRED
# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
# endif
# endif
#
# // Numerical checks are preferred to named checks, but to be safe
# // we define the missing version names in case Qt uses them.
#
# if !defined(__MAC_10_7)
# define __MAC_10_7 1070
# endif
# if !defined(__MAC_10_8)
# define __MAC_10_8 1080
# endif
# if !defined(__MAC_10_9)
# define __MAC_10_9 1090
# endif
# if !defined(__MAC_10_10)
# define __MAC_10_10 101000
# endif
# if !defined(__MAC_10_11)
# define __MAC_10_11 101100
# endif
# if !defined(__MAC_10_12)
# define __MAC_10_12 101200
# endif
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 1070
# endif
# if !defined(MAC_OS_X_VERSION_10_8)
# define MAC_OS_X_VERSION_10_8 1080
# endif
# if !defined(MAC_OS_X_VERSION_10_9)
# define MAC_OS_X_VERSION_10_9 1090
# endif
# if !defined(MAC_OS_X_VERSION_10_10)
# define MAC_OS_X_VERSION_10_10 101000
# endif
# if !defined(MAC_OS_X_VERSION_10_11)
# define MAC_OS_X_VERSION_10_11 101100
# endif
# if !defined(MAC_OS_X_VERSION_10_12)
# define MAC_OS_X_VERSION_10_12 101200
# endif
#
# if !defined(__IPHONE_4_3)
# define __IPHONE_4_3 40300
# endif
# if !defined(__IPHONE_5_0)
# define __IPHONE_5_0 50000
# endif
# if !defined(__IPHONE_5_1)
# define __IPHONE_5_1 50100
# endif
# if !defined(__IPHONE_6_0)
# define __IPHONE_6_0 60000
# endif
# if !defined(__IPHONE_6_1)
# define __IPHONE_6_1 60100
# endif
# if !defined(__IPHONE_7_0)
# define __IPHONE_7_0 70000
# endif
# if !defined(__IPHONE_7_1)
# define __IPHONE_7_1 70100
# endif
# if !defined(__IPHONE_8_0)
# define __IPHONE_8_0 80000
# endif
# if !defined(__IPHONE_8_1)
# define __IPHONE_8_1 80100
# endif
# if !defined(__IPHONE_8_2)
# define __IPHONE_8_2 80200
# endif
# if !defined(__IPHONE_8_3)
# define __IPHONE_8_3 80300
# endif
# if !defined(__IPHONE_8_4)
# define __IPHONE_8_4 80400
# endif
# if !defined(__IPHONE_9_0)
# define __IPHONE_9_0 90000
# endif
# if !defined(__IPHONE_9_1)
# define __IPHONE_9_1 90100
# endif
# if !defined(__IPHONE_9_2)
# define __IPHONE_9_2 90200
# endif
# if !defined(__IPHONE_9_3)
# define __IPHONE_9_3 90300
# endif
# if !defined(__IPHONE_10_0)
# define __IPHONE_10_0 100000
# endif
#endif
/*
This file uses preprocessor #defines to set various Q_PROCESSOR_* #defines
based on the following patterns:
Q_PROCESSOR_{FAMILY}
Q_PROCESSOR_{FAMILY}_{VARIANT}
Q_PROCESSOR_{FAMILY}_{REVISION}
The first is always defined. Defines for the various revisions/variants are
optional and usually dependent on how the compiler was invoked. Variants
that are a superset of another should have a define for the superset.
In addition to the procesor family, variants, and revisions, we also set
Q_BYTE_ORDER appropriately for the target processor. For bi-endian
processors, we try to auto-detect the byte order using the __BIG_ENDIAN__,
__LITTLE_ENDIAN__, or __BYTE_ORDER__ preprocessor macros.
Note: when adding support for new processors, be sure to update
config.tests/arch/arch.cpp to ensure that configure can detect the target
and host architectures.
*/
/* Machine byte-order, reuse preprocessor provided macros when available */
#if defined(__ORDER_BIG_ENDIAN__)
# define Q_BIG_ENDIAN __ORDER_BIG_ENDIAN__
#else
# define Q_BIG_ENDIAN 4321
#endif
#if defined(__ORDER_LITTLE_ENDIAN__)
# define Q_LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
#else
# define Q_LITTLE_ENDIAN 1234
#endif
/*
Alpha family, no revisions or variants
Alpha is bi-endian, use endianness auto-detection implemented below.
*/
// #elif defined(__alpha__) || defined(_M_ALPHA)
// # define Q_PROCESSOR_ALPHA
// Q_BYTE_ORDER not defined, use endianness auto-detection
/*
ARM family, known revisions: V5, V6, V7, V8
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection implemented below.
*/
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__)
# if defined(__aarch64__)
# define Q_PROCESSOR_ARM_64
# define Q_PROCESSOR_WORDSIZE 8
# else
# define Q_PROCESSOR_ARM_32
# endif
# if defined(__ARM_ARCH) && __ARM_ARCH > 1
# define Q_PROCESSOR_ARM __ARM_ARCH
# elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1
# define Q_PROCESSOR_ARM __TARGET_ARCH_ARM
# elif defined(_M_ARM) && _M_ARM > 1
# define Q_PROCESSOR_ARM _M_ARM
# elif defined(__ARM64_ARCH_8__)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
|| defined(__ARM_ARCH_7R__) \
|| defined(__ARM_ARCH_7M__) \
|| defined(__ARM_ARCH_7S__) \
|| defined(_ARM_ARCH_7)
# define Q_PROCESSOR_ARM 7
# elif defined(__ARM_ARCH_6__) \
|| defined(__ARM_ARCH_6J__) \
|| defined(__ARM_ARCH_6T2__) \
|| defined(__ARM_ARCH_6Z__) \
|| defined(__ARM_ARCH_6K__) \
|| defined(__ARM_ARCH_6ZK__) \
|| defined(__ARM_ARCH_6M__)
# define Q_PROCESSOR_ARM 6
# elif defined(__ARM_ARCH_5TEJ__) \
|| defined(__ARM_ARCH_5TE__)
# define Q_PROCESSOR_ARM 5
# else
# define Q_PROCESSOR_ARM 0
# endif
# if Q_PROCESSOR_ARM >= 8
# define Q_PROCESSOR_ARM_V8
# endif
# if Q_PROCESSOR_ARM >= 7
# define Q_PROCESSOR_ARM_V7
# endif
# if Q_PROCESSOR_ARM >= 6
# define Q_PROCESSOR_ARM_V6
# endif
# if Q_PROCESSOR_ARM >= 5
# define Q_PROCESSOR_ARM_V5
# endif
# if defined(__ARMEL__)
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# elif defined(__ARMEB__)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
# else
// Q_BYTE_ORDER not defined, use endianness auto-detection
#endif
/*
AVR32 family, no revisions or variants
AVR32 is big-endian.
*/
// #elif defined(__avr32__)
// # define Q_PROCESSOR_AVR32
// # define Q_BYTE_ORDER Q_BIG_ENDIAN
/*
Blackfin family, no revisions or variants
Blackfin is little-endian.
*/
// #elif defined(__bfin__)
// # define Q_PROCESSOR_BLACKFIN
// # define Q_BYTE_ORDER Q_LITTLE_ENDIAN
/*
X86 family, known variants: 32- and 64-bit
X86 is little-endian.
*/
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
# define Q_PROCESSOR_X86_32
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# define Q_PROCESSOR_WORDSIZE 4
/*
* We define Q_PROCESSOR_X86 == 6 for anything above a equivalent or better
* than a Pentium Pro (the processor whose architecture was called P6) or an
* Athlon.
*
* All processors since the Pentium III and the Athlon 4 have SSE support, so
* we use that to detect. That leaves the original Athlon, Pentium Pro and
* Pentium II.
*/
# if defined(_M_IX86)
# define Q_PROCESSOR_X86 (_M_IX86/100)
# elif defined(__i686__) || defined(__athlon__) || defined(__SSE__)
# define Q_PROCESSOR_X86 6
# elif defined(__i586__) || defined(__k6__)
# define Q_PROCESSOR_X86 5
# elif defined(__i486__)
# define Q_PROCESSOR_X86 4
# else
# define Q_PROCESSOR_X86 3
# endif
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
# define Q_PROCESSOR_X86 6
# define Q_PROCESSOR_X86_64
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# define Q_PROCESSOR_WORDSIZE 8
/*
Itanium (IA-64) family, no revisions or variants
Itanium is bi-endian, use endianness auto-detection implemented below.
*/
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
# define Q_PROCESSOR_IA64
# define Q_PROCESSOR_WORDSIZE 8
// Q_BYTE_ORDER not defined, use endianness auto-detection
/*
MIPS family, known revisions: I, II, III, IV, 32, 64
MIPS is bi-endian, use endianness auto-detection implemented below.
*/
#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000)
# define Q_PROCESSOR_MIPS
# if defined(_MIPS_ARCH_MIPS1) || (defined(__mips) && __mips - 0 >= 1)
# define Q_PROCESSOR_MIPS_I
# endif
# if defined(_MIPS_ARCH_MIPS2) || (defined(__mips) && __mips - 0 >= 2)
# define Q_PROCESSOR_MIPS_II
# endif
# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32)
# define Q_PROCESSOR_MIPS_32
# endif
# if defined(_MIPS_ARCH_MIPS3) || (defined(__mips) && __mips - 0 >= 3)
# define Q_PROCESSOR_MIPS_III
# endif
# if defined(_MIPS_ARCH_MIPS4) || (defined(__mips) && __mips - 0 >= 4)
# define Q_PROCESSOR_MIPS_IV
# endif
# if defined(_MIPS_ARCH_MIPS5) || (defined(__mips) && __mips - 0 >= 5)
# define Q_PROCESSOR_MIPS_V
# endif
# if defined(_MIPS_ARCH_MIPS64) || defined(__mips64)
# define Q_PROCESSOR_MIPS_64
# define Q_PROCESSOR_WORDSIZE 8
# endif
# if defined(__MIPSEL__)
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# elif defined(__MIPSEB__)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
# else
// Q_BYTE_ORDER not defined, use endianness auto-detection
# endif
/*
Power family, known variants: 32- and 64-bit
There are many more known variants/revisions that we do not handle/detect.
See http://en.wikipedia.org/wiki/Power_Architecture
and http://en.wikipedia.org/wiki/File:PowerISA-evolution.svg
Power is bi-endian, use endianness auto-detection implemented below.
*/
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \
|| defined(_M_MPPC) || defined(_M_PPC)
# define Q_PROCESSOR_POWER
# if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
# define Q_PROCESSOR_POWER_64
# define Q_PROCESSOR_WORDSIZE 8
# else
# define Q_PROCESSOR_POWER_32
# endif
// Q_BYTE_ORDER not defined, use endianness auto-detection
/*
S390 family, known variant: S390X (64-bit)
S390 is big-endian.
*/
#elif defined(__s390__)
# define Q_PROCESSOR_S390
# if defined(__s390x__)
# define Q_PROCESSOR_S390_X
# endif
# define Q_BYTE_ORDER Q_BIG_ENDIAN
/*
SuperH family, optional revision: SH-4A
SuperH is bi-endian, use endianness auto-detection implemented below.
*/
// #elif defined(__sh__)
// # define Q_PROCESSOR_SH
// # if defined(__sh4a__)
// # define Q_PROCESSOR_SH_4A
// # endif
// Q_BYTE_ORDER not defined, use endianness auto-detection
/*
SPARC family, optional revision: V9
SPARC is big-endian only prior to V9, while V9 is bi-endian with big-endian
as the default byte order. Assume all SPARC systems are big-endian.
*/
#elif defined(__sparc__)
# define Q_PROCESSOR_SPARC
# if defined(__sparc_v9__)
# define Q_PROCESSOR_SPARC_V9
# endif
# if defined(__sparc64__)
# define Q_PROCESSOR_SPARC_64
# endif
# define Q_BYTE_ORDER Q_BIG_ENDIAN
#endif
/*
NOTE:
GCC 4.6 added __BYTE_ORDER__, __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__
and __ORDER_PDP_ENDIAN__ in SVN r165881. If you are using GCC 4.6 or newer,
this code will properly detect your target byte order; if you are not, and
the __LITTLE_ENDIAN__ or __BIG_ENDIAN__ macros are not defined, then this
code will fail to detect the target byte order.
*/
// Some processors support either endian format, try to detect which we are using.
#if !defined(Q_BYTE_ORDER)
# if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == Q_BIG_ENDIAN || __BYTE_ORDER__ == Q_LITTLE_ENDIAN)
// Reuse __BYTE_ORDER__ as-is, since our Q_*_ENDIAN #defines match the preprocessor defaults
# define Q_BYTE_ORDER __BYTE_ORDER__
# elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) \
|| defined(_WIN32_WCE) || defined(WINAPI_FAMILY) // Windows CE is always little-endian according to MSDN.
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# else
# error "Unable to determine byte order!"
# endif
#endif
/*
Size of a pointer and the machine register size. We detect a 64-bit system by:
* GCC and compatible compilers (Clang, ICC on OS X and Windows) always define
__SIZEOF_POINTER__. This catches all known cases of ILP32 builds on 64-bit
processors.
* Most other Unix compilers define __LP64__ or _LP64 on 64-bit mode
(Long and Pointer 64-bit)
* If Q_PROCESSOR_WORDSIZE was defined above, it's assumed to match the pointer
size.
Otherwise, we assume to be 32-bit and then check in qglobal.cpp that it is right.
*/
#if defined __SIZEOF_POINTER__
# define QT_POINTER_SIZE __SIZEOF_POINTER__
#elif defined(__LP64__) || defined(_LP64)
# define QT_POINTER_SIZE 8
#elif defined(Q_PROCESSOR_WORDSIZE)
# define QT_POINTER_SIZE Q_PROCESSOR_WORDSIZE
#else
# define QT_POINTER_SIZE 4
#endif
/*
Define Q_PROCESSOR_WORDSIZE to be the size of the machine's word (usually,
the size of the register). On some architectures where a pointer could be
smaller than the register, the macro is defined above.
Falls back to QT_POINTER_SIZE if not set explicitly for the platform.
*/
#ifndef Q_PROCESSOR_WORDSIZE
# define Q_PROCESSOR_WORDSIZE QT_POINTER_SIZE
#endif
/*
The compiler, must be one of: (Q_CC_x)
SYM - Digital Mars C/C++ (used to be Symantec C++)
MSVC - Microsoft Visual C/C++, Intel C++ for Windows
BOR - Borland/Turbo C++
WAT - Watcom C++
GNU - GNU C++
COMEAU - Comeau C++
EDG - Edison Design Group C++
OC - CenterLine C++
SUN - Forte Developer, or Sun Studio C++
MIPS - MIPSpro C++
DEC - DEC C++
HPACC - HP aC++
USLC - SCO OUDK and UDK
CDS - Reliant C++
KAI - KAI C++
INTEL - Intel C++ for Linux, Intel C++ for Windows
HIGHC - MetaWare High C/C++
PGI - Portland Group C++
GHS - Green Hills Optimizing C++ Compilers
RVCT - ARM Realview Compiler Suite
CLANG - C++ front-end for the LLVM compiler
Should be sorted most to least authoritative.
*/
/* Symantec C++ is now Digital Mars */
#if defined(__DMC__) || defined(__SC__)
# define Q_CC_SYM
/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */
# if defined(__SC__) && __SC__ < 0x750
# error "Compiler not supported"
# endif
#elif defined(_MSC_VER)
# define Q_CC_MSVC (_MSC_VER)
# define Q_CC_MSVC_NET
# define Q_OUTOFLINE_TEMPLATE inline
# if _MSC_VER < 1600
# define Q_NO_TEMPLATE_FRIENDS
# endif
# define Q_COMPILER_MANGLES_RETURN_TYPE
# define Q_FUNC_INFO __FUNCSIG__
# define Q_ALIGNOF(type) __alignof(type)
# define Q_DECL_ALIGN(n) __declspec(align(n))
# define Q_ASSUME_IMPL(expr) __assume(expr)
# define Q_UNREACHABLE_IMPL() __assume(0)
# define Q_NORETURN __declspec(noreturn)
# define Q_DECL_DEPRECATED __declspec(deprecated)
# define Q_DECL_DEPRECATED_X(text) __declspec(deprecated(text))
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
# if _MSC_VER >= 1800
# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) stdext::make_unchecked_array_iterator(x)
# endif
# if _MSC_VER >= 1500
# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N))
# endif
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_DECL_VARIABLE_DEPRECATED
# define Q_CC_INTEL __INTEL_COMPILER
# endif
/* only defined for MSVC since that's the only compiler that actually optimizes for this */
/* might get overridden further down when Q_COMPILER_NOEXCEPT is detected */
# ifdef __cplusplus
# define Q_DECL_NOTHROW throw()
# endif
#elif defined(__BORLANDC__) || defined(__TURBOC__)
# define Q_CC_BOR
# define Q_INLINE_TEMPLATE
# if __BORLANDC__ < 0x502
# error "Compiler not supported"
# endif
#elif defined(__WATCOMC__)
# define Q_CC_WAT
/* ARM Realview Compiler Suite
RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given),
so check for it before that */
#elif defined(__ARMCC__) || defined(__CC_ARM)
# define Q_CC_RVCT
/* work-around for missing compiler intrinsics */
# define __is_empty(X) false
# define __is_pod(X) false
# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
# ifdef Q_OS_LINUX
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
# else
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
# endif
#elif defined(__GNUC__)
# define Q_CC_GNU (__GNUC__ * 100 + __GNUC_MINOR__)
# if defined(__MINGW32__)
# define Q_CC_MINGW
# endif
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC */
# define Q_CC_INTEL (__INTEL_COMPILER)
# ifdef __clang__
/* Intel C++ masquerades as Clang masquerading as GCC */
# define Q_CC_CLANG 305
# endif
# define Q_ASSUME_IMPL(expr) __assume(expr)
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if __INTEL_COMPILER >= 1300 && !defined(__APPLE__)
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
# endif
# elif defined(__clang__)
/* Clang also masquerades as GCC */
# if defined(__apple_build_version__)
# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
# if __apple_build_version__ >= 7000053
# define Q_CC_CLANG 306
# elif __apple_build_version__ >= 6000051
# define Q_CC_CLANG 305
# elif __apple_build_version__ >= 5030038
# define Q_CC_CLANG 304
# elif __apple_build_version__ >= 5000275
# define Q_CC_CLANG 303
# elif __apple_build_version__ >= 4250024
# define Q_CC_CLANG 302
# elif __apple_build_version__ >= 3180045
# define Q_CC_CLANG 301
# elif __apple_build_version__ >= 2111001
# define Q_CC_CLANG 300
# else
# error "Unknown Apple Clang version"
# endif
# else
# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
# endif
# if __has_builtin(__builtin_assume)
# define Q_ASSUME_IMPL(expr) __builtin_assume(expr)
# else
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# endif
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# if !defined(__has_extension)
# /* Compatibility with older Clang versions */
# define __has_extension __has_feature
# endif
# if defined(__APPLE__)
/* Apple/clang specific features */
# define Q_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
# ifdef __OBJC__
# define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased))
# endif
# endif
# else
/* Plain GCC */
# if Q_CC_GNU >= 405
# define Q_ASSUME_IMPL(expr) if (expr){} else __builtin_unreachable()
# define Q_UNREACHABLE_IMPL() __builtin_unreachable()
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
# endif
# endif
# ifdef Q_OS_WIN
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
# elif defined(QT_VISIBILITY_AVAILABLE)
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_IMPORT __attribute__((visibility("default")))
# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
# endif
# define Q_FUNC_INFO __PRETTY_FUNCTION__
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# define Q_DECL_UNUSED __attribute__((__unused__))
# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# define Q_NORETURN __attribute__((__noreturn__))
# define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__))
# define Q_DECL_PURE_FUNCTION __attribute__((pure))
# define Q_DECL_CONST_FUNCTION __attribute__((const))
# if !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# ifndef __ARM_EABI__
# define QT_NO_ARM_EABI
# endif
# endif
# if Q_CC_GNU >= 403 && !defined(Q_CC_CLANG)
# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# endif
/* IBM compiler versions are a bit messy. There are actually two products:
the C product, and the C++ product. The C++ compiler is always packaged
with the latest version of the C compiler. Version numbers do not always
match. This little table (I'm not sure it's accurate) should be helpful:
C++ product C product
C Set 3.1 C Compiler 3.0
... ...
C++ Compiler 3.6.6 C Compiler 4.3
... ...
Visual Age C++ 4.0 ...
... ...
Visual Age C++ 5.0 C Compiler 5.0
... ...
Visual Age C++ 6.0 C Compiler 6.0
Now:
__xlC__ is the version of the C compiler in hexadecimal notation
is only an approximation of the C++ compiler version
__IBMCPP__ is the version of the C++ compiler in decimal notation
but it is not defined on older compilers like C Set 3.1 */
#elif defined(__xlC__)
# define Q_CC_XLC
# define Q_FULL_TEMPLATE_INSTANTIATION
# if __xlC__ < 0x400
# error "Compiler not supported"
# elif __xlC__ >= 0x0600
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# define Q_PACKED __attribute__((__packed__))
# endif
/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed
on DEC C++ V5.5-004. New versions do define __EDG__ - observed on
Compaq C++ V6.3-002.
This compiler is different enough from other EDG compilers to handle
it separately anyway. */
#elif defined(__DECCXX) || defined(__DECC)
# define Q_CC_DEC
/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older
DEC C++ V5 compilers. */
# if defined(__EDG__)
# define Q_CC_EDG
# endif
/* Compaq has disabled EDG's _BOOL macro and uses _BOOL_EXISTS instead
- observed on Compaq C++ V6.3-002.
In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
# if !defined(_BOOL_EXISTS)
# error "Compiler not supported"
# endif
/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on
DEC C++ V5.5-004. */
# if __DECCXX_VER < 60060000
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# endif
/* avoid undefined symbol problems with out-of-line template members */
# define Q_OUTOFLINE_TEMPLATE inline
/* The Portland Group C++ compiler is based on EDG and does define __EDG__
but the C compiler does not */
#elif defined(__PGI)
# define Q_CC_PGI
# if defined(__EDG__)
# define Q_CC_EDG
# endif
/* Compilers with EDG front end are similar. To detect them we test:
__EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b
__EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002
and PGI C++ 5.2-4 */
#elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__))
# define Q_CC_EDG
/* From the EDG documentation (does not seem to apply to Compaq C++):
_BOOL
Defined in C++ mode when bool is a keyword. The name of this
predefined macro is specified by a configuration flag. _BOOL
is the default.
__BOOL_DEFINED
Defined in Microsoft C++ mode when bool is a keyword. */
# if !defined(_BOOL) && !defined(__BOOL_DEFINED)
# error "Compiler not supported"
# endif
/* The Comeau compiler is based on EDG and does define __EDG__ */
# if defined(__COMO__)
# define Q_CC_COMEAU
/* The `using' keyword was introduced to avoid KAI C++ warnings
but it's now causing KAI C++ errors instead. The standard is
unclear about the use of this keyword, and in practice every
compiler is using its own set of rules. Forget it. */
# elif defined(__KCC)
# define Q_CC_KAI
/* Using the `using' keyword avoids Intel C++ for Linux warnings */
# elif defined(__INTEL_COMPILER)
# define Q_CC_INTEL (__INTEL_COMPILER)
/* Uses CFront, make sure to read the manual how to tweak templates. */
# elif defined(__ghs)
# define Q_CC_GHS
# elif defined(__DCC__)
# define Q_CC_DIAB
# if !defined(__bool)
# error "Compiler not supported"
# endif
/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */
# elif defined(__USLC__) && defined(__SCO_VERSION__)
# define Q_CC_USLC
/* The latest UDK 7.1.1b does not need this, but previous versions do */
# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010)
# define Q_OUTOFLINE_TEMPLATE inline
# endif
/* Never tested! */
# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
# define Q_CC_OC
/* CDS++ defines __EDG__ although this is not documented in the Reliant
documentation. It also follows conventions like _BOOL and this documented */
# elif defined(sinix)
# define Q_CC_CDS
/* The MIPSpro compiler defines __EDG */
# elif defined(__sgi)
# define Q_CC_MIPS
# define Q_NO_TEMPLATE_FRIENDS
# if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740)
# define Q_OUTOFLINE_TEMPLATE inline
# pragma set woff 3624,3625,3649 /* turn off some harmless warnings */
# endif
# endif
/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler
(see __DCC__ above). This one is for C mode files (__EDG is not defined) */
#elif defined(_DIAB_TOOL)
# define Q_CC_DIAB
# define Q_FUNC_INFO __PRETTY_FUNCTION__
/* Never tested! */
#elif defined(__HIGHC__)
# define Q_CC_HIGHC
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
# define Q_CC_SUN
# define Q_COMPILER_MANGLES_RETURN_TYPE
/* 5.0 compiler or better
'bool' is enabled by default but can be disabled using -features=nobool
in which case _BOOL is not defined
this is the default in 4.2 compatibility mode triggered by -compat=4 */