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>
bb10
Marc Mutz 2023-10-18 10:43:22 +02:00 committed by Fabian Kosmale
parent 18152699e4
commit 546208f0ff
1 changed files with 1 additions and 0 deletions

View File

@ -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