summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qcompilerdetection.h157
-rw-r--r--src/corelib/global/qconfig-medium.h3
-rw-r--r--src/corelib/global/qconfig-minimal.h3
-rw-r--r--src/corelib/global/qconfig-nacl.h3
-rw-r--r--src/corelib/global/qconfig-small.h3
-rw-r--r--src/corelib/global/qfeatures.h3
-rw-r--r--src/corelib/global/qglobal.cpp244
-rw-r--r--src/corelib/global/qglobal.h222
-rw-r--r--src/corelib/global/qlogging.cpp114
-rw-r--r--src/corelib/global/qlogging.h4
-rw-r--r--src/corelib/global/qnamespace.h10
-rw-r--r--src/corelib/global/qnamespace.qdoc18
-rw-r--r--src/corelib/global/qprocessordetection.h4
-rw-r--r--src/corelib/global/qsystemdetection.h4
14 files changed, 355 insertions, 437 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 6d7635ef67..a971bfdf12 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -40,6 +40,10 @@
**
****************************************************************************/
+#ifndef QGLOBAL_H
+# include <QtCore/qglobal.h>
+#endif
+
#ifndef QCOMPILERDETECTION_H
#define QCOMPILERDETECTION_H
@@ -86,13 +90,19 @@
# define Q_CC_MSVC_NET
# define Q_OUTOFLINE_TEMPLATE inline
# define Q_NO_TEMPLATE_FRIENDS
+# define Q_COMPILER_MANGLES_RETURN_TYPE
+# define Q_FUNC_INFO __FUNCSIG__
# define Q_ALIGNOF(type) __alignof(type)
# define Q_DECL_ALIGN(n) __declspec(align(n))
# define Q_ASSUME(expr) __assume(expr)
# define Q_UNREACHABLE() __assume(0)
# define Q_NORETURN __declspec(noreturn)
+# define Q_DECL_DEPRECATED __declspec(deprecated)
+# define Q_DECL_EXPORT __declspec(dllexport)
+# define Q_DECL_IMPORT __declspec(dllimport)
/* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
# if defined(__INTEL_COMPILER)
+# define Q_DECL_VARIABLE_DEPRECATED
# define Q_CC_INTEL
# endif
/* MSVC does not support SSE/MMX on x64 */
@@ -139,6 +149,16 @@
/* work-around for missing compiler intrinsics */
# define __is_empty(X) false
# define __is_pod(X) false
+# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
+# ifdef Q_OS_LINUX
+# define Q_DECL_EXPORT __attribute__((visibility("default")))
+# define Q_DECL_IMPORT __attribute__((visibility("default")))
+# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
+# else
+# define Q_DECL_EXPORT __declspec(dllexport)
+# define Q_DECL_IMPORT __declspec(dllimport)
+# endif
+
#elif defined(__GNUC__)
# define Q_CC_GNU
# define Q_C_CALLBACKS
@@ -163,12 +183,24 @@
# endif
# endif
+# ifdef Q_OS_WIN
+# define Q_DECL_EXPORT __declspec(dllexport)
+# define Q_DECL_IMPORT __declspec(dllimport)
+# elif defined(QT_VISIBILITY_AVAILABLE)
+# define Q_DECL_EXPORT __attribute__((visibility("default")))
+# define Q_DECL_IMPORT __attribute__((visibility("default")))
+# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
+# endif
+
+# define Q_FUNC_INFO __PRETTY_FUNCTION__
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
+# define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
# define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
# define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# define Q_NORETURN __attribute__((__noreturn__))
+# define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__))
# if !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# define Q_NO_PACKED_REFERENCE
@@ -329,6 +361,7 @@
(see __DCC__ above). This one is for C mode files (__EDG is not defined) */
#elif defined(_DIAB_TOOL)
# define Q_CC_DIAB
+# define Q_FUNC_INFO __PRETTY_FUNCTION__
/* Never tested! */
#elif defined(__HIGHC__)
@@ -336,6 +369,7 @@
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
# define Q_CC_SUN
+# define Q_COMPILER_MANGLES_RETURN_TYPE
/* 5.0 compiler or better
'bool' is enabled by default but can be disabled using -features=nobool
in which case _BOOL is not defined
@@ -381,6 +415,7 @@
# if defined(__HP_aCC) || __cplusplus >= 199707L
# define Q_NO_TEMPLATE_FRIENDS
# define Q_CC_HPACC
+# define Q_FUNC_INFO __PRETTY_FUNCTION__
# if __HP_aCC-0 < 060000
# define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
# define Q_DECL_EXPORT __declspec(dllexport)
@@ -403,10 +438,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
*
@@ -474,13 +505,15 @@
#ifdef Q_CC_CLANG
/* General C++ features */
# if !__has_feature(cxx_exceptions)
-# define QT_NO_EXCEPTIONS
+# ifndef QT_NO_EXCEPTIONS
+# define QT_NO_EXCEPTIONS
+# endif
# 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 __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
# if ((__clang_major__ * 100) + __clang_minor__) >= 209 /* since clang 2.9 */
# define Q_COMPILER_AUTO_TYPE
# define Q_COMPILER_DECLTYPE
@@ -573,9 +606,115 @@
//# define Q_COMPILER_INITIALIZER_LISTS
#endif
-#ifndef Q_COMPILER_MANGLES_RETURN_TYPE
-# if defined(Q_CC_MSVC)
-# define Q_COMPILER_MANGLES_RETURN_TYPE
+/*
+ * 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) qt_noop()
+#endif
+#ifndef Q_UNREACHABLE
+# define Q_UNREACHABLE() qt_noop()
+#endif
+#ifndef Q_ALLOC_SIZE
+# define Q_ALLOC_SIZE(x)
+#endif
+#ifndef Q_REQUIRED_RESULT
+# define Q_REQUIRED_RESULT
+#endif
+#ifndef Q_DECL_DEPRECATED
+# define Q_DECL_DEPRECATED
+#endif
+#ifndef Q_DECL_VARIABLE_DEPRECATED
+# define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
+#endif
+#ifndef Q_DECL_EXPORT
+# define Q_DECL_EXPORT
+#endif
+#ifndef Q_DECL_IMPORT
+# define Q_DECL_IMPORT
+#endif
+#ifndef Q_DECL_HIDDEN
+# define Q_DECL_HIDDEN
+#endif
+#ifndef Q_FUNC_INFO
+# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)
+# define Q_FUNC_INFO __FILE__ "(line number unavailable)"
+# else
+# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__)
+# 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
+
+/*
+ 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
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
index b52b067909..ba91303409 100644
--- a/src/corelib/global/qconfig-medium.h
+++ b/src/corelib/global/qconfig-medium.h
@@ -74,9 +74,6 @@
#ifndef QT_NO_IMAGEFORMAT_PPM
# define QT_NO_IMAGEFORMAT_PPM
#endif
-#ifndef QT_NO_IMAGE_TEXT
-# define QT_NO_IMAGE_TEXT
-#endif
#ifndef QT_NO_MOVIE
# define QT_NO_MOVIE
#endif
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
index 3244e01c9e..57aa26b381 100644
--- a/src/corelib/global/qconfig-minimal.h
+++ b/src/corelib/global/qconfig-minimal.h
@@ -141,9 +141,6 @@
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
# define QT_NO_IMAGE_HEURISTIC_MASK
#endif
-#ifndef QT_NO_IMAGE_TEXT
-# define QT_NO_IMAGE_TEXT
-#endif
#ifndef QT_NO_MOVIE
# define QT_NO_MOVIE
#endif
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
index 69980f97a6..7e48afaee3 100644
--- a/src/corelib/global/qconfig-nacl.h
+++ b/src/corelib/global/qconfig-nacl.h
@@ -105,9 +105,6 @@
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
# define QT_NO_IMAGE_HEURISTIC_MASK
#endif
-#ifndef QT_NO_IMAGE_TEXT
-# define QT_NO_IMAGE_TEXT
-#endif
#ifndef QT_NO_MOVIE
# define QT_NO_MOVIE
#endif
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
index e764285e4a..0c0e6aa01a 100644
--- a/src/corelib/global/qconfig-small.h
+++ b/src/corelib/global/qconfig-small.h
@@ -105,9 +105,6 @@
#ifndef QT_NO_IMAGEFORMAT_XPM
# define QT_NO_IMAGEFORMAT_XPM
#endif
-#ifndef QT_NO_IMAGE_TEXT
-# define QT_NO_IMAGE_TEXT
-#endif
#ifndef QT_NO_MOVIE
# define QT_NO_MOVIE
#endif
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index 4ce586a858..54c1be8bd3 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -118,9 +118,6 @@
// QImage::createHeuristicMask()
//#define QT_NO_IMAGE_HEURISTIC_MASK
-// Image Text
-//#define QT_NO_IMAGE_TEXT
-
// QLCDNumber
//#define QT_NO_LCDNUMBER
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 38ddd7bf97..966d66a038 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -72,7 +72,7 @@
# include <envLib.h>
#endif
-#if defined(Q_OS_MACX) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
#include <CoreServices/CoreServices.h>
#endif
@@ -126,7 +126,7 @@ QT_BEGIN_NAMESPACE
Qt::Alignment parameter, which means that any combination of
Qt::AlignmentFlag values,or 0, is legal:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 0
+ \snippet code/src_corelib_global_qglobal.cpp 0
If you try to pass a value from another enum or just a plain
integer other than 0, the compiler will report an error. If you
@@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 1
+ \snippet code/src_corelib_global_qglobal.cpp 1
You can then use the \c MyClass::Options type to store
combinations of \c MyClass::Option values.
@@ -150,7 +150,7 @@ QT_BEGIN_NAMESPACE
To make the flags available for these purposes, the Q_FLAGS() macro must
be used:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp meta-object flags
+ \snippet code/src_corelib_global_qglobal.cpp meta-object flags
\section1 Naming Convention
@@ -353,18 +353,18 @@ QT_BEGIN_NAMESPACE
The curious user will have seen that the Qt classes derived
from QObject typically include this macro in a private section:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 43
+ \snippet code/src_corelib_global_qglobal.cpp 43
It declares a copy constructor and an assignment operator in the
private section, so that if you use them by mistake, the compiler
will report an error.
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 44
+ \snippet code/src_corelib_global_qglobal.cpp 44
But even this might not catch absolutely every case. You might be
tempted to do something like this:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 45
+ \snippet code/src_corelib_global_qglobal.cpp 45
First of all, don't do that. Most compilers will generate code that
uses the copy constructor, so the privacy violation error will be
@@ -382,7 +382,7 @@ QT_BEGIN_NAMESPACE
The Q_DECLARE_FLAGS() macro expands to
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 2
+ \snippet code/src_corelib_global_qglobal.cpp 2
\a Enum is the name of an existing enum type, whereas \a Flags is
the name of the QFlags<\e{Enum}> typedef.
@@ -461,7 +461,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 3
+ \snippet code/src_corelib_global_qglobal.cpp 3
<QtGlobal> also contains functions that generate messages from the
given string argument: qCritical(), qDebug(), qFatal() and
@@ -470,7 +470,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 4
+ \snippet code/src_corelib_global_qglobal.cpp 4
The remaining functions are qRound() and qRound64(), which both
accept a \l qreal value as their argument returning the value
@@ -532,22 +532,6 @@ QT_BEGIN_NAMESPACE
Convenience typedef for \c{unsigned char}.
*/
-/*!
- \fn qt_set_sequence_auto_mnemonic(bool on)
- \relates <QtGlobal>
-
- Enables automatic mnemonics on Mac if \a on is true; otherwise
- this feature is disabled.
-
- Note that this function is only available on Mac where mnemonics
- are disabled by default.
-
- To access to this function, use an extern declaration:
- extern void qt_set_sequence_auto_mnemonic(bool b);
-
- \sa {QShortcut#mnemonic}{QShortcut}
-*/
-
/*! \typedef ushort
\relates <QtGlobal>
@@ -619,7 +603,7 @@ QT_BEGIN_NAMESPACE
Literals of this type can be created using the Q_INT64_C() macro:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 5
+ \snippet code/src_corelib_global_qglobal.cpp 5
\sa Q_INT64_C(), quint64, qlonglong
*/
@@ -635,7 +619,7 @@ QT_BEGIN_NAMESPACE
Literals of this type can be created using the Q_UINT64_C()
macro:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 6
+ \snippet code/src_corelib_global_qglobal.cpp 6
\sa Q_UINT64_C(), qint64, qulonglong
*/
@@ -712,7 +696,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 8
+ \snippet code/src_corelib_global_qglobal.cpp 8
\sa qint64, Q_UINT64_C()
*/
@@ -725,7 +709,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 9
+ \snippet code/src_corelib_global_qglobal.cpp 9
\sa quint64, Q_INT64_C()
*/
@@ -758,7 +742,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 10
+ \snippet code/src_corelib_global_qglobal.cpp 10
*/
/*! \fn int qRound(qreal value)
@@ -768,7 +752,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 11
+ \snippet code/src_corelib_global_qglobal.cpp 11
*/
/*! \fn qint64 qRound64(qreal value)
@@ -778,7 +762,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 12
+ \snippet code/src_corelib_global_qglobal.cpp 12
*/
/*! \fn const T &qMin(const T &value1, const T &value2)
@@ -788,7 +772,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 13
+ \snippet code/src_corelib_global_qglobal.cpp 13
\sa qMax(), qBound()
*/
@@ -800,7 +784,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 14
+ \snippet code/src_corelib_global_qglobal.cpp 14
\sa qMin(), qBound()
*/
@@ -813,7 +797,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 15
+ \snippet code/src_corelib_global_qglobal.cpp 15
\sa qMin(), qMax()
*/
@@ -843,7 +827,7 @@ QT_BEGIN_NAMESPACE
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 16
+ \snippet code/src_corelib_global_qglobal.cpp 16
\sa QT_VERSION_STR, qVersion()
*/
@@ -1602,7 +1586,7 @@ static const unsigned int qt_one = 1;
const int QSysInfo::ByteOrder = ((*((unsigned char *) &qt_one) == 0) ? BigEndian : LittleEndian);
#endif
-#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
QT_BEGIN_INCLUDE_NAMESPACE
#include "private/qcore_mac_p.h"
@@ -1624,13 +1608,13 @@ Q_CORE_EXPORT void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding e
Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) {
return QCFString(CFStringCreateWithPascalString(0, pstr, CFStringGetSystemEncoding()));
}
-#endif // defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES)
+#endif // defined(Q_OS_MAC) && !defined(Q_OS_IOS)
#if defined(Q_OS_MAC)
QSysInfo::MacVersion QSysInfo::macVersion()
{
-#ifndef QT_NO_CORESERVICES
+#ifndef Q_OS_IOS
SInt32 gestalt_version;
if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
@@ -1769,12 +1753,12 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 17
+ \snippet code/src_corelib_global_qglobal.cpp 17
If \c b is zero, the Q_ASSERT statement will output the following
message using the qFatal() function:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 18
+ \snippet code/src_corelib_global_qglobal.cpp 18
\sa Q_ASSERT_X(), qFatal(), {Debugging Techniques}
*/
@@ -1792,12 +1776,12 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 19
+ \snippet code/src_corelib_global_qglobal.cpp 19
If \c b is zero, the Q_ASSERT_X statement will output the following
message using the qFatal() function:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 20
+ \snippet code/src_corelib_global_qglobal.cpp 20
\sa Q_ASSERT(), qFatal(), {Debugging Techniques}
*/
@@ -1812,7 +1796,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
conditions that it would not otherwise know about. However, there is no
guarantee that the compiler will actually use those hints.
- This macro could be considered a "lighter" version of \ref Q_ASSERT. While
+ This macro could be considered a "lighter" version of \l{Q_ASSERT}. While
Q_ASSERT will abort the program's execution if the condition is false,
Q_ASSUME will tell the compiler not to generate code for those conditions.
Therefore, it is important that the assumptions always hold, otherwise
@@ -1841,11 +1825,11 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
This macro is useful to mark impossible conditions. For example, given the
following enum:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qunreachable-enum
+ \snippet code/src_corelib_global_qglobal.cpp qunreachable-enum
One can write a switch table like so:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qunreachable-switch
+ \snippet code/src_corelib_global_qglobal.cpp qunreachable-switch
The advantage of inserting Q_UNREACHABLE() at that point is that the
compiler is told not to generate code for a shape variable containing that
@@ -1872,7 +1856,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 21
+ \snippet code/src_corelib_global_qglobal.cpp 21
\sa qWarning(), {Debugging Techniques}
*/
@@ -1896,7 +1880,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
Q_FUNC_INFO can be conveniently used with qDebug(). For example, this function:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 22
+ \snippet code/src_corelib_global_qglobal.cpp 22
when instantiated with the integer type, will with the GCC compiler produce:
@@ -2217,14 +2201,14 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 31
+ \snippet code/src_corelib_global_qglobal.cpp 31
It is equivalent to \c{for (;;)}.
If you're worried about namespace pollution, you can disable this
macro by adding the following line to your \c .pro file:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 32
+ \snippet code/src_corelib_global_qglobal.cpp 32
\sa Q_FOREVER
*/
@@ -2254,7 +2238,7 @@ int qrand()
If you're worried about namespace pollution, you can disable this
macro by adding the following line to your \c .pro file:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 33
+ \snippet code/src_corelib_global_qglobal.cpp 33
\sa Q_FOREACH()
*/
@@ -2283,7 +2267,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 34
+ \snippet code/src_corelib_global_qglobal.cpp 34
The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate
that the source string is encoded in UTF-8. Corresponding variants
@@ -2305,7 +2289,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 35
+ \snippet code/src_corelib_global_qglobal.cpp 35
\sa QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), {Internationalization with Qt}
*/
@@ -2326,7 +2310,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 36
+ \snippet code/src_corelib_global_qglobal.cpp 36
\sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), {Internationalization with Qt}
*/
@@ -2354,11 +2338,11 @@ int qrand()
or
- \tt{\begincomment% <C string> \endcomment}
+ \tt{\\begincomment% <C string> \\endcomment}
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid
+ \snippet code/src_corelib_global_qglobal.cpp qttrid
Creating QM files suitable for use with this function requires passing
the \c -idbased option to the \c lrelease tool.
@@ -2385,7 +2369,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qttrid_noop
+ \snippet code/src_corelib_global_qglobal.cpp qttrid_noop
\sa qtTrId(), {Internationalization with Qt}
*/
@@ -2402,7 +2386,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qlikely
+ \snippet code/src_corelib_global_qglobal.cpp qlikely
\sa Q_UNLIKELY()
*/
@@ -2419,7 +2403,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp qunlikely
+ \snippet code/src_corelib_global_qglobal.cpp qunlikely
\sa Q_LIKELY()
*/
@@ -2496,7 +2480,7 @@ int qrand()
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 37
+ \snippet code/src_corelib_global_qglobal.cpp 37
\sa qDebug(), qWarning(), qCritical(), qFatal()
@@ -2528,7 +2512,7 @@ int qrand()
Example of a "primitive" type:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 38
+ \snippet code/src_corelib_global_qglobal.cpp 38
An example of a non-POD "primitive" type is QUuid: Even though
QUuid has constructors (and therefore isn't POD), every bit
@@ -2537,7 +2521,7 @@ int qrand()
Example of a movable type:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 39
+ \snippet code/src_corelib_global_qglobal.cpp 39
*/
/*!
@@ -2607,7 +2591,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Use this macro as in the following examples.
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 40
+ \snippet code/src_corelib_global_qglobal.cpp 40
\sa Q_BIG_ENDIAN, Q_LITTLE_ENDIAN
*/
@@ -2622,7 +2606,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
lowest address. The other bytes follow in increasing order of
significance.
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 41
+ \snippet code/src_corelib_global_qglobal.cpp 41
\sa Q_BYTE_ORDER, Q_BIG_ENDIAN
*/
@@ -2637,7 +2621,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
lowest address. The other bytes follow in decreasing order of
significance.
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 42
+ \snippet code/src_corelib_global_qglobal.cpp 42
\sa Q_BYTE_ORDER, Q_LITTLE_ENDIAN
*/
@@ -2720,7 +2704,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
This macro expands to
- \snippet snippets/code/src_corelib_global_qglobal.cpp begin namespace macro
+ \snippet code/src_corelib_global_qglobal.cpp begin namespace macro
if \c QT_NAMESPACE is defined and nothing otherwise. If should always
appear in the file-level scope and be followed by \c QT_END_NAMESPACE
@@ -2754,7 +2738,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
This macro expands to
- \snippet snippets/code/src_corelib_global_qglobal.cpp end namespace macro
+ \snippet code/src_corelib_global_qglobal.cpp end namespace macro
if \c QT_NAMESPACE is defined and nothing otherwise. It is used to cancel
the effect of \c QT_BEGIN_NAMESPACE.
@@ -2821,7 +2805,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Note that comparing values where either \a p1 or \a p2 is 0.0 will not work.
The solution to this is to compare against values greater than or equal to 1.0.
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 46
+ \snippet code/src_corelib_global_qglobal.cpp 46
The two numbers are compared in a relative way, where the
exactness is stronger the smaller the numbers are.
@@ -2856,7 +2840,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Example:
- \snippet doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp 4
+ \snippet code/src_gui_dialogs_qmessagebox.cpp 4
*/
/*!
@@ -2908,12 +2892,12 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 24
+ \snippet code/src_corelib_global_qglobal.cpp 24
If you include \c <QtDebug>, a more convenient syntax is also
available:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 25
+ \snippet code/src_corelib_global_qglobal.cpp 25
With this syntax, the function returns a QDebug object that is
configured to use the QtDebugMsg message type. It automatically
@@ -2943,12 +2927,12 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
string.
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 26
+ \snippet code/src_corelib_global_qglobal.cpp 26
If you include <QtDebug>, a more convenient syntax is
also available:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 27
+ \snippet code/src_corelib_global_qglobal.cpp 27
This syntax inserts a space between each item, and
appends a newline at the end.
@@ -2973,12 +2957,12 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
string.
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 28
+ \snippet code/src_corelib_global_qglobal.cpp 28
If you include <QtDebug>, a more convenient syntax is
also available:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 29
+ \snippet code/src_corelib_global_qglobal.cpp 29
A space is inserted between the items, and a newline is
appended at the end.
@@ -3007,7 +2991,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
similar to the C printf() function.
Example:
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 30
+ \snippet code/src_corelib_global_qglobal.cpp 30
To suppress the output at runtime, install your own message handler
with qInstallMessageHandler().
@@ -3016,110 +3000,4 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
{Debugging Techniques}
*/
-/*!
- \typedef QtMsgHandler
- \relates <QtGlobal>
- \deprecated
-
- This is a typedef for a pointer to a function with the following
- signature:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
-
- This typedef is deprecated, you should use QtMessageHandler instead.
- \sa QtMsgType, QtMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
-*/
-
-/*!
- \typedef QtMessageHandler
- \relates <QtGlobal>
- \since 5.0
-
- This is a typedef for a pointer to a function with the following
- signature:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
-
- \sa QtMsgType, qInstallMessageHandler()
-*/
-
-/*!
- \fn QtMessageHandler qInstallMessageHandler(QtMessageHandler handler)
- \relates <QtGlobal>
- \since 5.0
-
- Installs a Qt message \a handler which has been defined
- previously. Returns a pointer to the previous message handler
- (which may be 0).
-
- The message handler is a function that prints out debug messages,
- warnings, critical and fatal error messages. The Qt library (debug
- mode) contains hundreds of warning messages that are printed
- when internal errors (usually invalid function arguments)
- occur. Qt built in release mode also contains such warnings unless
- QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during
- compilation. If you implement your own message handler, you get total
- control of these messages.
-
- The default message handler prints the message to the standard
- output under X11 or to the debugger under Windows. If it is a
- fatal message, the application aborts immediately.
-
- Only one message handler can be defined, since this is usually
- done on an application-wide basis to control debug output.
-
- To restore the message handler, call \c qInstallMessageHandler(0).
-
- Example:
-
- \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
-
- \sa QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
- {Debugging Techniques}
-*/
-
-/*!
- \fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
- \relates <QtGlobal>
- \deprecated
-
- Installs a Qt message \a handler which has been defined
- previously. This method is deprecated, use qInstallMessageHandler
- instead.
- \sa QtMsgHandler, qInstallMessageHandler
-*/
-/*!
- \fn void qSetMessagePattern(const QString &pattern)
- \relates <QtGlobal>
- \since 5.0
-
- \brief Changes the output of the default message handler.
-
- Allows to tweak the output of qDebug(), qWarning(), qCritical() and qFatal().
-
- Following placeholders are supported:
-
- \table
- \header \li Placeholder \li Description
- \row \li \c %{appname} \li QCoreApplication::applicationName()
- \row \li \c %{file} \li Path to source file
- \row \li \c %{function} \li Function
- \row \li \c %{line} \li Line in source file
- \row \li \c %{message} \li The actual message
- \row \li \c %{pid} \li QCoreApplication::applicationPid()
- \row \li \c %{threadid} \li ID of current thread
- \row \li \c %{type} \li "debug", "warning", "critical" or "fatal"
- \endtable
-
- The default pattern is "%{message}".
-
- The pattern can also be changed at runtime by setting the QT_MESSAGE_PATTERN
- environment variable; if both qSetMessagePattern() is called and QT_MESSAGE_PATTERN is
- set, the environment variable takes precedence.
-
- qSetMessagePattern() has no effect if a custom message handler is installed.
-
- \sa qInstallMessageHandler, Debugging Techniques
- */
-
QT_END_NAMESPACE
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 0828a3dac3..a8547a3ab8 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -62,6 +62,10 @@
#include <QtCore/qconfig.h>
#endif
+/* 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)
#include <QtCore/qsystemdetection.h>
#include <QtCore/qcompilerdetection.h>
@@ -150,28 +154,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 +176,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 +314,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,46 +383,10 @@ 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)
-# if defined(Q_CC_MINGW)
+# if defined(Q_CC_MINGW) && !defined(Q_OS_WIN64)
# define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer))
# else
# define QT_ENSURE_STACK_ALIGNED_FOR_SSE
@@ -561,35 +460,6 @@ class QDataStream;
#define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
-#if defined(Q_OS_LINUX) && defined(Q_CC_RVCT)
-# define Q_DECL_EXPORT __attribute__((visibility("default")))
-# define Q_DECL_IMPORT __attribute__((visibility("default")))
-# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
-#endif
-
-#ifndef Q_DECL_EXPORT
-# if defined(Q_OS_WIN) || defined(Q_CC_RVCT)
-# define Q_DECL_EXPORT __declspec(dllexport)
-# elif defined(QT_VISIBILITY_AVAILABLE)
-# define Q_DECL_EXPORT __attribute__((visibility("default")))
-# define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
-# endif
-# ifndef Q_DECL_EXPORT
-# define Q_DECL_EXPORT
-# endif
-#endif
-#ifndef Q_DECL_IMPORT
-# if defined(Q_OS_WIN) || defined(Q_CC_RVCT)
-# define Q_DECL_IMPORT __declspec(dllimport)
-# else
-# define Q_DECL_IMPORT
-# endif
-#endif
-#ifndef Q_DECL_HIDDEN
-# define Q_DECL_HIDDEN
-#endif
-
-
/*
Create Qt DLL if QT_DLL is defined (Windows only)
*/
@@ -764,58 +634,6 @@ class QDataStream;
# endif
#endif
-// Functions marked as Q_GUI_EXPORT_INLINE were exported and inlined by mistake.
-// Compilers like MinGW complain that the import attribute is ignored.
-#if defined(Q_CC_MINGW)
-# if defined(QT_BUILD_CORE_LIB)
-# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline
-# else
-# define Q_CORE_EXPORT_INLINE inline
-# endif
-# if defined(QT_BUILD_GUI_LIB)
-# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline
-# else
-# define Q_GUI_EXPORT_INLINE inline
-# endif
-# if defined(QT_BUILD_WIDGETS_LIB)
-# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline
-# else
-# define Q_WIDGETS_EXPORT_INLINE inline
-# endif
-# if defined(QT_BUILD_PLATFORMSUPPORT_LIB)
-# define Q_PLATFORMSUPPORT_EXPORT_INLINE Q_PLATFORMSUPPORT_EXPORT inline
-# else
-# define Q_PLATFORMSUPPORT_EXPORT_INLINE inline
-# endif
-# if defined(QT_BUILD_PRINTSUPPORT_LIB)
-# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline
-# else
-# define Q_PRINTSUPPORT_EXPORT_INLINE inline
-# endif
-# if defined(QT_BUILD_COMPAT_LIB)
-# define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline
-# else
-# define Q_COMPAT_EXPORT_INLINE inline
-# endif
-#elif defined(Q_CC_RVCT)
-// we force RVCT not to export inlines by passing --visibility_inlines_hidden
-// so we need to just inline it, rather than exporting and inlining
-// note: this affects the contents of the DEF files (ie. these functions do not appear)
-# define Q_CORE_EXPORT_INLINE inline
-# define Q_GUI_EXPORT_INLINE inline
-# define Q_WIDGETS_EXPORT_INLINE inline
-# define Q_PLATFORMSUPPORT_EXPORT_INLINE inline
-# define Q_PRINTSUPPORT_EXPORT_INLINE inline
-# define Q_COMPAT_EXPORT_INLINE inline
-#else
-# define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline
-# define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline
-# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline
-# define Q_PLATFORMSUPPORT_EXPORT_INLINE Q_PLATFORMSUPPORT_EXPORT inline
-# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline
-# define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline
-#endif
-
/*
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
@@ -896,6 +714,10 @@ inline void qUnused(T &x) { (void)x; }
class QString;
Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
+
+#ifndef Q_CC_MSVC
+Q_NORETURN
+#endif
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
#if !defined(Q_ASSERT)
@@ -910,6 +732,9 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
#define QT_NO_PAINT_DEBUG
#endif
+#ifndef Q_CC_MSVC
+Q_NORETURN
+#endif
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line);
#if !defined(Q_ASSERT_X)
@@ -952,29 +777,6 @@ Q_CORE_EXPORT void qBadAlloc();
template <typename T>
inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; }
-#if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB)
-# define Q_FUNC_INFO __PRETTY_FUNCTION__
-#elif defined(_MSC_VER)
-# define Q_FUNC_INFO __FUNCSIG__
-#else
-# if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)
-# define Q_FUNC_INFO __FILE__ "(line number unavailable)"
-# else
- /* 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)
-# define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__)
-# endif
- /* The MIPSpro and RVCT compilers postpones macro expansion,
- and therefore macros must be in scope when being used. */
-# if !defined(Q_CC_MIPS) && !defined(Q_CC_RVCT)
-# undef QT_STRINGIFY2
-# undef QT_STRINGIFY
-# endif
-#endif
-
-
typedef void (*QFunctionPointer)();
#if !defined(Q_UNIMPLEMENTED)
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 8726c18689..52ffae5f98 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
One example of direct use is to forward errors that stem from a scripting language, e.g. QML:
- \snippet doc/src/snippets/code/qlogging/qloggingsnippet.cpp 1
+ \snippet code/qlogging/qlogging.cpp 1
\sa QMessageLogContext, qDebug(), qWarning(), qCritical(), qFatal()
*/
@@ -159,7 +159,6 @@ static void qt_message(QtMsgType msgType, const QMessageLogContext &context, con
}
#undef qDebug
-
void QMessageLogger::debug(const char *msg, ...)
{
va_list ap;
@@ -205,7 +204,6 @@ QDebug QMessageLogger::warning()
#endif
#undef qCritical
-
void QMessageLogger::critical(const char *msg, ...)
{
va_list ap;
@@ -225,12 +223,14 @@ QDebug QMessageLogger::critical()
#endif
#undef qFatal
-
void QMessageLogger::fatal(const char *msg, ...)
{
va_list ap;
va_start(ap, msg); // use variable arg list
qt_message(QtFatalMsg, context, msg, ap);
+#ifndef Q_CC_MSVC
+ Q_UNREACHABLE();
+#endif
va_end(ap);
}
@@ -729,6 +729,112 @@ void qWinMessageHandler2(QtMsgType t, const QMessageLogContext &context,
}
#endif
+/*!
+ \typedef QtMsgHandler
+ \relates <QtGlobal>
+ \deprecated
+
+ This is a typedef for a pointer to a function with the following
+ signature:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 7
+
+ This typedef is deprecated, you should use QtMessageHandler instead.
+ \sa QtMsgType, QtMessageHandler, qInstallMsgHandler(), qInstallMessageHandler()
+*/
+
+/*!
+ \typedef QtMessageHandler
+ \relates <QtGlobal>
+ \since 5.0
+
+ This is a typedef for a pointer to a function with the following
+ signature:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 49
+
+ \sa QtMsgType, qInstallMessageHandler()
+*/
+
+/*!
+ \fn QtMessageHandler qInstallMessageHandler(QtMessageHandler handler)
+ \relates <QtGlobal>
+ \since 5.0
+
+ Installs a Qt message \a handler which has been defined
+ previously. Returns a pointer to the previous message handler
+ (which may be 0).
+
+ The message handler is a function that prints out debug messages,
+ warnings, critical and fatal error messages. The Qt library (debug
+ mode) contains hundreds of warning messages that are printed
+ when internal errors (usually invalid function arguments)
+ occur. Qt built in release mode also contains such warnings unless
+ QT_NO_WARNING_OUTPUT and/or QT_NO_DEBUG_OUTPUT have been set during
+ compilation. If you implement your own message handler, you get total
+ control of these messages.
+
+ The default message handler prints the message to the standard
+ output under X11 or to the debugger under Windows. If it is a
+ fatal message, the application aborts immediately.
+
+ Only one message handler can be defined, since this is usually
+ done on an application-wide basis to control debug output.
+
+ To restore the message handler, call \c qInstallMessageHandler(0).
+
+ Example:
+
+ \snippet doc/src/snippets/code/src_corelib_global_qglobal.cpp 23
+
+ \sa QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(),
+ {Debugging Techniques}
+*/
+
+/*!
+ \fn QtMsgHandler qInstallMsgHandler(QtMsgHandler handler)
+ \relates <QtGlobal>
+ \deprecated
+
+ Installs a Qt message \a handler which has been defined
+ previously. This method is deprecated, use qInstallMessageHandler
+ instead.
+ \sa QtMsgHandler, qInstallMessageHandler
+*/
+/*!
+ \fn void qSetMessagePattern(const QString &pattern)
+ \relates <QtGlobal>
+ \since 5.0
+
+ \brief Changes the output of the default message handler.
+
+ Allows to tweak the output of qDebug(), qWarning(), qCritical() and qFatal().
+
+ Following placeholders are supported:
+
+ \table
+ \header \li Placeholder \li Description
+ \row \li \c %{appname} \li QCoreApplication::applicationName()
+ \row \li \c %{file} \li Path to source file
+ \row \li \c %{function} \li Function
+ \row \li \c %{line} \li Line in source file
+ \row \li \c %{message} \li The actual message
+ \row \li \c %{pid} \li QCoreApplication::applicationPid()
+ \row \li \c %{threadid} \li ID of current thread
+ \row \li \c %{type} \li "debug", "warning", "critical" or "fatal"
+ \endtable
+
+ The default pattern is "%{message}".
+
+ The pattern can also be changed at runtime by setting the QT_MESSAGE_PATTERN
+ environment variable; if both qSetMessagePattern() is called and QT_MESSAGE_PATTERN is
+ set, the environment variable takes precedence.
+
+ qSetMessagePattern() has no effect if a custom message handler is installed.
+
+ \sa qInstallMessageHandler, Debugging Techniques
+ */
+
QtMessageHandler qInstallMessageHandler(QtMessageHandler h)
{
if (!messageHandler)
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index ae388b0a38..8366a852ab 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -113,6 +113,10 @@ public:
__attribute__ ((format (printf, 2, 3)))
#endif
;
+
+#ifndef Q_CC_MSVC
+ Q_NORETURN
+#endif
void fatal(const char *msg, ...)
#if defined(Q_CC_GNU) && !defined(__INSURE__)
__attribute__ ((format (printf, 2, 3)))
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index c238e9a5f3..50f43e3c78 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -155,12 +155,12 @@ public:
RightButton = 0x00000002,
MidButton = 0x00000004, // ### Qt 6: remove me
MiddleButton = MidButton,
- XButton1 = 0x00000008,
- BackButton = XButton1,
+ BackButton = 0x00000008,
+ XButton1 = BackButton,
ExtraButton1 = XButton1,
- XButton2 = 0x00000010,
- ForwardButton = XButton2,
- ExtraButton2 = XButton2,
+ ForwardButton = 0x00000010,
+ XButton2 = ForwardButton,
+ ExtraButton2 = ForwardButton,
TaskButton = 0x00000020,
ExtraButton3 = TaskButton,
ExtraButton4 = 0x00000040,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 881b55037d..a613eff6b2 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -219,7 +219,7 @@
\value ExtraButton21 The 24th non-wheel Mouse Button.
\value ExtraButton22 The 25th non-wheel Mouse Button.
\value ExtraButton23 The 26th non-wheel Mouse Button.
- \value ExtraButton44 The 27th non-wheel Mouse Button.
+ \value ExtraButton24 The 27th non-wheel Mouse Button.
\omitvalue MaxMouseButton
\omitvalue MouseButtonMask
@@ -230,7 +230,7 @@
actual 'Mouse Buttons', the device must be re-configured (using
the vendor's configuration tool).
- \sa KeyboardModifier Modifier
+ \sa KeyboardModifier, Modifier
*/
/*!
@@ -257,7 +257,7 @@
\note On Windows Keyboards, Qt::MetaModifier and Qt::Key_Meta are mapped
to the Windows key.
- \sa MouseButton Modifier
+ \sa MouseButton, Modifier
*/
/*!
@@ -278,7 +278,7 @@
point, not as a Qt Key.
\omitvalue MODIFIER_MASK
- \sa KeyboardModifier MouseButton
+ \sa KeyboardModifier, MouseButton
*/
/*!
@@ -542,7 +542,7 @@
arguments to store them in an event behind the scenes. If you try
to use a queued connection and get the error message:
- \snippet doc/src/snippets/code/doc_src_qnamespace.qdoc 0
+ \snippet code/doc_src_qnamespace.qdoc 0
Call qRegisterMetaType() to register the data type before you
establish the connection.
@@ -1981,8 +1981,6 @@
system supports it, a tool window can be decorated
with a somewhat lighter frame. It can also be
combined with Qt::FramelessWindowHint.
- \br
- \br
On Mac OS X, tool windows correspond to the
\l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating}
class of windows. This means that the window lives on a
@@ -2174,9 +2172,7 @@
should be taken over by the target application,
i.e., the source application should not delete
the data.
- \br
On X11 this value is used to do a move.
- \br
TargetMoveAction is not used on the Mac.
*/
@@ -2643,7 +2639,7 @@
for other strings (e.g.,
"\l{http://qt.nokia.com/doc/qq/qq09-mac-deployment.html}{Deploying Applications on Ma...}").
- \sa QAbstractItemView::textElideMode, QFontMetrics::elidedText(), AlignmentFlag QTabBar::elideMode
+ \sa QAbstractItemView::textElideMode, QFontMetrics::elidedText(), AlignmentFlag, QTabBar::elideMode
*/
/*!
@@ -2721,7 +2717,7 @@
INT_MIN, inclusive. For example, you can define custom priorities
as being relative to each other:
- \snippet doc/src/snippets/code/doc_src_qnamespace.cpp 1
+ \snippet code/doc_src_qnamespace.cpp 1
\sa QCoreApplication::postEvent()
*/
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 04e0f19f06..109545c10e 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -39,6 +39,10 @@
**
****************************************************************************/
+#ifndef QGLOBAL_H
+# include <QtCore/qglobal.h>
+#endif
+
#ifndef QPROCESSORDETECTION_H
#define QPROCESSORDETECTION_H
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index db5775d021..94ff42a789 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -39,6 +39,10 @@
**
****************************************************************************/
+#ifndef QGLOBAL_H
+# include <QtCore/qglobal.h>
+#endif
+
#ifndef QSYSTEMDETECTION_H
#define QSYSTEMDETECTION_H