summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r--src/corelib/global/qglobal.h238
1 files changed, 16 insertions, 222 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 3815f75de5..1009057bad 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -22,237 +22,25 @@
#endif
#include <QtCore/qtversionchecks.h>
-
-#ifdef QT_BOOTSTRAPPED
-#include <QtCore/qconfig-bootstrapped.h>
-#else
-#include <QtCore/qconfig.h>
-#include <QtCore/qtcore-config.h>
-#endif
-
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qtcoreexports.h>
-/* These two macros makes it possible to turn the builtin line expander into a
- * string literal. */
-#define QT_STRINGIFY2(x) #x
-#define QT_STRINGIFY(x) QT_STRINGIFY2(x)
-
-inline void qt_noop(void) {}
+#include <QtCore/qtpreprocessorsupport.h>
#include <QtCore/qsystemdetection.h>
#include <QtCore/qprocessordetection.h>
#include <QtCore/qcompilerdetection.h>
-#include <QtCore/qassert.h>
-#include <QtCore/qtypes.h>
-#include <QtCore/qtclasshelpermacros.h>
-
-/*
- Avoid "unused parameter" warnings
-*/
-#define Q_UNUSED(x) (void)x;
-
#ifndef __ASSEMBLER__
-QT_BEGIN_NAMESPACE
-
-/*
- No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
- for Qt's internal unit tests. If you want slower loading times and more
- symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL.
-*/
-#if defined(QT_BUILD_INTERNAL) && defined(QT_BUILDING_QT) && defined(QT_SHARED)
-# define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
-#elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED)
-# define Q_AUTOTEST_EXPORT Q_DECL_IMPORT
-#else
-# define Q_AUTOTEST_EXPORT
-#endif
-
-#define Q_INIT_RESOURCE(name) \
- do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
- QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (false)
-#define Q_CLEANUP_RESOURCE(name) \
- do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \
- QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (false)
-
-/*
- * If we're compiling C++ code:
- * - and this is a non-namespace build, declare qVersion as extern "C"
- * - and this is a namespace build, declare it as a regular function
- * (we're already inside QT_BEGIN_NAMESPACE / QT_END_NAMESPACE)
- * If we're compiling C code, simply declare the function. If Qt was compiled
- * in a namespace, qVersion isn't callable anyway.
- */
-#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC)
-extern "C"
-#endif
-Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT;
+# include <QtCore/qassert.h>
+# include <QtCore/qtnoop.h>
+# include <QtCore/qtypes.h>
+#endif /* !__ASSEMBLER__ */
+#include <QtCore/qtversion.h>
#if defined(__cplusplus)
-#ifndef Q_CONSTRUCTOR_FUNCTION
-# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
- namespace { \
- static const struct AFUNC ## _ctor_class_ { \
- inline AFUNC ## _ctor_class_() { AFUNC(); } \
- } AFUNC ## _ctor_instance_; \
- }
-
-# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
-#endif
-
-#ifndef Q_DESTRUCTOR_FUNCTION
-# define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
- namespace { \
- static const struct AFUNC ## _dtor_class_ { \
- inline AFUNC ## _dtor_class_() { } \
- inline ~ AFUNC ## _dtor_class_() { AFUNC(); } \
- } AFUNC ## _dtor_instance_; \
- }
-# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
-#endif
-
-/* moc compats (signals/slots) */
-#ifndef QT_MOC_COMPAT
-# define QT_MOC_COMPAT
-#else
-# undef QT_MOC_COMPAT
-# define QT_MOC_COMPAT
-#endif
-
-#ifdef QT_ASCII_CAST_WARNINGS
-# define QT_ASCII_CAST_WARN \
- Q_DECL_DEPRECATED_X("Use fromUtf8, QStringLiteral, or QLatin1StringView")
-#else
-# define QT_ASCII_CAST_WARN
-#endif
-
-/*
- Utility macros and inline functions
-*/
-
-#ifndef Q_FORWARD_DECLARE_OBJC_CLASS
-# ifdef __OBJC__
-# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname
-# else
-# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) class classname
-# endif
-#endif
-#ifndef Q_FORWARD_DECLARE_CF_TYPE
-# define Q_FORWARD_DECLARE_CF_TYPE(type) typedef const struct __ ## type * type ## Ref
-#endif
-#ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE
-# define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref
-#endif
-#ifndef Q_FORWARD_DECLARE_CG_TYPE
-#define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
-#endif
-#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE
-#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
-#endif
-
-#ifdef Q_OS_DARWIN
-
-// Implemented in qcore_mac_objc.mm
-class Q_CORE_EXPORT QMacAutoReleasePool
-{
-public:
- QMacAutoReleasePool();
- ~QMacAutoReleasePool();
-private:
- Q_DISABLE_COPY(QMacAutoReleasePool)
- void *pool;
-};
-
-#endif // Q_OS_DARWIN
-
-Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept;
-
-/*
- Debugging and error handling
-*/
-
-#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
-# define QT_DEBUG
-#endif
-
-#if 0
-#pragma qt_class(QFunctionPointer)
-#endif
-typedef void (*QFunctionPointer)();
-
-#if !defined(Q_UNIMPLEMENTED)
-# define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
-#endif
-
-QT_WARNING_PUSH
-// warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)'
-QT_WARNING_DISABLE_GCC("-Wnoexcept")
-
-namespace QtPrivate
-{
-namespace SwapExceptionTester { // insulate users from the "using std::swap" below
- using std::swap; // import std::swap
- template <typename T>
- void checkSwap(T &t)
- noexcept(noexcept(swap(t, t)));
- // declared, but not implemented (only to be used in unevaluated contexts (noexcept operator))
-}
-} // namespace QtPrivate
-
-// Documented in ../tools/qalgorithm.qdoc
-template <typename T>
-constexpr void qSwap(T &value1, T &value2)
- noexcept(noexcept(QtPrivate::SwapExceptionTester::checkSwap(value1)))
-{
- using std::swap;
- swap(value1, value2);
-}
-
-// pure compile-time micro-optimization for our own headers, so not documented:
-template <typename T>
-constexpr inline void qt_ptr_swap(T* &lhs, T* &rhs) noexcept
-{
- T *tmp = lhs;
- lhs = rhs;
- rhs = tmp;
-}
-
-QT_WARNING_POP
-
-Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1);
-Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2);
-Q_CORE_EXPORT void qFreeAligned(void *ptr);
-
-
-// this adds const to non-const objects (like std::as_const)
-template <typename T>
-constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
-// prevent rvalue arguments:
-template <typename T>
-void qAsConst(const T &&) = delete;
-
-// like std::exchange
-template <typename T, typename U = T>
-constexpr T qExchange(T &t, U &&newValue)
-noexcept(std::conjunction_v<std::is_nothrow_move_constructible<T>, std::is_nothrow_assignable<T &, U>>)
-{
- T old = std::move(t);
- t = std::forward<U>(newValue);
- return old;
-}
-
-// like std::to_underlying
-template <typename Enum>
-constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
-{
- return static_cast<std::underlying_type_t<Enum>>(e);
-}
-
-#define QT_MODULE(x)
-
-QT_END_NAMESPACE
+#include <QtCore/qtclasshelpermacros.h>
// We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
// Be careful when changing the order of these files.
@@ -263,18 +51,24 @@ QT_END_NAMESPACE
#include <QtCore/qflags.h>
#include <QtCore/qatomic.h>
-#include <QtCore/qenvironmentvariables.h>
+#include <QtCore/qconstructormacros.h>
+#include <QtCore/qdarwinhelpers.h>
#include <QtCore/qexceptionhandling.h>
#include <QtCore/qforeach.h>
+#include <QtCore/qfunctionpointer.h>
#include <QtCore/qglobalstatic.h>
+#include <QtCore/qmalloc.h>
#include <QtCore/qminmax.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qoverload.h>
+#include <QtCore/qswap.h>
#include <QtCore/qtdeprecationmarkers.h>
-#include <QtCore/qtranslation.h>
+#include <QtCore/qtenvironmentvariables.h>
+#include <QtCore/qtresource.h>
+#include <QtCore/qttranslation.h>
+#include <QtCore/qttypetraits.h>
#include <QtCore/qversiontagging.h>
#endif /* __cplusplus */
-#endif /* !__ASSEMBLER__ */
#endif /* QGLOBAL_H */