From 8172fe46472614d4ecf6fce03ae5c5f706820cd7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 22 Jan 2015 08:24:34 -0800 Subject: Correct the version of ICC that has the constexpr bug fixed 01fc82e3574614762d2ce061dd45ce4995c79e7f updated the code for ICC 15, but it needs to be 15.0.1 Change-Id: Iba8d819ab9174d9dac07ffff13bbc26b9be46d53 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 3f813e163b..7be4ed8bef 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -557,7 +557,10 @@ # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 -# define Q_COMPILER_CONSTEXPR +# if __INTEL_COMPILER * 100 + __INTEL_COMPILER_UPDATE >= 150001 +// the bug mentioned above is fixed in 15.0.1 +# define Q_COMPILER_CONSTEXPR +# endif # define Q_COMPILER_ALIGNAS # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS -- cgit v1.2.3 From 5f6bbce4beb32bc6bc1e06f92cde56c48f946558 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 26 Jan 2015 15:21:12 +0100 Subject: Fix memory leak in qSetMessagePattern We were leaking memory in case setPattern was called multiple times Task-number: QTBUG-43893 Change-Id: Icd9c214edea064aeaeb6f92a9c62836238ccd344 Reviewed-by: Marc Mutz --- src/corelib/global/qlogging.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 50d35a6d84..86ba082398 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -866,7 +866,7 @@ QMessagePattern::QMessagePattern() QMessagePattern::~QMessagePattern() { - for (int i = 0; literals[i] != 0; ++i) + for (int i = 0; literals[i]; ++i) delete [] literals[i]; delete [] literals; literals = 0; @@ -876,8 +876,12 @@ QMessagePattern::~QMessagePattern() void QMessagePattern::setPattern(const QString &pattern) { + if (literals) { + for (int i = 0; literals[i]; ++i) + delete [] literals[i]; + delete [] literals; + } delete [] tokens; - delete [] literals; // scanner QList lexemes; -- cgit v1.2.3 From 447ff9a9f32826654f9df9020610c767cb8c9b15 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 11:02:28 -0800 Subject: Fix compilation with Apple Clang 425 This version was based on Clang mainline between releases 3.1 and 3.2, which means it has part of 3.2 features but not all. One of the missing features is __builtin_bswap16. Cherry-picked from ec9bc843d8a5c18459f3669c6e22acac2077df67 on 5.4 Change-Id: Ic5d393bfd36e48a193fcffff13b95664c7f664de Reviewed-by: Thiago Macieira Reviewed-by: Shawn Rutledge --- src/corelib/global/qendian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 7c643f7592..0e383c18d2 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian(const uchar *src) */ template T qbswap(T source); +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif + // GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8; // Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32) template <> inline quint64 qbswap(quint64 source) { return __builtin_bswap64(source); @@ -306,7 +312,7 @@ template <> inline quint32 qbswap(quint32 source) | ((source & 0xff000000) >> 24); } #endif // GCC & Clang intrinsics -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16) template <> inline quint16 qbswap(quint16 source) { return __builtin_bswap16(source); @@ -320,6 +326,8 @@ template <> inline quint16 qbswap(quint16 source) } #endif // GCC & Clang intrinsics +#undef QT_HAS_BUILTIN + // signed specializations template <> inline qint64 qbswap(qint64 source) { -- cgit v1.2.3 From 51ba25e0fc89882e5021bed718de91d58f7f3907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Wed, 24 Dec 2014 17:29:11 +0200 Subject: logging: Check if uClibc has backtrace support execinfo.h is optional in uClibc. We need to check __UCLIBC_HAS_BACKTRACE__ if uClibc is used. Change-Id: Ie28be85b0b70472df1fc4a208581bb66ad34229e Reviewed-by: Kai Koehne Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 50d35a6d84..fa897d6d32 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -77,14 +77,21 @@ #endif #if !defined QT_NO_REGULAREXPRESSION && !defined(QT_BOOTSTRAPPED) -# if (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include() && __has_include()) +# ifdef __UCLIBC__ +# if __UCLIBC_HAS_BACKTRACE__ +# define QLOGGING_HAVE_BACKTRACE +# endif +# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include() && __has_include()) # define QLOGGING_HAVE_BACKTRACE -# include -# include -# include # endif #endif +#ifdef QLOGGING_HAVE_BACKTRACE +# include +# include +# include +#endif + #include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 2be0d3088fc5bc52ece6b28157b28d16699ccb9b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 18 Jan 2015 14:56:21 +0100 Subject: qFormatLogMessage: optimize %{backtrace} backtrace_symbols is very slow because it tries to find the function name from the address. In order to do that it needs to do a linear search over all symbols. (Because the hash table goes the other way to find the address from the symbol name) The code is going to skip a few frames from QtCore. Since we cannot know how many, we take a few more than necessary. This patch changes the additional number of frames from 15 to 7 (Usually, there are about 5 suppressed frames). We call backtrace_symbols several times for only one frame at the time. So we are not looking up addresses we don't need after we printed the right number of frames. Calling many times backtrace_symbols means we do more malloc, but that's negligible compared to the time we save. We anyway do a lot of other allocations because of the regexp operations and such So this patch is then saving about 10 frames lookups which allow to print about 6 qDebug per miliseconds instead of only 2 when using %{backtrace depth=2} Change-Id: Ic6ece2145d53dc570c80fcb0e4455dcef6bc40cb Reviewed-by: Kai Koehne --- src/corelib/global/qlogging.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 18b672d7ee..5f11334a82 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1154,13 +1154,13 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con message.append(QString::number(qlonglong(QThread::currentThread()->currentThread()), 16)); #ifdef QLOGGING_HAVE_BACKTRACE } else if (token == backtraceTokenC) { - QVarLengthArray buffer(15 + pattern->backtraceDepth); + QVarLengthArray buffer(7 + pattern->backtraceDepth); int n = backtrace(buffer.data(), buffer.size()); if (n > 0) { - QScopedPointer strings(backtrace_symbols(buffer.data(), n)); int numberPrinted = 0; for (int i = 0; i < n && numberPrinted < pattern->backtraceDepth; ++i) { - QString trace = QString::fromLatin1(strings.data()[i]); + QScopedPointer strings(backtrace_symbols(buffer.data() + i, 1)); + QString trace = QString::fromLatin1(strings.data()[0]); // The results of backtrace_symbols looks like this: // /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413] // The offset and function name are optional. -- cgit v1.2.3 From 732c99487682f0be0b201deb1adf697f6d323b00 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 17 Feb 2015 11:56:46 +0100 Subject: work around MSVC level 4 warning Change-Id: Ide3541a8a1a16a1f9b6b01f54d5b2f6ab178c3ac Task-number: QTBUG-7233 Reviewed-by: hjk --- src/corelib/global/qglobal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index dade7fc6ec..455582e310 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -865,6 +865,7 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr); /* make use of decltype or GCC's __typeof__ extension */ template class QForeachContainer { + QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE; public: inline QForeachContainer(const T& t) : c(t), i(c.begin()), e(c.end()), control(1) { } const T c; -- cgit v1.2.3 From 1afe110b8fe6da51ec23736fa3a105013255f904 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 21 Jan 2015 15:42:19 +0100 Subject: Doc: corrected link/autolink issues in corelib Task-number: QTBUG-43115 Change-Id: I31da92e3a7c4dd7b75ee283dbfecd77e284978ca Reviewed-by: Martin Smith --- src/corelib/global/qnamespace.qdoc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 9e9a357272..24de2541b8 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -498,7 +498,7 @@ \value TextExpandTabs Makes the U+0009 (ASCII tab) character move to the next tab stop. \value TextShowMnemonic Displays the string "\&P" as \underline{P} - (see QButton for an example). For an ampersand, use "\&\&". + For an ampersand, use "\&\&". \value TextWordWrap Breaks lines at appropriate points, e.g. at word boundaries. \value TextWrapAnywhere Breaks lines anywhere, even within words. @@ -902,8 +902,7 @@ on QWidget::contentsRect(). This is set by the widget's author. \value WA_LayoutUsesWidgetRect Ignore the layout item rect from the style - when laying out this widget with QLayout. This makes a difference in - QMacStyle and QPlastiqueStyle for some widgets. + when laying out this widget with QLayout. \value WA_MacNoClickThrough When a widget that has this attribute set is clicked, and its window is inactive, the click will make the window @@ -1162,7 +1161,7 @@ _NET_WM_WINDOW_TYPE X11 window property. See http://standards.freedesktop.org/wm-spec/ for more details. This attribute has no effect on non-X11 platforms. \b Note: Qt - automatically sets this attribute for QMenus added to a QMenuBar. + automatically sets this attribute for QMenu objects added to a QMenuBar. \value WA_X11NetWmWindowTypePopupMenu Adds _NET_WM_WINDOW_TYPE_POPUP_MENU to the window's _NET_WM_WINDOW_TYPE X11 window property. See -- cgit v1.2.3