qErrnoWarning: disable when QT_NO_WARNING_OUTPUT is set

Change-Id: Ife98ce915b4bd3edd017fffd18c8bb775381e6f4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
Thiago Macieira 2024-12-29 15:30:55 -03:00
parent e04f109456
commit 4fa44a70bc
4 changed files with 27 additions and 18 deletions

View File

@ -1367,3 +1367,19 @@ QUuid::Version QUuid::version() const noexcept
// order sections alphabetically to reduce chances of merge conflicts
#endif // QT_CORE_REMOVED_SINCE(6, 9)
#if QT_CORE_REMOVED_SINCE(6, 10)
#include "qlogging.h"
QNoDebug QMessageLogger::noDebug() const noexcept
{
return QNoDebug();
}
// #include "qotherheader.h"
// // implement removed functions from qotherheader.h
// order sections alphabetically to reduce chances of merge conflicts
#endif // QT_CORE_REMOVED_SINCE(6, 10)

View File

@ -515,19 +515,6 @@ QDebug QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc) const
{
return debug((*catFunc)());
}
/*!
\internal
Returns a QNoDebug object, which is used to ignore debugging output.
\sa QNoDebug, qDebug()
*/
QNoDebug QMessageLogger::noDebug() const noexcept
{
return QNoDebug();
}
#endif
/*!

View File

@ -134,10 +134,13 @@ public:
QDebug fatal(const QLoggingCategory &cat) const;
Q_DECL_COLD_FUNCTION
QDebug fatal(CategoryFunction catFunc) const;
QNoDebug noDebug() const noexcept;
#endif // QT_NO_DEBUG_STREAM
# if QT_CORE_REMOVED_SINCE(6, 10)
QNoDebug noDebug() const noexcept;
# endif
inline QNoDebug noDebug(...) const noexcept; // in qdebug.h
private:
QMessageLogContext context;
};
@ -168,6 +171,9 @@ private:
#define qCritical QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).critical
#define qFatal QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).fatal
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, ...);
#define QT_NO_QDEBUG_MACRO while (false) QMessageLogger().noDebug
#if defined(QT_NO_DEBUG_OUTPUT)
@ -181,14 +187,12 @@ private:
#if defined(QT_NO_WARNING_OUTPUT)
# undef qWarning
# define qWarning QT_NO_QDEBUG_MACRO
# define qErrnoWarning QT_NO_QDEBUG_MACRO
#endif
Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context,
const QString &message);
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, ...);
typedef void (*QtMessageHandler)(QtMsgType, const QMessageLogContext &, const QString &);
Q_CORE_EXPORT QtMessageHandler qInstallMessageHandler(QtMessageHandler);

View File

@ -352,6 +352,8 @@ public:
template<typename T>
inline QNoDebug &operator<<(const T &) { return *this; }
};
inline QNoDebug QMessageLogger::noDebug(...) const noexcept
{ return {}; }
inline QDebug &QDebug::operator=(const QDebug &other)
{