summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-03-28 15:48:04 -0300
committerQt by Nokia <qt-info@nokia.com>2012-04-21 05:09:14 +0200
commit308ffceea5fcb6896da5a791f153cc772d42c810 (patch)
treecc4458bec488540abe347d551d843d3f1fc7bef1 /src/corelib
parent45991b0f31b815afe749e679bb5dda66890bf5f7 (diff)
Move the compiler-related macros to qcompilerdetection.h
This cleans up qglobal.h a little further and organises things a bit more. Change-Id: Ic025e720941cdf59b8a1a0baf515b29f25eba0f1 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qcompilerdetection.h114
-rw-r--r--src/corelib/global/qglobal.h105
2 files changed, 110 insertions, 109 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 6d7635ef67..cea26e0971 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -403,10 +403,6 @@
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
#endif
-#ifndef Q_NORETURN
-# define Q_NORETURN
-#endif
-
/*
* C++11 support
*
@@ -573,10 +569,120 @@
//# define Q_COMPILER_INITIALIZER_LISTS
#endif
+/*
+ * C++11 keywords and expressions
+ */
+#ifdef Q_COMPILER_NULLPTR
+# define Q_NULLPTR nullptr
+#else
+# define Q_NULLPTR 0
+#endif
+
+#ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS
+# define Q_DECL_EQ_DELETE = delete
+#else
+# define Q_DECL_EQ_DELETE
+#endif
+
+#ifdef Q_COMPILER_CONSTEXPR
+# define Q_DECL_CONSTEXPR constexpr
+#else
+# define Q_DECL_CONSTEXPR
+#endif
+
+#ifdef Q_COMPILER_EXPLICIT_OVERRIDES
+# define Q_DECL_OVERRIDE override
+# define Q_DECL_FINAL final
+# ifdef Q_COMPILER_DECLTYPE // required for class-level final to compile in qvariant_p.h
+# define Q_DECL_FINAL_CLASS final
+# else
+# define Q_DECL_FINAL_CLASS
+# endif
+#else
+# define Q_DECL_OVERRIDE
+# define Q_DECL_FINAL
+# define Q_DECL_FINAL_CLASS
+#endif
+
+#if defined(Q_COMPILER_ALIGNOF) && !defined(Q_ALIGNOF)
+# define Q_ALIGNOF(x) alignof(x)
+#endif
+
+/*
+ * Fallback macros to certain compiler features
+ */
+
+#ifndef Q_NORETURN
+# define Q_NORETURN
+#endif
+#ifndef Q_PACKED
+# define Q_PACKED
+# undef Q_NO_PACKED_REFERENCE
+#endif
+#ifndef Q_LIKELY
+# define Q_LIKELY(x) (x)
+#endif
+#ifndef Q_UNLIKELY
+# define Q_UNLIKELY(x) (x)
+#endif
+#ifndef Q_ASSUME
+# define Q_ASSUME(expr)
+#endif
+#ifndef Q_UNREACHABLE
+# define Q_UNREACHABLE()
+#endif
+#ifndef Q_ALLOC_SIZE
+# define Q_ALLOC_SIZE(x)
+#endif
+#ifndef Q_REQUIRED_RESULT
+# if defined(Q_CC_GNU)
+# define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result))
+# else
+# define Q_REQUIRED_RESULT
+# endif
+#endif
#ifndef Q_COMPILER_MANGLES_RETURN_TYPE
# if defined(Q_CC_MSVC)
# define Q_COMPILER_MANGLES_RETURN_TYPE
# endif
#endif
+/*
+ Workaround for static const members on MSVC++.
+*/
+
+#if defined(Q_CC_MSVC)
+# define QT_STATIC_CONST static
+# define QT_STATIC_CONST_IMPL
+#else
+# define QT_STATIC_CONST static const
+# define QT_STATIC_CONST_IMPL const
+#endif
+
+/*
+ Warnings and errors when using deprecated methods
+*/
+#if defined(Q_CC_GNU) || defined(Q_CC_RVCT)
+# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
+#elif defined(Q_CC_MSVC)
+# define Q_DECL_DEPRECATED __declspec(deprecated)
+# if defined (Q_CC_INTEL)
+# define Q_DECL_VARIABLE_DEPRECATED
+# endif
+#else
+# define Q_DECL_DEPRECATED
+#endif
+#ifndef Q_DECL_VARIABLE_DEPRECATED
+# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
+#endif
+
+/*
+ Proper for-scoping in MIPSpro CC
+*/
+#ifndef QT_NO_KEYWORDS
+# if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64))
+# define for if (0) {} else for
+# endif
+#endif
+
#endif // QCOMPILERDETECTION_H
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index f3c3b7896d..e50e5d5cfa 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -150,28 +150,6 @@ namespace QT_NAMESPACE {}
# define QT_LARGEFILE_SUPPORT 64
#endif
-#ifndef Q_PACKED
-# define Q_PACKED
-# undef Q_NO_PACKED_REFERENCE
-#endif
-
-#ifndef Q_LIKELY
-# define Q_LIKELY(x) (x)
-#endif
-#ifndef Q_UNLIKELY
-# define Q_UNLIKELY(x) (x)
-#endif
-#ifndef Q_ASSUME
-# define Q_ASSUME(expr)
-#endif
-#ifndef Q_UNREACHABLE
-# define Q_UNREACHABLE()
-#endif
-
-#ifndef Q_ALLOC_SIZE
-# define Q_ALLOC_SIZE(x)
-#endif
-
#ifndef Q_CONSTRUCTOR_FUNCTION
# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
namespace { \
@@ -194,14 +172,6 @@ namespace QT_NAMESPACE {}
# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
#endif
-#ifndef Q_REQUIRED_RESULT
-# if defined(Q_CC_GNU)
-# define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result))
-# else
-# define Q_REQUIRED_RESULT
-# endif
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -340,45 +310,6 @@ QT_END_INCLUDE_NAMESPACE
# endif
#endif
-/*
- Proper for-scoping in MIPSpro CC
-*/
-#ifndef QT_NO_KEYWORDS
-# if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64))
-# define for if(0){}else for
-# endif
-#endif
-
-/*
- Workaround for static const members on MSVC++.
-*/
-
-#if defined(Q_CC_MSVC)
-# define QT_STATIC_CONST static
-# define QT_STATIC_CONST_IMPL
-#else
-# define QT_STATIC_CONST static const
-# define QT_STATIC_CONST_IMPL const
-#endif
-
-/*
- Warnings and errors when using deprecated methods
-*/
-#if defined(Q_CC_GNU) || defined(Q_CC_RVCT)
-# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
-#elif defined(Q_CC_MSVC)
-# define Q_DECL_DEPRECATED __declspec(deprecated)
-# if defined (Q_CC_INTEL)
-# define Q_DECL_VARIABLE_DEPRECATED
-# else
-# endif
-#else
-# define Q_DECL_DEPRECATED
-#endif
-#ifndef Q_DECL_VARIABLE_DEPRECATED
-# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
-#endif
-
#if defined(QT_NO_DEPRECATED)
# undef QT_DEPRECATED
# undef QT_DEPRECATED_VARIABLE
@@ -448,42 +379,6 @@ QT_END_INCLUDE_NAMESPACE
# define QT_FASTCALL
#endif
-#ifdef Q_COMPILER_NULLPTR
-# define Q_NULLPTR nullptr
-#else
-# define Q_NULLPTR 0
-#endif
-
-#ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS
-# define Q_DECL_EQ_DELETE = delete
-#else
-# define Q_DECL_EQ_DELETE
-#endif
-
-#ifdef Q_COMPILER_CONSTEXPR
-# define Q_DECL_CONSTEXPR constexpr
-#else
-# define Q_DECL_CONSTEXPR
-#endif
-
-#ifdef Q_COMPILER_EXPLICIT_OVERRIDES
-# define Q_DECL_OVERRIDE override
-# define Q_DECL_FINAL final
-# ifdef Q_COMPILER_DECLTYPE // required for class-level final to compile in qvariant_p.h
-# define Q_DECL_FINAL_CLASS final
-# else
-# define Q_DECL_FINAL_CLASS
-# endif
-#else
-# define Q_DECL_OVERRIDE
-# define Q_DECL_FINAL
-# define Q_DECL_FINAL_CLASS
-#endif
-
-#if defined(Q_COMPILER_ALIGNOF) && !defined(Q_ALIGNOF)
-# define Q_ALIGNOF(x) alignof(x)
-#endif
-
//defines the type for the WNDPROC on windows
//the alignment needs to be forced for sse2 to not crash with mingw
#if defined(Q_OS_WIN)