From 134cad32d73c776ffdc9db89a24f582bb847f165 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 17 Oct 2015 17:48:34 +0200 Subject: QtCore: use printf-style qWarning/qDebug where possible (I) The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Saves ~750b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3 Reviewed-by: Kai Koehne --- src/corelib/kernel/qsystemsemaphore_win.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/kernel/qsystemsemaphore_win.cpp') diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index ca31e9d59d..236e346afe 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -101,7 +101,7 @@ void QSystemSemaphorePrivate::cleanHandle() { if (semaphore && !CloseHandle(semaphore)) { #if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphorePrivate::CloseHandle: sem failed"); + qDebug("QSystemSemaphorePrivate::CloseHandle: sem failed"); #endif } semaphore = 0; @@ -116,7 +116,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) if (0 == ReleaseSemaphore(semaphore, count, 0)) { setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphore::modifySemaphore ReleaseSemaphore failed"); + qDebug("QSystemSemaphore::modifySemaphore ReleaseSemaphore failed"); #endif return false; } @@ -128,7 +128,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) #endif setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore")); #if defined QSYSTEMSEMAPHORE_DEBUG - qDebug() << QLatin1String("QSystemSemaphore::modifySemaphore WaitForSingleObject failed"); + qDebug("QSystemSemaphore::modifySemaphore WaitForSingleObject failed"); #endif return false; } -- cgit v1.2.3