diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 50cf0889c7..885cb96c1a 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -243,6 +243,7 @@ # define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__)) # define Q_DECL_PURE_FUNCTION __attribute__((pure)) # define Q_DECL_CONST_FUNCTION __attribute__((const)) +# define Q_DECL_COLD_FUNCTION __attribute__((cold)) # if !defined(QT_MOC_CPP) # define Q_PACKED __attribute__ ((__packed__)) # ifndef __ARM_EABI__ @@ -1275,6 +1276,9 @@ #ifndef Q_DECL_CONST_FUNCTION # define Q_DECL_CONST_FUNCTION Q_DECL_PURE_FUNCTION #endif +#ifndef Q_DECL_COLD_FUNCTION +# define Q_DECL_COLD_FUNCTION +#endif #ifndef QT_MAKE_UNCHECKED_ARRAY_ITERATOR # define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) (x) #endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 203c9a9da4..d439085dbc 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -706,7 +706,7 @@ inline void qt_noop(void) {} # define QT_CATCH(A) catch (A) # define QT_THROW(A) throw A # define QT_RETHROW throw -Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; +Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; # ifdef Q_COMPILER_NOEXCEPT # define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false) # else @@ -749,11 +749,13 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW; #endif class QString; +Q_DECL_COLD_FUNCTION Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); #ifndef Q_CC_MSVC Q_NORETURN #endif +Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW; #if !defined(Q_ASSERT) @@ -771,6 +773,7 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) #ifndef Q_CC_MSVC Q_NORETURN #endif +Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW; #if !defined(Q_ASSERT_X) @@ -782,6 +785,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char * #endif Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) Q_DECL_NOTHROW; +Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qBadAlloc(); #ifdef QT_NO_EXCEPTIONS diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index 0c8d7dab38..16e01183bd 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -97,7 +97,9 @@ public: void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3) {} void info(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + Q_DECL_COLD_FUNCTION void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + Q_DECL_COLD_FUNCTION void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); typedef const QLoggingCategory &(*CategoryFunction)(); @@ -106,14 +108,19 @@ public: void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); void info(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); void info(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); + Q_DECL_COLD_FUNCTION void critical(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4); #ifndef Q_CC_MSVC Q_NORETURN #endif + Q_DECL_COLD_FUNCTION void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); #ifndef QT_NO_DEBUG_STREAM @@ -179,8 +186,8 @@ private: Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context, const QString &message); -Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...); -Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...); +Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(int code, const char *msg, ...); +Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(const char *msg, ...); #if QT_DEPRECATED_SINCE(5, 0)// deprecated. Use qInstallMessageHandler instead! typedef void (*QtMsgHandler)(QtMsgType, const char *);