From 6e121d81cb4ae4663d656c29a7ac590b6069e22a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 29 May 2019 15:06:35 +0200 Subject: [PATCH] QPropertyAnimation: share some code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Collapse the two qWarnings() into one by just storing what is different between them. Saves more than 400b in text size on optimized AMD64 Linux GCC 9.1 builds. Change-Id: I16489d6165a550a9ad4ce6a77ca736a1d17a8c8a Reviewed-by: MÃ¥rten Nordheim --- src/corelib/animation/qpropertyanimation.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 271be248ec..a1baa112fc 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -277,15 +277,20 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, if (oldState == Stopped) { d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData())); //let's check if we have a start value and an end value + const char *what = nullptr; if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) { - qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value", - d->propertyName.constData(), d->target.data()->metaObject()->className(), - qPrintable(d->target.data()->objectName())); + what = "start"; } if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) { - qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value", + if (what) + what = "start and end"; + else + what = "end"; + } + if (Q_UNLIKELY(what)) { + qWarning("QPropertyAnimation::updateState (%s, %s, %ls): starting an animation without %s value", d->propertyName.constData(), d->target.data()->metaObject()->className(), - qPrintable(d->target.data()->objectName())); + qUtf16Printable(d->target.data()->objectName()), what); } } } else if (hash.value(key) == this) {