From 164e575673e47b2a3576e778840c027ccf0ae477 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 19 Oct 2021 12:44:49 +0200 Subject: Fix -trace build on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TraceLoggingValue template does not have overloads for Qt types, so it was throwing multiple template instantiation errors while trying to log the unknown types. Fix it by serializing such types to QString using QDebug::toString, and the logging this string. Apart from that, fixes some other compiler errors on Windows build with -trace enabled: - implicit size_t to ULONG conversion - complaints on std::min - add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE to the generated *_tracepoints_p.h headers to fix the namespace build. Task-number: QTBUG-97246 Fixes: QTBUG-97241 Pick-to: 6.2 Change-Id: Ifba134bab8d7fda7f1e30da9938e25cae813e1c6 Reviewed-by: Oliver Wolff Reviewed-by: MÃ¥rten Nordheim --- src/corelib/global/qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index fd38a9d6c4..e562fed336 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1682,7 +1682,7 @@ static void win_outputDebugString_helper(QStringView message) } else { wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1]; for (qsizetype i = 0; i < message.length(); i += maxOutputStringLength) { - const qsizetype length = std::min(message.length() - i, maxOutputStringLength); + const qsizetype length = qMin(message.length() - i, maxOutputStringLength); const qsizetype len = message.mid(i, length).toWCharArray(messagePart); Q_ASSERT(len == length); messagePart[len] = 0; -- cgit v1.2.3