From 949b85a721e9970dda2a3e3566bb7530b423beee Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 12 May 2022 07:54:34 +0200 Subject: [PATCH] QObject: mark two error reporting functions COLD They already nicely factored this error-only code from the normal path of execution. All that was missing was for them to be marked as COLD, so the compiler moves them out of the way even further, and optimizes them for size, not speed. TEXT size savings: ~400b on GCC 11.2 and ~500b on Clang 10 optimized C++20 AMD64 Linux builds. Pick-to: 6.3 6.2 5.15 Change-Id: I64a4123645855b4e34fbb0bc3304d144d7191a0d Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobject.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 475e8eb447f..c9bc48fecda 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2691,6 +2691,7 @@ static bool check_method_code(int code, const QObject *object, const char *metho return true; } +Q_DECL_COLD_FUNCTION static void err_method_notfound(const QObject *object, const char *method, const char *func) { @@ -2708,6 +2709,7 @@ static void err_method_notfound(const QObject *object, object->metaObject()->className(), method + 1, loc ? " in " : "", loc ? loc : ""); } +Q_DECL_COLD_FUNCTION static void err_info_about_objects(const char *func, const QObject *sender, const QObject *receiver) { QString a = sender ? sender->objectName() : QString();