Move compiler detection from qglobal.h to a separate header

qcompilerdetection.h is included from qglobal.h, and does all Q_CC_*
and compiler feature detection.

Change-Id: Idd06054e172ef6fa73774e26fa38753996c4161b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Bradley T. Hughes 2012-02-04 14:20:32 +01:00 committed by Qt by Nokia
parent ba3dc5f3b5
commit 475cef58f9
3 changed files with 553 additions and 492 deletions

View File

@ -3,6 +3,7 @@
HEADERS += \
global/qglobal.h \
global/qsystemdetection.h \
global/qcompilerdetection.h \
global/qnamespace.h \
global/qendian.h \
global/qnumeric_p.h \

View File

@ -0,0 +1,551 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QCOMPILERDETECTION_H
#define QCOMPILERDETECTION_H
#if 0
// header is automatically included in qglobal.h
#pragma qt_no_master_include
// silence syncqt warnings (QT_* macros are not yet defined)
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
QT_END_HEADER
#pragma qt_sync_stop_processing
#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
# define Q_NO_EXPLICIT_KEYWORD
# endif
# define Q_NO_USING_KEYWORD
#elif defined(_MSC_VER)
# define Q_CC_MSVC
# define Q_CC_MSVC_NET
# define Q_CANNOT_DELETE_CONSTANT
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_NO_TEMPLATE_FRIENDS
# define Q_ALIGNOF(type) __alignof(type)
# define Q_DECL_ALIGN(n) __declspec(align(n))
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_CC_INTEL
# endif
/* MSVC does not support SSE/MMX on x64 */
# if (defined(Q_CC_MSVC) && defined(_M_X64))
# undef QT_HAVE_SSE
# undef QT_HAVE_MMX
# undef QT_HAVE_3DNOW
# endif
#if defined(Q_CC_MSVC) && _MSC_VER >= 1600
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_STATIC_ASSERT
// MSCV has std::initilizer_list, but do not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
# endif
#elif defined(__BORLANDC__) || defined(__TURBOC__)
# define Q_CC_BOR
# define Q_INLINE_TEMPLATE
# if __BORLANDC__ < 0x502
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# endif
# define Q_NO_USING_KEYWORD
#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
# if __TARGET_ARCH_ARM >= 6
# define QT_HAVE_ARMV6
# endif
/* work-around for missing compiler intrinsics */
# define __is_empty(X) false
# define __is_pod(X) false
#elif defined(__GNUC__)
# define Q_CC_GNU
# define Q_C_CALLBACKS
# if defined(__MINGW32__)
# define Q_CC_MINGW
# endif
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC 3.2.0 */
# define Q_CC_INTEL
# endif
# if defined(__clang__)
/* Clang also masquerades as GCC 4.2.1 */
# define Q_CC_CLANG
# endif
# ifdef __APPLE__
# define Q_NO_DEPRECATED_CONSTRUCTORS
# endif
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
# define Q_FULL_TEMPLATE_INSTANTIATION
# endif
/* GCC 2.95 knows "using" but does not support it correctly */
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
# define Q_NO_USING_KEYWORD
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# endif
/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */
# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1
# define Q_WRONG_SB_CTYPE_MACROS
# endif
/* GCC <= 3.3 cannot handle template friends */
# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
# define Q_NO_TEMPLATE_FRIENDS
# endif
/* Apple's GCC 3.1 chokes on our streaming qDebug() */
# if defined(Q_OS_DARWIN) && __GNUC__ == 3 && (__GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 3)
# define Q_BROKEN_DEBUG_STREAM
# endif
# if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# define Q_NO_PACKED_REFERENCE
# ifndef __ARM_EABI__
# define QT_NO_ARM_EABI
# endif
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__clang__) /* clang C++11 enablers are found below, don't do them here */
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++0x features supported in GCC 4.3: */
# define Q_COMPILER_VARIADIC_MACROS
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_STATIC_ASSERT
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++0x features supported in GCC 4.4: */
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_ATOMICS
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
/* C++0x features supported in GCC 4.5: */
# define Q_COMPILER_LAMBDA
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
/* C++0x features supported in GCC 4.6: */
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_UNRESTRICTED_UNIONS
# define Q_COMPILER_RANGE_FOR
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
/* C++0x features supported in GCC 4.7: */
# define Q_COMPILER_EXPLICIT_OVERRIDES
# endif
# 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
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# define Q_NO_USING_KEYWORD
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# define Q_CANNOT_DELETE_CONSTANT
# 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 have disabled EDG's _BOOL macro and use _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)
# define Q_NO_BOOL_TYPE
# endif
/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
# define Q_NO_USING_KEYWORD
/* 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
# define Q_CANNOT_DELETE_CONSTANT
# 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)
# define Q_NO_BOOL_TYPE
# endif
/* The Comeau compiler is based on EDG and does define __EDG__ */
# if defined(__COMO__)
# define Q_CC_COMEAU
# define Q_C_CALLBACKS
/* 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
# define Q_NO_USING_KEYWORD
/* Using the `using' keyword avoids Intel C++ for Linux warnings */
# elif defined(__INTEL_COMPILER)
# define Q_CC_INTEL
/* 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
# undef Q_NO_BOOL_TYPE
# if !defined(__bool)
# define Q_NO_BOOL_TYPE
# 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
# define Q_NO_USING_KEYWORD /* ### check "using" status */
/* Never tested! */
# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
# define Q_CC_OC
# define Q_NO_USING_KEYWORD
/* 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
# define Q_NO_USING_KEYWORD
/* The MIPSpro compiler defines __EDG */
# elif defined(__sgi)
# define Q_CC_MIPS
# define Q_NO_USING_KEYWORD /* ### check "using" status */
# 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
/* Never tested! */
#elif defined(__HIGHC__)
# define Q_CC_HIGHC
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
# define Q_CC_SUN
/* 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 */
# if __SUNPRO_CC >= 0x500
# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
/* see http://developers.sun.com/sunstudio/support/Ccompare.html */
# if __SUNPRO_CC >= 0x590
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# endif
# if __SUNPRO_CC >= 0x550
# define Q_DECL_EXPORT __global
# endif
# if __SUNPRO_CC < 0x5a0
# define Q_NO_TEMPLATE_FRIENDS
# endif
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
# endif
# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4)
# define Q_NO_USING_KEYWORD
# endif
# define Q_C_CALLBACKS
/* 4.2 compiler or older */
# else
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# define Q_NO_USING_KEYWORD
# endif
/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
documentation but nevertheless uses EDG conventions like _BOOL */
#elif defined(sinix)
# define Q_CC_EDG
# define Q_CC_CDS
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
# endif
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
#elif defined(Q_OS_HPUX)
/* __HP_aCC was not defined in first aCC releases */
# if defined(__HP_aCC) || __cplusplus >= 199707L
# define Q_NO_TEMPLATE_FRIENDS
# define Q_CC_HPACC
# if __HP_aCC-0 < 060000
# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
# endif
# if __HP_aCC-0 >= 061200
# define Q_DECL_ALIGN(n) __attribute__((aligned(n)))
# endif
# if __HP_aCC-0 >= 062000
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
# define Q_DECL_IMPORT Q_DECL_EXPORT
# endif
# else
# define Q_CC_HP
# define Q_NO_BOOL_TYPE
# define Q_FULL_TEMPLATE_INSTANTIATION
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# define Q_NO_EXPLICIT_KEYWORD
# endif
# define Q_NO_USING_KEYWORD /* ### check "using" status */
#else
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
#ifdef Q_CC_INTEL
# if __INTEL_COMPILER < 1200
# define Q_NO_TEMPLATE_FRIENDS
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
# if __INTEL_COMPILER >= 1200
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_STATIC_ASSERT
# endif
# endif
#endif
#ifdef Q_CC_CLANG
/* General C++ features */
# if !__has_feature(cxx_exceptions)
# define QT_NO_EXCEPTIONS
# endif
# if !__has_feature(cxx_rtti)
# define QT_NO_RTTI
# endif
/* C++11 features, see http://clang.llvm.org/cxx_status.html */
# if __cplusplus >= 201103L || __GXX_EXPERIMENTAL_CXX0X__
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
# define Q_COMPILER_VARIADIC_MACROS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 300 /* since clang 3.0 */
# define Q_COMPILER_CLASS_ENUM
/* defaulted members in 3.0, deleted members in 2.9 */
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_UNICODE_STRINGS
# endif
/* not implemented in clang yet */
# if __has_feature(cxx_constexpr)
# define Q_COMPILER_CONSTEXPR
# endif
# if __has_feature(cxx_lambdas)
# define Q_COMPILER_LAMBDA
# endif
# if __has_feature(cxx_generalized_initializers)
# define Q_COMPILER_INITIALIZER_LISTS
# endif
# if __has_feature(cxx_unrestricted_unions)
# define Q_COMPILER_UNRESTRICTED_UNIONS
# endif
# if 0
# define Q_COMPILER_ATOMICS
# endif
# endif
#endif // Q_CC_CLANG
#ifndef Q_COMPILER_MANGLES_RETURN_TYPE
# if defined(Q_CC_MSVC)
# define Q_COMPILER_MANGLES_RETURN_TYPE
# endif
#endif
#endif // QCOMPILERDETECTION_H

View File

@ -63,6 +63,7 @@
#endif
#include <QtCore/qsystemdetection.h>
#include <QtCore/qcompilerdetection.h>
#ifdef __cplusplus
@ -149,492 +150,6 @@ namespace QT_NAMESPACE {}
# define QT_LARGEFILE_SUPPORT 64
#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
# define Q_NO_EXPLICIT_KEYWORD
# endif
# define Q_NO_USING_KEYWORD
#elif defined(_MSC_VER)
# define Q_CC_MSVC
# define Q_CC_MSVC_NET
# define Q_CANNOT_DELETE_CONSTANT
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_NO_TEMPLATE_FRIENDS
# define Q_ALIGNOF(type) __alignof(type)
# define Q_DECL_ALIGN(n) __declspec(align(n))
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
# define Q_CC_INTEL
# endif
/* MSVC does not support SSE/MMX on x64 */
# if (defined(Q_CC_MSVC) && defined(_M_X64))
# undef QT_HAVE_SSE
# undef QT_HAVE_MMX
# undef QT_HAVE_3DNOW
# endif
#if defined(Q_CC_MSVC) && _MSC_VER >= 1600
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_STATIC_ASSERT
// MSCV has std::initilizer_list, but do not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
# endif
#elif defined(__BORLANDC__) || defined(__TURBOC__)
# define Q_CC_BOR
# define Q_INLINE_TEMPLATE
# if __BORLANDC__ < 0x502
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# endif
# define Q_NO_USING_KEYWORD
#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
# if __TARGET_ARCH_ARM >= 6
# define QT_HAVE_ARMV6
# endif
/* work-around for missing compiler intrinsics */
# define __is_empty(X) false
# define __is_pod(X) false
#elif defined(__GNUC__)
# define Q_CC_GNU
# define Q_C_CALLBACKS
# if defined(__MINGW32__)
# define Q_CC_MINGW
# endif
# if defined(__INTEL_COMPILER)
/* Intel C++ also masquerades as GCC 3.2.0 */
# define Q_CC_INTEL
# endif
# if defined(__clang__)
/* Clang also masquerades as GCC 4.2.1 */
# define Q_CC_CLANG
# endif
# ifdef __APPLE__
# define Q_NO_DEPRECATED_CONSTRUCTORS
# endif
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
# define Q_FULL_TEMPLATE_INSTANTIATION
# endif
/* GCC 2.95 knows "using" but does not support it correctly */
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
# define Q_NO_USING_KEYWORD
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# endif
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# endif
/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */
# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1
# define Q_WRONG_SB_CTYPE_MACROS
# endif
/* GCC <= 3.3 cannot handle template friends */
# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
# define Q_NO_TEMPLATE_FRIENDS
# endif
/* Apple's GCC 3.1 chokes on our streaming qDebug() */
# if defined(Q_OS_DARWIN) && __GNUC__ == 3 && (__GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 3)
# define Q_BROKEN_DEBUG_STREAM
# endif
# if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# define Q_NO_PACKED_REFERENCE
# ifndef __ARM_EABI__
# define QT_NO_ARM_EABI
# endif
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
# define Q_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__clang__) /* clang C++11 enablers are found below, don't do them here */
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++0x features supported in GCC 4.3: */
# define Q_COMPILER_VARIADIC_MACROS
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_STATIC_ASSERT
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++0x features supported in GCC 4.4: */
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_ATOMICS
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
/* C++0x features supported in GCC 4.5: */
# define Q_COMPILER_LAMBDA
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
/* C++0x features supported in GCC 4.6: */
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_UNRESTRICTED_UNIONS
# define Q_COMPILER_RANGE_FOR
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
/* C++0x features supported in GCC 4.7: */
# define Q_COMPILER_EXPLICIT_OVERRIDES
# endif
# 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
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# define Q_NO_USING_KEYWORD
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# define Q_CANNOT_DELETE_CONSTANT
# 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 have disabled EDG's _BOOL macro and use _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)
# define Q_NO_BOOL_TYPE
# endif
/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
# define Q_NO_USING_KEYWORD
/* 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
# define Q_CANNOT_DELETE_CONSTANT
# 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)
# define Q_NO_BOOL_TYPE
# endif
/* The Comeau compiler is based on EDG and does define __EDG__ */
# if defined(__COMO__)
# define Q_CC_COMEAU
# define Q_C_CALLBACKS
/* 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
# define Q_NO_USING_KEYWORD
/* Using the `using' keyword avoids Intel C++ for Linux warnings */
# elif defined(__INTEL_COMPILER)
# define Q_CC_INTEL
/* 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
# undef Q_NO_BOOL_TYPE
# if !defined(__bool)
# define Q_NO_BOOL_TYPE
# 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
# define Q_NO_USING_KEYWORD /* ### check "using" status */
/* Never tested! */
# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
# define Q_CC_OC
# define Q_NO_USING_KEYWORD
/* 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
# define Q_NO_USING_KEYWORD
/* The MIPSpro compiler defines __EDG */
# elif defined(__sgi)
# define Q_CC_MIPS
# define Q_NO_USING_KEYWORD /* ### check "using" status */
# 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
/* Never tested! */
#elif defined(__HIGHC__)
# define Q_CC_HIGHC
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
# define Q_CC_SUN
/* 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 */
# if __SUNPRO_CC >= 0x500
# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
/* see http://developers.sun.com/sunstudio/support/Ccompare.html */
# if __SUNPRO_CC >= 0x590
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# endif
# if __SUNPRO_CC >= 0x550
# define Q_DECL_EXPORT __global
# endif
# if __SUNPRO_CC < 0x5a0
# define Q_NO_TEMPLATE_FRIENDS
# endif
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
# endif
# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4)
# define Q_NO_USING_KEYWORD
# endif
# define Q_C_CALLBACKS
/* 4.2 compiler or older */
# else
# define Q_NO_BOOL_TYPE
# define Q_NO_EXPLICIT_KEYWORD
# define Q_NO_USING_KEYWORD
# endif
/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
documentation but nevertheless uses EDG conventions like _BOOL */
#elif defined(sinix)
# define Q_CC_EDG
# define Q_CC_CDS
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
# endif
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
#elif defined(Q_OS_HPUX)
/* __HP_aCC was not defined in first aCC releases */
# if defined(__HP_aCC) || __cplusplus >= 199707L
# define Q_NO_TEMPLATE_FRIENDS
# define Q_CC_HPACC
# if __HP_aCC-0 < 060000
# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
# define Q_DECL_EXPORT __declspec(dllexport)
# define Q_DECL_IMPORT __declspec(dllimport)
# endif
# if __HP_aCC-0 >= 061200
# define Q_DECL_ALIGN(n) __attribute__((aligned(n)))
# endif
# if __HP_aCC-0 >= 062000
# define Q_DECL_EXPORT __attribute__((visibility("default")))
# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
# define Q_DECL_IMPORT Q_DECL_EXPORT
# endif
# else
# define Q_CC_HP
# define Q_NO_BOOL_TYPE
# define Q_FULL_TEMPLATE_INSTANTIATION
# define Q_BROKEN_TEMPLATE_SPECIALIZATION
# define Q_NO_EXPLICIT_KEYWORD
# endif
# define Q_NO_USING_KEYWORD /* ### check "using" status */
#else
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
#ifdef Q_CC_INTEL
# if __INTEL_COMPILER < 1200
# define Q_NO_TEMPLATE_FRIENDS
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
# if __INTEL_COMPILER >= 1200
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_VARIADIC_TEMPLATES
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_STATIC_ASSERT
# endif
# endif
#endif
#ifdef Q_CC_CLANG
/* General C++ features */
# if !__has_feature(cxx_exceptions)
# define QT_NO_EXCEPTIONS
# endif
# if !__has_feature(cxx_rtti)
# define QT_NO_RTTI
# endif
/* C++11 features, see http://clang.llvm.org/cxx_status.html */
# if __cplusplus >= 201103L || __GXX_EXPERIMENTAL_CXX0X__
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
# define Q_COMPILER_VARIADIC_MACROS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 300 /* since clang 3.0 */
# define Q_COMPILER_CLASS_ENUM
/* defaulted members in 3.0, deleted members in 2.9 */
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
# define Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_UNICODE_STRINGS
# endif
/* not implemented in clang yet */
# if __has_feature(cxx_constexpr)
# define Q_COMPILER_CONSTEXPR
# endif
# if __has_feature(cxx_lambdas)
# define Q_COMPILER_LAMBDA
# endif
# if __has_feature(cxx_generalized_initializers)
# define Q_COMPILER_INITIALIZER_LISTS
# endif
# if __has_feature(cxx_unrestricted_unions)
# define Q_COMPILER_UNRESTRICTED_UNIONS
# endif
# if 0
# define Q_COMPILER_ATOMICS
# endif
# endif
#endif // Q_CC_CLANG
#ifndef Q_PACKED
# define Q_PACKED
# undef Q_NO_PACKED_REFERENCE
@ -681,12 +196,6 @@ namespace QT_NAMESPACE {}
# endif
#endif
#ifndef Q_COMPILER_MANGLES_RETURN_TYPE
# if defined(Q_CC_MSVC)
# define Q_COMPILER_MANGLES_RETURN_TYPE
# endif
#endif
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE