From c637c66ebb06eaec1fff5ec94402d27a55b63dd8 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 12 Apr 2018 12:08:48 +0200 Subject: [PATCH] QmlProfiler: Avoid structs with default values gcc 4.9 and msvc 2015 choke when creating those from initializer lists. Change-Id: I85936fe33418d5d9ffeb3c910392ad43fbb9a9bb Reviewed-by: Christian Stenger --- .../qmlprofiler/qmlprofilerstatisticsmodel.cpp | 10 +++------- .../qmlprofiler/qmlprofilerstatisticsmodel.h | 13 ++++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp index 18c4905b8b4..f4b9c931fae 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp @@ -370,7 +370,7 @@ void QmlProfilerStatisticsRelativesModel::loadEvent(RangeType type, const QmlEve switch (event.rangeStage()) { case RangeStart: - stack.push({event.timestamp(), event.typeIndex()}); + stack.push(Frame(event.timestamp(), event.typeIndex())); break; case RangeEnd: { int callerTypeIndex = stack.count() > 1 ? stack[stack.count() - 2].typeId : -1; @@ -386,12 +386,8 @@ void QmlProfilerStatisticsRelativesModel::loadEvent(RangeType type, const QmlEve it->duration += event.timestamp() - stack.top().startTime; it->isRecursive = isRecursive || it->isRecursive; } else { - QmlStatisticsRelativesData relative = { - event.timestamp() - stack.top().startTime, - 1, - isRecursive - }; - relativesMap.insert(relativeTypeIndex, relative); + relativesMap.insert(relativeTypeIndex, QmlStatisticsRelativesData( + event.timestamp() - stack.top().startTime, 1, isRecursive)); } stack.pop(); break; diff --git a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h index 092e9f8c69f..805df505482 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h @@ -113,9 +113,11 @@ class QmlProfilerStatisticsRelativesModel : public QObject public: struct QmlStatisticsRelativesData { - qint64 duration = 0; - qint64 calls = 0; - bool isRecursive = false; + QmlStatisticsRelativesData(qint64 duration = 0, qint64 calls = 0, bool isRecursive = false) + : duration(duration), calls(calls), isRecursive(isRecursive) {} + qint64 duration; + qint64 calls; + bool isRecursive; }; typedef QHash QmlStatisticsRelativesMap; @@ -141,8 +143,9 @@ protected: QPointer m_modelManager; struct Frame { - qint64 startTime = 0; - int typeId = -1; + Frame(qint64 startTime = 0, int typeId = -1) : startTime(startTime), typeId(typeId) {} + qint64 startTime; + int typeId; }; QStack m_callStack; QStack m_compileStack;