diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-07-10 14:52:20 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-27 10:59:09 +0200 |
commit | 37a660c594a6de1a99833a539adbef0495a90548 (patch) | |
tree | ec91810135ebeba1184fa6a829274a2663393e0a /src/corelib/global/qcompilerdetection.h | |
parent | 4712d88c0ef69e9724334f37319dc8e8ad0f2ab0 (diff) |
qcompilerdetection.h: set Q_DECL_OVERRIDE/Q_DECL_FINAL for 2005 <= MSVC <= 2010
This enables Q_DECL_FINAL and Q_DECL_OVERRIDE backed by VC's
non-standard extensions from VC 2005 on. VC 2012 will support
the standard-compliant version, so use that there.
Change-Id: I96874fe3d36fcaa283d2d1f53d5eb6825e55f259
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index f1d4a8a51d..b76a2ed978 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -646,6 +646,15 @@ # if _MSC_VER >= 1400 /* C++11 features supported in VC8 = VC2005: */ # define Q_COMPILER_VARIADIC_MACROS + /* 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 + 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 # if _MSC_VER >= 1600 /* C++11 features supported in VC10 = VC2010: */ @@ -659,7 +668,9 @@ # endif # if _MSC_VER >= 1700 /* C++11 features supported in VC11 = VC2012: */ -# define Q_COMPILER_EXPLICIT_OVERRIDES +# undef Q_DECL_OVERRIDE /* undo 2005/2098 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 @@ -716,8 +727,12 @@ # define Q_DECL_OVERRIDE override # define Q_DECL_FINAL final #else -# define Q_DECL_OVERRIDE -# define Q_DECL_FINAL +# ifndef Q_DECL_OVERRIDE +# define Q_DECL_OVERRIDE +# endif +# ifndef Q_DECL_FINAL +# define Q_DECL_FINAL +# endif #endif #ifdef Q_COMPILER_NOEXCEPT |