Bootstrap: disable all debug/info/warning messages and assertions

The three bootstrapped tools should validate their arguments properly,
so there's no need to have them print something. They aren't means to
test the Qt classes either, so assertions shouldn't apply.

Change-Id: I580758610c7262414b64fffd54f84eb16743673d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
Thiago Macieira 2024-12-29 15:28:37 -03:00
parent 24b5cea95c
commit 0604a6e760
5 changed files with 12 additions and 4 deletions

View File

@ -96,6 +96,7 @@ Q_NORETURN void qAbort()
\sa Q_ASSERT(), qFatal(), {Debugging Techniques}
*/
#if !defined(QT_BOOTSTRAPPED) || defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG)
/*
The Q_ASSERT macro calls this function when the test fails.
*/
@ -113,6 +114,7 @@ void qt_assert_x(const char *where, const char *what, const char *file, int line
QMessageLogger(file, line, nullptr)
.fatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line);
}
#endif // bootstrapped
/*!
\macro void Q_CHECK_PTR(void *pointer)

View File

@ -29,7 +29,15 @@
#define QT_NO_EXCEPTIONS
#endif
#undef QT_DEBUG
#undef QT_FORCE_ASSERTS
#ifndef QT_NO_DEBUG
# define QT_NO_DEBUG
#endif
#define QT_NO_DEBUG_OUTPUT
#define QT_NO_DEBUG_STREAM
#define QT_NO_INFO_OUTPUT
#define QT_NO_WARNING_OUTPUT
#define QT_NO_USING_NAMESPACE
#define QT_NO_DEPRECATED

View File

@ -27,7 +27,7 @@ QT_BEGIN_NAMESPACE
#define Q_RETURN_ON_INVALID_FILENAME(message, result) \
{ \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).warning(message); \
qWarning(message); \
errno = EINVAL; \
return (result); \
}

View File

@ -130,8 +130,7 @@ static Q_NEVER_INLINE QString makeString(const QCborContainerPrivate *d, qsizety
case QCborValue::Array:
case QCborValue::Map:
#if defined(QT_JSON_READONLY) || defined(QT_BOOTSTRAPPED)
qFatal("Writing JSON is disabled.");
return QString();
Q_UNREACHABLE_RETURN(QString());
#else
return d->valueAt(idx).toDiagnosticNotation(QCborValue::Compact);
#endif

View File

@ -18,7 +18,6 @@ qt_internal_add_sync_header_dependencies(Bootstrap Core)
qt_internal_extend_target(Bootstrap
SOURCES
../../corelib/global/qassert.cpp
../../corelib/global/qlogging.cpp
../../corelib/global/qtenvironmentvariables.cpp
../../corelib/io/qabstractfileengine.cpp
../../corelib/io/qdir.cpp