summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/global.pri23
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/corelib/global/qrandom.cpp8
-rw-r--r--src/corelib/global/qrandom.h12
-rw-r--r--src/corelib/global/qt_windows.h4
5 files changed, 32 insertions, 19 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 78b37755a4..7c31df4d6a 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -99,16 +99,13 @@ gcc:ltcg {
SOURCES += $$VERSIONTAGGING_SOURCES
}
-# On AARCH64 the fp16 extension is mandatory, so we don't need the conversion tables.
-!contains(QT_ARCH, "arm64") {
- QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h
-
- qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables)
-
- qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT}
- qfloat16_tables.output = global/qfloat16tables.cpp
- qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES
- qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE
- qfloat16_tables.variable_out = SOURCES
- QMAKE_EXTRA_COMPILERS += qfloat16_tables
-}
+QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h
+
+qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables)
+
+qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT}
+qfloat16_tables.output = global/qfloat16tables.cpp
+qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES
+qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE
+qfloat16_tables.variable_out = SOURCES
+QMAKE_EXTRA_COMPILERS += qfloat16_tables
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index f2f807e1d9..36b7560398 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -4296,6 +4296,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qDebug(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
Calls the message handler with the debug message \a message. If no
message handler has been installed, the message is printed to
@@ -4332,6 +4333,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qInfo(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
\since 5.5
Calls the message handler with the informational message \a message. If no
@@ -4369,6 +4371,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qWarning(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
Calls the message handler with the warning message \a message. If no
message handler has been installed, the message is printed to
@@ -4406,6 +4409,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
/*!
\macro qCritical(const char *message, ...)
\relates <QtGlobal>
+ \threadsafe
Calls the message handler with the critical message \a message. If no
message handler has been installed, the message is printed to
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index d77ec8075a..9abb9ece7f 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -154,15 +154,19 @@ class SystemRandom
{
static QBasicAtomicInt s_fdp1; // "file descriptor plus 1"
static int openDevice();
+#ifdef Q_CC_GNU
+ // If it's not GCC or GCC-like, then we'll leak the file descriptor
+ __attribute__((destructor))
+#endif
+ static void closeDevice();
SystemRandom() {}
- ~SystemRandom();
public:
enum { EfficientBufferFill = true };
static qssize_t fillBuffer(void *buffer, qssize_t count);
};
QBasicAtomicInt SystemRandom::s_fdp1 = Q_BASIC_ATOMIC_INITIALIZER(0);
-SystemRandom::~SystemRandom()
+void SystemRandom::closeDevice()
{
int fd = s_fdp1.loadAcquire() - 1;
if (fd >= 0)
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 7f96cd6749..2259f2657a 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -62,8 +62,16 @@ public:
static Q_CORE_EXPORT quint64 generate64();
static double generateDouble()
{
- // use get64() to get enough bits
- return double(generate64()) / ((std::numeric_limits<quint64>::max)() + double(1.0));
+ // IEEE 754 double precision has:
+ // 1 bit sign
+ // 10 bits exponent
+ // 53 bits mantissa
+ // In order for our result to be normalized in the range [0, 1), we
+ // need exactly 53 bits of random data. Use generate64() to get enough.
+ quint64 x = generate64();
+ quint64 limit = Q_UINT64_C(1) << std::numeric_limits<double>::digits;
+ x >>= std::numeric_limits<quint64>::digits - std::numeric_limits<double>::digits;
+ return double(x) / double(limit);
}
static qreal bounded(qreal sup)
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index bc48104edc..67ba27f072 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -48,10 +48,10 @@
#if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
# ifndef WINVER
-# define WINVER 0x600
+# define WINVER 0x601
# endif
# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x600
+# define _WIN32_WINNT 0x601
# endif
# ifndef NTDDI_VERSION
# define NTDDI_VERSION 0x06000000