summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qiodevice.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-10-18 10:43:22 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2023-10-19 05:45:47 +0000
commit546208f0ff23819d216cbb5bf0b5daded79b454e (patch)
tree6cbe12f111152ca9bd5f55a6a351bd63774e1282 /src/corelib/io/qiodevice.cpp
parent18152699e4c566002ecf958ad655b6f4c6a5c4ed (diff)
QIODevice: mark checkWarnMessage() as Q_DECL_COLD_FUNCTION
It's only called in exceptional circumstances, so the compiler should optimize it for size, not speed, and paths leading up to calls to this functions should be automatically marked as [[unlikely]]. Marking the function as cold accomplishes both. GCC 11 seems to have had this figured out by itself, possibly backtracking from the unconditional qWarning() in the first line of the function, but it did have a (very small) effect on Clang 15, so leave it in, if only as documentation. Pick-to: 6.6 6.5 6.2 Change-Id: Ie8e9049300825a3aae2f9678a2907ceea0b21d1c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/io/qiodevice.cpp')
-rw-r--r--src/corelib/io/qiodevice.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 81c2bc1695..723cc3e323 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -45,6 +45,7 @@ static void debugBinaryString(const char *input, qint64 maxlen)
#define Q_VOID
+Q_DECL_COLD_FUNCTION
static void checkWarnMessage(const QIODevice *device, const char *function, const char *what)
{
#ifndef QT_NO_WARNING_OUTPUT