این چیزیه که Qt استفاده می کنه (از فایل qcompilerdetection.h)
/*
* C++11 support
*
* Paper Macro
* N2341 Q_COMPILER_ALIGNAS
* N2341 Q_COMPILER_ALIGNOF
* N2427 Q_COMPILER_ATOMICS
* N2761 Q_COMPILER_ATTRIBUTES
* N2541 Q_COMPILER_AUTO_FUNCTION
* N1984 N2546 Q_COMPILER_AUTO_TYPE
* N2437 Q_COMPILER_CLASS_ENUM
* N2235 Q_COMPILER_CONSTEXPR
* N2343 N3276 Q_COMPILER_DECLTYPE
* N2346 Q_COMPILER_DEFAULT_MEMBERS
* N2346 Q_COMPILER_DELETE_MEMBERS
* N1986 Q_COMPILER_DELEGATING_CONSTRUCTORS
* N2437 Q_COMPILER_EXPLICIT_CONVERSIONS
* N3206 N3272 Q_COMPILER_EXPLICIT_OVERRIDES (v0.9 and above only)
* N1987 Q_COMPILER_EXTERN_TEMPLATES
* N2540 Q_COMPILER_INHERITING_CONSTRUCTORS
* N2672 Q_COMPILER_INITIALIZER_LISTS
* N2658 N2927 Q_COMPILER_LAMBDA (v1.0 and above only)
* N2756 Q_COMPILER_NONSTATIC_MEMBER_INIT
* N2855 N3050 Q_COMPILER_NOEXCEPT
* N2431 Q_COMPILER_NULLPTR
* N2930 Q_COMPILER_RANGE_FOR
* N2442 Q_COMPILER_RAW_STRINGS
* N2439 Q_COMPILER_REF_QUALIFIERS
* N2118 N2844 N3053 Q_COMPILER_RVALUE_REFS (Note: GCC 4.3 implements only the oldest)
* N1720 Q_COMPILER_STATIC_ASSERT
* N2258 Q_COMPILER_TEMPLATE_ALIAS
* N2659 Q_COMPILER_THREAD_LOCAL
* N2765 Q_COMPILER_UDL
* N2442 Q_COMPILER_UNICODE_STRINGS
* N2640 Q_COMPILER_UNIFORM_INIT
* N2544 Q_COMPILER_UNRESTRICTED_UNIONS
* N1653 Q_COMPILER_VARIADIC_MACROS
* N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES
*
* C++1y proposed features
*
* N3472 Q_COMPILER_BINARY_LITERALS
* N3649 Q_COMPILER_GENERIC_LAMBDA
* N3638 Q_COMPILER_LAMBDA_CAPTURES
* N3652 Q_COMPILER_RELAXED_CONSTEXPR_FUNCTIONS
* N3386 N3638 Q_COMPILER_RETURN_TYPE_DEDUCTION
* N3651 Q_COMPILER_VARIABLE_TEMPLATES
*
* C++14 Technical Specifications / C++17:
* N3639 Q_COMPILER_VLA (see also Q_COMPILER_RESTRICTED_VLA)
*
*/
#ifdef Q_CC_INTEL
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too
# if __INTEL_COMPILER < 1200
# define Q_NO_TEMPLATE_FRIENDS
# endif
# if __INTEL_COMPILER >= 1310 && !defined(_WIN32)
// ICC supports C++14 binary literals in C, C++98, and C++11 modes
// at least since 13.1, but I can't test further back
# define Q_COMPILER_BINARY_LITERALS
# endif
# if __cplusplus >= 201103L
# if __INTEL_COMPILER >= 1200
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_DEFAULT_MEMBERS
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
# define Q_COMPILER_VARIADIC_MACROS
# endif
# if __INTEL_COMPILER >= 1210
# define Q_COMPILER_ATTRIBUTES
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_TEMPLATE_ALIAS
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# if __INTEL_COMPILER >= 1300
# define Q_COMPILER_ATOMICS
// constexpr support is only partial
//# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_NOEXCEPT
# endif
# if __INTEL_COMPILER >= 1400
# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_COMPILER_NONSTATIC_MEMBER_INIT
# define Q_COMPILER_RAW_STRINGS
# define Q_COMPILER_REF_QUALIFIERS
# define Q_COMPILER_UNRESTRICTED_UNIONS
# endif
# endif
#endif
#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
/* General C++ features */
# define Q_COMPILER_RESTRICTED_VLA
# if !__has_feature(cxx_exceptions)
# ifndef QT_NO_EXCEPTIONS
# define QT_NO_EXCEPTIONS
# endif
# endif
# if !__has_feature(cxx_rtti)
# define QT_NO_RTTI
# endif
# if __has_feature(attribute_deprecated_with_message)
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
# endif
// Clang supports binary literals in C, C++98 and C++11 modes
// It's been supported "since the dawn of time itself" (cf. commit 179883)
# if __has_extension(cxx_binary_literals)
# define Q_COMPILER_BINARY_LITERALS
# endif
// Variadic macros are supported for gnu++98, c++11, c99 ... since 2.9
# if ((__clang_major__ * 100) + __clang_minor__) >= 209
# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
|| (defined(__cplusplus) && (__cplusplus >= 201103L)) \
|| (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
# define Q_COMPILER_VARIADIC_MACROS
# endif
# endif
/* C++11 features, see http://clang.llvm.org/cxx_status.html */
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/* Detect C++ features using __has_feature(), see http://clang.llvm.org/docs/LanguageExtensions.html#cxx11 */
# if __has_feature(cxx_alignas)
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# endif
# if 0 /* not implemented in clang yet */
# define Q_COMPILER_ATOMICS
# endif
# if __has_feature(cxx_attributes)
# define Q_COMPILER_ATTRIBUTES
# endif
# if __has_feature(cxx_auto_type)
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
# endif
# if __has_feature(cxx_strong_enums)
# define Q_COMPILER_CLASS_ENUM
# endif
# if __has_feature(cxx_constexpr)
# define Q_COMPILER_CONSTEXPR
# endif
# if __has_feature(cxx_decltype) /* && __has_feature(cxx_decltype_incomplete_return_types) */
# define Q_COMPILER_DECLTYPE
# endif
# if __has_feature(cxx_defaulted_functions)
# define Q_COMPILER_DEFAULT_MEMBERS
# endif
# if __has_feature(cxx_deleted_functions)
# define Q_COMPILER_DELETE_MEMBERS
# endif
# if __has_feature(cxx_delegating_constructors)
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# endif
# if __has_feature(cxx_explicit_conversions)
# define Q_COMPILER_EXPLICIT_CONVERSIONS
# endif
# if __has_feature(cxx_override_control)
# define Q_COMPILER_EXPLICIT_OVERRIDES
# endif
# if __has_feature(cxx_inheriting_constructors)
# define Q_COMPILER_INHERITING_CONSTRUCTORS
# endif
# if __has_feature(cxx_generalized_initializers)
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */
# endif
# if __has_feature(cxx_lambdas)
# define Q_COMPILER_LAMBDA
# endif
# if __has_feature(cxx_noexcept)
# define Q_COMPILER_NOEXCEPT
# endif
# if __has_feature(cxx_nonstatic_member_init)
# define Q_COMPILER_NONSTATIC_MEMBER_INIT
# endif
# if __has_feature(cxx_nullptr)
# define Q_COMPILER_NULLPTR
# endif
# if __has_feature(cxx_range_for)
# define Q_COMPILER_RANGE_FOR
# endif
# if __has_feature(cxx_raw_string_literals)
# define Q_COMPILER_RAW_STRINGS
# endif
# if __has_feature(cxx_reference_qualified_functions)
# define Q_COMPILER_REF_QUALIFIERS
# endif
# if __has_feature(cxx_rvalue_references)
# define Q_COMPILER_RVALUE_REFS
# endif
# if __has_feature(cxx_static_assert)
# define Q_COMPILER_STATIC_ASSERT
# endif
# if __has_feature(cxx_alias_templates)
# define Q_COMPILER_TEMPLATE_ALIAS
# endif
# if __has_feature(cxx_thread_local)
# define Q_COMPILER_THREAD_LOCAL
# endif
# if __has_feature(cxx_user_literals)
# define Q_COMPILER_UDL
# endif
# if __has_feature(cxx_unicode_literals)
# define Q_COMPILER_UNICODE_STRINGS
# endif
# if __has_feature(cxx_unrestricted_unions)
# define Q_COMPILER_UNRESTRICTED_UNIONS
# endif
# if __has_feature(cxx_variadic_templates)
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
/* Features that have no __has_feature() check */
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# define Q_COMPILER_EXTERN_TEMPLATES
# endif
# endif
/* C++1y features, see http://clang.llvm.org/cxx_status.html and
* http://clang.llvm.org/docs/LanguageExtensions.html#checks-for-standard-language-features */
# if __cplusplus > 201103L
//# if __has_feature(cxx_binary_literals)
//# define Q_COMPILER_BINARY_LITERALS // see above
//# endif
# if __has_feature(cxx_generic_lambda)
# define Q_COMPILER_GENERIC_LAMBDA
# endif
# if __has_feature(cxx_init_capture)
# define Q_COMPILER_LAMBDA_CAPTURES
# endif
# if __has_feature(cxx_relaxed_constexpr)
# define Q_COMPILER_RELAXED_CONSTEXPR_FUNCTIONS
# endif
# if __has_feature(cxx_decltype_auto) && __has_feature(cxx_return_type_deduction)
# define Q_COMPILER_RETURN_TYPE_DEDUCTION
# endif
# if __has_feature(cxx_variable_templates)
# define Q_COMPILER_VARIABLE_TEMPLATES
# endif
# if __has_feature(cxx_runtime_array)
# define Q_COMPILER_VLA
# endif
# endif
#endif // Q_CC_CLANG
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
# define Q_COMPILER_RESTRICTED_VLA
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
// GCC supports binary literals in C, C++98 and C++11 modes
# define Q_COMPILER_BINARY_LITERALS
# endif
# if !defined(__STRICT_ANSI__) || defined(__GXX_EXPERIMENTAL_CXX0X__) \
|| (defined(__cplusplus) && (__cplusplus >= 201103L)) \
|| (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
// Variadic macros are supported for gnu++98, c++11, C99 ... since forever (gcc 2.97)
# define Q_COMPILER_VARIADIC_MACROS
# endif
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
/* C++11 features supported in GCC 4.3: */
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
/* C++11 features supported in GCC 4.4: */
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_DEFAULT_MEMBERS
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_EXTERN_TEMPLATES
# define Q_COMPILER_INITIALIZER_LISTS
# define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
/* C++11 features supported in GCC 4.5: */
# define Q_COMPILER_EXPLICIT_CONVERSIONS
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_RAW_STRINGS
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
/* C++11 features supported in GCC 4.6: */
# define Q_COMPILER_CONSTEXPR
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_UNRESTRICTED_UNIONS
# define Q_COMPILER_RANGE_FOR
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407
/* GCC 4.4 implemented <atomic> and std::atomic using its old intrinsics.
* However, the implementation is incomplete for most platforms until GCC 4.7:
* instead, std::atomic would use an external lock. Since we need an std::atomic
* that is behavior-compatible with QBasicAtomic, we only enable it here */
# define Q_COMPILER_ATOMICS
/* GCC 4.6.x has problems dealing with noexcept expressions,
* so turn the feature on for 4.7 and above, only */
# define Q_COMPILER_NOEXCEPT
/* C++11 features supported in GCC 4.7: */
# define Q_COMPILER_NONSTATIC_MEMBER_INIT
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_OVERRIDES
# define Q_COMPILER_TEMPLATE_ALIAS
# define Q_COMPILER_UDL
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
# define Q_COMPILER_ATTRIBUTES
# define Q_COMPILER_ALIGNAS
# define Q_COMPILER_ALIGNOF
# define Q_COMPILER_INHERITING_CONSTRUCTORS
# define Q_COMPILER_THREAD_LOCAL
# if (__GNUC__ * 100 + __GNUC_MINOR__) > 408 || __GNUC_PATCHLEVEL__ >= 1
# define Q_COMPILER_REF_QUALIFIERS
# endif
# endif
/* C++11 features are complete as of GCC 4.8.1 */
# endif
# if __cplusplus > 201103L
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409
/* C++1y features in GCC 4.9 */
//# define Q_COMPILER_BINARY_LITERALS // already supported since GCC 4.3 as an extension
# define Q_COMPILER_LAMBDA_CAPTURES
# define Q_COMPILER_RETURN_TYPE_DEDUCTION
# endif
# endif
#endif
#if defined(Q_CC_MSVC) && !defined(Q_CC_INTEL)
# if _MSC_VER >= 1400
/* C++11 features supported in VC8 = VC2005: */
# define Q_COMPILER_VARIADIC_MACROS
# ifndef __cplusplus_cli
/* 2005 supports the override and final contextual keywords, in
the same positions as the C++11 variants, but 'final' is
called 'sealed' instead:
http://msdn.microsoft.com/en-us/library/0w2w91tf%28v=vs.80%29.aspx
The behavior is slightly different in C++/CLI, which requires the
"virtual" keyword to be present too, so don't define for that.
So don't define Q_COMPILER_EXPLICIT_OVERRIDES (since it's not
the same as the C++11 version), but define the Q_DECL_* flags
accordingly: */
# define Q_DECL_OVERRIDE override
# define Q_DECL_FINAL sealed
# endif
# endif
# if _MSC_VER >= 1600
/* C++11 features supported in VC10 = VC2010: */
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_LAMBDA
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
// MSVC's library has std::initializer_list, but the compiler does not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
//# define Q_COMPILER_UNIFORM_INIT
# endif
# if _MSC_VER >= 1700
/* C++11 features supported in VC11 = VC2012: */
# undef Q_DECL_OVERRIDE /* undo 2005/2008 settings... */
# undef Q_DECL_FINAL /* undo 2005/2008 settings... */
# define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_CLASS_ENUM
# define Q_COMPILER_ATOMICS
# endif /* VC 11 */
# if _MSC_VER >= 1800
/* C++11 features in VC12 = VC2013 */
# define Q_COMPILER_DEFAULT_MEMBERS
# define Q_COMPILER_DELETE_MEMBERS
# define Q_COMPILER_DELEGATING_CONSTRUCTORS
# define Q_COMPILER_EXPLICIT_CONVERSIONS
# define Q_COMPILER_NONSTATIC_MEMBER_INIT
// implemented, but nested initialization fails (eg tst_qvector): http://connect.microsoft.com/VisualStudio/feedback/details/800364/initializer-list-calls-object-destructor-twice
// #define Q_COMPILER_INITIALIZER_LISTS
// implemented in principle, but has a bug that makes it unusable: http://connect.microsoft.com/VisualStudio/feedback/details/802058/c-11-unified-initialization-fails-with-c-style-arrays
// #define Q_COMPILER_UNIFORM_INIT
# define Q_COMPILER_RAW_STRINGS
# define Q_COMPILER_TEMPLATE_ALIAS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif /* VC 12 */
# if _MSC_FULL_VER >= 180030324 // VC 12 SP 2 RC
# define Q_COMPILER_INITIALIZER_LISTS
# endif /* VC 12 SP 2 RC */
#endif /* Q_CC_MSVC */