summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-12-29 16:37:38 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-12-29 16:37:38 +0100
commitaaff94c2df665035addb90714bab4722003894da (patch)
tree3af76e8aa4dbf86a86b1e4d2ad2f6dda06374ee0 /src/corelib
parent2302d386c7a1aa1a96658f79c236d6b8a59db7ac (diff)
parent1196f691120d77ab3be55f21824aba645210fb8c (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/corelib/tools/qbytearray.cpp src/gui/kernel/qplatformsystemtrayicon.cpp src/gui/kernel/qplatformsystemtrayicon.h src/plugins/platforms/xcb/xcb-plugin.pro Change-Id: I00355d3908b678af8a61c38f9e814a63df808c79
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CoreMacros.cmake2
-rw-r--r--src/corelib/global/qendian.h26
-rw-r--r--src/corelib/global/qlogging.cpp21
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp7
-rw-r--r--src/corelib/kernel/qmetatype.h2
-rw-r--r--src/corelib/thread/qthread_unix.cpp3
-rw-r--r--src/corelib/tools/qbytearray.cpp11
-rw-r--r--src/corelib/tools/qbytearray.h3
-rw-r--r--src/corelib/tools/qelapsedtimer_unix.cpp17
10 files changed, 45 insertions, 49 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 88710bc55e..9c81754302 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -221,7 +221,7 @@ function(QT5_ADD_RESOURCES outfiles )
# let's make a configured file and add it as a dependency so cmake is run
# again when dependencies need to be recomputed.
qt5_make_output_file("${infile}" "" "qrc.depends" out_depends)
- configure_file("${infile}" "${out_depends}" COPY_ONLY)
+ configure_file("${infile}" "${out_depends}" COPYONLY)
else()
# The .qrc file does not exist (yet). Let's add a dependency and hope
# that it will be generated later
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 136581167c..7c643f7592 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -40,10 +40,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef __GLIBC__
-#include <byteswap.h>
-#endif
-
QT_BEGIN_NAMESPACE
@@ -276,18 +272,16 @@ template <> inline qint8 qFromBigEndian<qint8>(const uchar *src)
*/
template <typename T> T qbswap(T source);
-#ifdef __GLIBC__
+// 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)
template <> inline quint64 qbswap<quint64>(quint64 source)
{
- return bswap_64(source);
+ return __builtin_bswap64(source);
}
template <> inline quint32 qbswap<quint32>(quint32 source)
{
- return bswap_32(source);
-}
-template <> inline quint16 qbswap<quint16>(quint16 source)
-{
- return bswap_16(source);
+ return __builtin_bswap32(source);
}
#else
template <> inline quint64 qbswap<quint64>(quint64 source)
@@ -311,14 +305,20 @@ template <> inline quint32 qbswap<quint32>(quint32 source)
| ((source & 0x00ff0000) >> 8)
| ((source & 0xff000000) >> 24);
}
-
+#endif // GCC & Clang intrinsics
+#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302)
+template <> inline quint16 qbswap<quint16>(quint16 source)
+{
+ return __builtin_bswap16(source);
+}
+#else
template <> inline quint16 qbswap<quint16>(quint16 source)
{
return quint16( 0
| ((source & 0x00ff) << 8)
| ((source & 0xff00) >> 8) );
}
-#endif // __GLIBC__
+#endif // GCC & Clang intrinsics
// signed specializations
template <> inline qint64 qbswap<qint64>(qint64 source)
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 7763a15b3a..c4dacd3411 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -72,20 +72,17 @@
# include "private/qcore_unix_p.h"
#endif
-#if !defined QT_NO_REGULAREXPRESSION && !defined(QT_BOOTSTRAPPED)
-#ifdef __has_include
-#if __has_include(<cxxabi.h>) && __has_include(<execinfo.h>)
-#define QLOGGING_HAVE_BACKTRACE
-#endif
-#elif defined(__GLIBCXX__) && defined(__GLIBC__) // (because older version of gcc don't have __has_include)
-#define QLOGGING_HAVE_BACKTRACE
+#ifndef __has_include
+# define __has_include(x) 0
#endif
-#ifdef QLOGGING_HAVE_BACKTRACE
-#include <qregularexpression.h>
-#include <cxxabi.h>
-#include <execinfo.h>
-#endif
+#if !defined QT_NO_REGULAREXPRESSION && !defined(QT_BOOTSTRAPPED)
+# if (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include(<cxxabi.h>) && __has_include(<execinfo.h>))
+# define QLOGGING_HAVE_BACKTRACE
+# include <qregularexpression.h>
+# include <cxxabi.h>
+# include <execinfo.h>
+# endif
#endif
#include <stdio.h>
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 36f88f2774..d7ce8731c5 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1004,7 +1004,7 @@ QByteArray QIODevice::readAll()
} else {
// Read it all in one go.
// If resize fails, don't read anything.
- if (readBytes + theSize - d->pos > INT_MAX)
+ if (quint64(readBytes + theSize - d->pos) > QByteArray::MaxSize)
return QByteArray();
result.resize(int(readBytes + theSize - d->pos));
readBytes += read(result.data() + readBytes, result.size() - readBytes);
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index bec7420dc7..1af2145296 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -52,17 +52,18 @@
#if defined(Q_OS_BSD4)
# include <sys/mount.h>
+# include <sys/statvfs.h>
#elif defined(Q_OS_ANDROID)
# include <sys/mount.h>
# include <sys/vfs.h>
# include <mntent.h>
-#elif defined(Q_OS_QNX)
-# include <sys/statvfs.h>
#elif defined(Q_OS_LINUX)
# include <mntent.h>
# include <sys/statvfs.h>
#elif defined(Q_OS_SOLARIS)
# include <sys/mnttab.h>
+#else
+# include <sys/statvfs.h>
#endif
#if defined(Q_OS_BSD4)
@@ -118,7 +119,7 @@ public:
inline QByteArray device() const;
private:
#if defined(Q_OS_BSD4)
- statfs *stat_buf;
+ struct statfs *stat_buf;
int entryCount;
int currentIndex;
#elif defined(Q_OS_SOLARIS)
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 040b860a31..0e817da8ce 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -653,7 +653,7 @@ private:
static bool registerDebugStreamOperatorFunction(const QtPrivate::AbstractDebugStreamFunction *f, int type);
#endif
-#ifndef Q_NO_TEMPLATE_FRIENDS
+#if !defined(Q_NO_TEMPLATE_FRIENDS) && !defined(Q_CC_MSVC)
#ifndef Q_QDOC
template<typename T>
friend bool qRegisterSequentialConverter();
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 5df50311ef..9a14503584 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -450,7 +450,8 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
// the rest: Linux, Solaris, AIX, Tru64
cores = (int)sysconf(_SC_NPROCESSORS_ONLN);
#endif
-
+ if (cores == -1)
+ return 1;
return cores;
}
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 92c2188caa..a267dc6f7b 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -123,7 +123,7 @@ int qFindByteArray(
int qAllocMore(int alloc, int extra) Q_DECL_NOTHROW
{
Q_ASSERT(alloc >= 0 && extra >= 0);
- Q_ASSERT_X(alloc <= MaxAllocSize - extra, "qAllocMore", "Requested size is too large!");
+ Q_ASSERT_X(uint(alloc) < QByteArray::MaxSize, "qAllocMore", "Requested size is too large!");
unsigned nalloc = qNextPowerOfTwo(alloc + extra);
@@ -837,6 +837,15 @@ static inline char qToLower(char c)
*/
/*!
+ \variable QByteArray::MaxSize
+ \internal
+ \since 5.4
+
+ The maximum size of a QByteArray, in bytes. Also applies to a the maximum
+ storage size of QString and QVector, though not the number of elements.
+*/
+
+/*!
\enum QByteArray::Base64Option
\since 5.2
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 6976124bca..6286624961 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -173,6 +173,9 @@ private:
typedef QTypedArrayData<char> Data;
public:
+ // undocumented:
+ static const quint64 MaxSize = (1 << 30) - sizeof(Data);
+
enum Base64Option {
Base64Encoding = 0,
Base64UrlEncoding = 1,
diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp
index 61bd7f1f21..922aa487d7 100644
--- a/src/corelib/tools/qelapsedtimer_unix.cpp
+++ b/src/corelib/tools/qelapsedtimer_unix.cpp
@@ -37,10 +37,6 @@
#include "qelapsedtimer.h"
#if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h"
-#elif defined(Q_OS_QNX)
-#include <sys/neutrino.h>
-#include <sys/syspage.h>
-#include <inttypes.h>
#else
#include <sys/time.h>
#include <time.h>
@@ -88,18 +84,7 @@ QT_BEGIN_NAMESPACE
* see http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
*/
-#if defined(Q_OS_QNX)
-static inline void qt_clock_gettime(clockid_t clock, struct timespec *ts)
-{
- // The standard POSIX clock calls only have 1ms accuracy on QNX. To get
- // higher accuracy, this platform-specific function must be used instead
- quint64 cycles_per_sec = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
- quint64 cycles = ClockCycles();
- ts->tv_sec = cycles / cycles_per_sec;
- quint64 mod = cycles % cycles_per_sec;
- ts->tv_nsec = mod * Q_INT64_C(1000000000) / cycles_per_sec;
-}
-#elif !defined(CLOCK_REALTIME)
+#if !defined(CLOCK_REALTIME)
# define CLOCK_REALTIME 0
static inline void qt_clock_gettime(int, struct timespec *ts)
{