From 66e72c2cf08c2d2c381c6c22e4760d0df758af52 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Jan 2014 07:11:41 -0800 Subject: Fix broken build with Clang < 3.4 after 60aed669345be33b916c445565 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The -Wunused-const-variable option was added in Clang 3.4 and is not yet supported on Apple's Clang. This test needs to be extended with the Apple Clang version that supports the option. Change-Id: Ief6ece91f1c0200c3359e74dafca4b893fcde7ca Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø Reviewed-by: Shawn Rutledge --- src/qml/qml.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/qml.pro b/src/qml/qml.pro index d0f655609e..79e83a1d47 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -21,7 +21,8 @@ QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf # 2415: variable "xx" of static storage duration was declared but never referenced # unused variable 'xx' [-Werror,-Wunused-const-variable] intel_icc: WERROR += -ww2415 -clang: WERROR += -Wno-error=unused-const-variable +clang:if(greaterThan(QT_CLANG_MAJOR_VERSION, 3)|greaterThan(QT_CLANG_MINOR_VERSION, 3)): \ + WERROR += -Wno-error=unused-const-variable load(qt_module) -- cgit v1.2.3 From e20324ea5cdc63145a25be3027c21d1bdfed03b6 Mon Sep 17 00:00:00 2001 From: Jeff Tranter Date: Tue, 7 Jan 2014 10:35:37 -0500 Subject: Fix some typos in documentation. Fix some spelling and grammatical errors in comments that show up in Qt documentation. No changes to code. Change-Id: I2d91518900c9b60ee8e8a8f549c88a1d50632b3d Reviewed-by: Nico Vertriest Reviewed-by: Alan Alpert Reviewed-by: Martin Smith --- src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc index 6803901efd..653fe2391e 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc @@ -30,7 +30,7 @@ \title Property Binding \brief binding object properties -To make the fullest use of QML and its built-in support for implementing dynamic object behavioral changes, most QML objects will use \e {property binding}. This is a core feature of QML that allows objects to automatically update their properties in response to changing attributes in other objects or the occurence of some external event. +To make the fullest use of QML and its built-in support for implementing dynamic object behavioral changes, most QML objects will use \e {property binding}. This is a core feature of QML that allows objects to automatically update their properties in response to changing attributes in other objects or the occurrence of some external event. When an object's property is assigned a value, it can either be assigned a static value, or \e bound to a JavaScript expression. In the first case, the property's value will not change unless a new value is assigned to the property. In the latter case, a \e {property binding} is created and the property's value is automatically updated by the QML engine whenever the value of the evaluated expression changes. -- cgit v1.2.3 From 7701b58ad06f9e99d291e0e3468096dc3ab4dd00 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 2 Jan 2014 16:49:32 +0100 Subject: Remove redundant copies of enabled flag in QML profiler Task-number: QTBUG-35315 Change-Id: Idd35a330531722cb3d4e0d3e95cb3be6e5697688 Reviewed-by: Michael Brasser --- src/qml/debugger/qqmlprofilerservice.cpp | 102 ++++++++----------------------- src/qml/debugger/qqmlprofilerservice_p.h | 72 +++++++--------------- src/qml/qml/qqmlvme.cpp | 34 +++++------ 3 files changed, 63 insertions(+), 145 deletions(-) (limited to 'src/qml') diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp index b83de937c6..3c066bd380 100644 --- a/src/qml/debugger/qqmlprofilerservice.cpp +++ b/src/qml/debugger/qqmlprofilerservice.cpp @@ -431,58 +431,29 @@ void QQmlProfilerService::messageReceived(const QByteArray &message) */ void QQmlVmeProfiler::Data::clear() { - url = QUrl(); + url.clear(); line = 0; column = 0; - typeName = QString(); -} - -/*! - * \brief QQmlVmeProfiler::start Start profiler and set data - * \param url URL of file being executed - * \param line Curent line in file - * \param column Current column in file - * \param typeName Type of object be created - * Stops the profiler previously running in the foreground if there is one, then starts a - * new one and sets it up with the data given. - * Preconditions: Profiling must be enabled. - */ -void QQmlVmeProfiler::start(const QUrl &url, int line, int column, const QString &typeName) -{ - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - if (enabled) { - switchRange(); - updateLocation(url, line, column); - updateTypeName(typeName); - } + typeName.clear(); } /*! * \brief QQmlVmeProfiler::start Start profiler without data * Clears the current range data, then stops the profiler previously running in the * foreground if any, then starts a new one. - * Preconditions: Profiling must be enabled. */ -void QQmlVmeProfiler::start() +bool QQmlVmeProfiler::start() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - if (enabled) { + if (QQmlProfilerService::enabled) { currentRange.clear(); - switchRange(); + if (running) + QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); + else + running = true; + QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating); + return true; } -} - -/*! - * \brief QQmlVmeProfiler::switchRange Switch foreground profilers - * Stops the current profiler if any, and starts a new one. - */ -void QQmlVmeProfiler::switchRange() -{ - if (running) - QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); - else - running = true; - QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating); + return false; } /*! @@ -491,13 +462,10 @@ void QQmlVmeProfiler::switchRange() * \param line line Curent line in file * \param column column Current column in file * Updates the current profiler's location information. - * Preconditions: Profiling must be enabled and a profiler must be running in the foreground. */ void QQmlVmeProfiler::updateLocation(const QUrl &url, int line, int column) { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - Q_ASSERT_X(running, Q_FUNC_INFO, "trying to update location on stopped profiler"); - if (enabled && running) { + if (QQmlProfilerService::enabled && running) { currentRange.url = url; currentRange.line = line; currentRange.column = column; @@ -510,13 +478,10 @@ void QQmlVmeProfiler::updateLocation(const QUrl &url, int line, int column) * \brief QQmlVmeProfiler::updateTypeName Update current type information * \param typeName Type of object being created * Updates the current profiler's type information. - * Preconditions: Profiling must be enabled and a profiler must be running in the foreground. */ void QQmlVmeProfiler::updateTypeName(const QString &typeName) { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - Q_ASSERT_X(running, Q_FUNC_INFO, "trying to update typeName on stopped profiler"); - if (enabled && running) { + if (QQmlProfilerService::enabled && running) { currentRange.typeName = typeName; QQmlProfilerService::instance->rangeData(QQmlProfilerService::Creating, typeName); } @@ -526,14 +491,10 @@ void QQmlVmeProfiler::updateTypeName(const QString &typeName) * \brief QQmlVmeProfiler::pop Pops a paused profiler from the stack and restarts it * Stops the currently running profiler, if any, then retrieves an old one from the stack * of paused profilers and starts that. - * Preconditions: Profiling must be enabled and there must be at least one profiler on the - * stack. */ void QQmlVmeProfiler::pop() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - Q_ASSERT_X(ranges.count() > 0, Q_FUNC_INFO, "trying to pop an invalid profiler"); - if (enabled && ranges.count() > 0) { + if (QQmlProfilerService::enabled && ranges.count() > 0) { start(); currentRange = ranges.pop(); QQmlProfilerService::instance->rangeLocation( @@ -547,13 +508,10 @@ void QQmlVmeProfiler::pop() * Pushes the currently running profiler on the stack of paused profilers. Note: The profiler * isn't paused here. That's a separate step. If it's never paused, but pop()'ed later that * won't do any harm, though. - * Preconditions: Profiling must be enabled and a profiler must be running in the foreground. */ void QQmlVmeProfiler::push() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - Q_ASSERT_X(running, Q_FUNC_INFO, "trying to push stopped profiler"); - if (enabled && running) + if (QQmlProfilerService::enabled && running) ranges.push(currentRange); } @@ -561,29 +519,26 @@ void QQmlVmeProfiler::push() * \brief QQmlVmeProfiler::clear Stop all running profilers and clear all data. * Stops the currently running (foreground and background) profilers and removes all saved * data about paused profilers. - * Precondtions: Profiling must be enabled. */ void QQmlVmeProfiler::clear() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - if (enabled) { - stop(); - ranges.clear(); + stop(); + ranges.clear(); + if (QQmlProfilerService::enabled) { for (int i = 0; i < backgroundRanges.count(); ++i) { QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); } - backgroundRanges.clear(); } + backgroundRanges.clear(); + running = false; } /*! * \brief QQmlVmeProfiler::stop Stop profiler running in the foreground, if any. - * Precondition: Profiling must be enabled. */ void QQmlVmeProfiler::stop() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - if (enabled && running) { + if (QQmlProfilerService::enabled && running) { QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating); currentRange.clear(); running = false; @@ -595,13 +550,10 @@ void QQmlVmeProfiler::stop() * Push the profiler currently running in the foreground to the background so that it * won't be stopped by stop() or start(). There can be multiple profilers in the background. * You can retrieve them in reverse order by calling foreground(). - * Precondition: Profiling must be enabled and a profiler must be running in the foreground. */ void QQmlVmeProfiler::background() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - Q_ASSERT_X(running, Q_FUNC_INFO, "trying to push stopped profiler to the background."); - if (enabled && running) { + if (QQmlProfilerService::enabled && running) { backgroundRanges.push(currentRange); running = false; } @@ -611,18 +563,16 @@ void QQmlVmeProfiler::background() * \brief QQmlVmeProfiler::foreground Retrieve a profiler from the background * Stop the profiler currently running in the foreground, if any and put the next profiler * from the background in its place. - * Preconditions: Profiling must be enabled and there must be at least one profiler in the - * background. */ -void QQmlVmeProfiler::foreground() +bool QQmlVmeProfiler::foreground() { - Q_ASSERT_X(enabled, Q_FUNC_INFO, "method called although profiler is not enabled."); - Q_ASSERT_X(backgroundRanges.count() > 0, Q_FUNC_INFO, "trying to foreground stopped profiler."); - if (enabled && backgroundRanges.count() > 0) { + if (QQmlProfilerService::enabled && backgroundRanges.count() > 0) { stop(); currentRange = backgroundRanges.pop(); running = true; + return true; } + return false; } QT_END_NAMESPACE diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index 5959a526bb..86807eacec 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -237,32 +237,25 @@ private: struct QQmlBindingProfiler { QQmlBindingProfiler(const QString &url, int line, int column, QQmlProfilerService::BindingType bindingType) { - QQmlProfilerService *instance = QQmlProfilerService::instance; - enabled = instance ? instance->profilingEnabled() : false; - if (enabled) { - instance->startRange(QQmlProfilerService::Binding, bindingType); - instance->rangeLocation(QQmlProfilerService::Binding, url, line, column); + if (QQmlProfilerService::enabled) { + QQmlProfilerService::instance->startRange(QQmlProfilerService::Binding, bindingType); + QQmlProfilerService::instance->rangeLocation(QQmlProfilerService::Binding, url, line, column); } } ~QQmlBindingProfiler() { - if (enabled) + if (QQmlProfilerService::enabled) QQmlProfilerService::instance->endRange(QQmlProfilerService::Binding); } - - bool enabled; }; struct QQmlHandlingSignalProfiler { QQmlHandlingSignalProfiler(QQmlBoundSignalExpression *expression) { - enabled = QQmlProfilerService::instance - ? QQmlProfilerService::instance->profilingEnabled() : false; - if (enabled) { - QQmlProfilerService *service = QQmlProfilerService::instance; - service->startRange(QQmlProfilerService::HandlingSignal); - service->rangeLocation(QQmlProfilerService::HandlingSignal, + if (QQmlProfilerService::enabled) { + QQmlProfilerService::instance->startRange(QQmlProfilerService::HandlingSignal); + QQmlProfilerService::instance->rangeLocation(QQmlProfilerService::HandlingSignal, expression->sourceFile(), expression->lineNumber(), expression->columnNumber()); } @@ -270,38 +263,30 @@ struct QQmlHandlingSignalProfiler { ~QQmlHandlingSignalProfiler() { - if (enabled) + if (QQmlProfilerService::enabled) QQmlProfilerService::instance->endRange(QQmlProfilerService::HandlingSignal); } - - bool enabled; }; struct QQmlCompilingProfiler { QQmlCompilingProfiler(const QString &name) { - QQmlProfilerService *instance = QQmlProfilerService::instance; - enabled = instance ? - instance->profilingEnabled() : false; - if (enabled) { - instance->startRange(QQmlProfilerService::Compiling); - instance->rangeLocation(QQmlProfilerService::Compiling, name, 1, 1); - instance->rangeData(QQmlProfilerService::Compiling, name); + if (QQmlProfilerService::enabled) { + QQmlProfilerService::instance->startRange(QQmlProfilerService::Compiling); + QQmlProfilerService::instance->rangeLocation(QQmlProfilerService::Compiling, name, 1, 1); + QQmlProfilerService::instance->rangeData(QQmlProfilerService::Compiling, name); } } ~QQmlCompilingProfiler() { - if (enabled) + if (QQmlProfilerService::enabled) QQmlProfilerService::instance->endRange(QQmlProfilerService::Compiling); } - - bool enabled; }; struct QQmlVmeProfiler { public: - const bool enabled; struct Data { Data() : line(0), column(0) {} @@ -313,20 +298,18 @@ public: }; QQmlVmeProfiler() : - enabled(QQmlProfilerService::instance ? QQmlProfilerService::instance->profilingEnabled() : false), running(false) {} ~QQmlVmeProfiler() { - if (enabled) + if (QQmlProfilerService::enabled) clear(); } void clear(); - void start(const QUrl &url, int line, int column, const QString &typeName); - void start(); + bool start(); void stop(); void updateLocation(const QUrl &url, int line, int column); @@ -336,10 +319,9 @@ public: void push(); void background(); - void foreground(); + bool foreground(); private: - void switchRange(); Data currentRange; QStack ranges; @@ -348,46 +330,36 @@ private: }; struct QQmlPixmapProfiler { - QQmlPixmapProfiler() { - QQmlProfilerService *instance = QQmlProfilerService::instance; - enabled = instance ? - instance->profilingEnabled() : false; - } - - ~QQmlPixmapProfiler() {} - void startLoading(const QUrl &pixmapUrl) { - if (enabled) { + if (QQmlProfilerService::enabled) { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl); } } void finishLoading(const QUrl &pixmapUrl) { - if (enabled) { + if (QQmlProfilerService::enabled) { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl); } } void errorLoading(const QUrl &pixmapUrl) { - if (enabled) { + if (QQmlProfilerService::enabled) { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl); } } void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) { - if (enabled) { + if (QQmlProfilerService::enabled) { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount); } } void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) { - if (enabled) { + if (QQmlProfilerService::enabled) { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount); } } void setSize(const QUrl &pixmapUrl, const QSize &size) { - if (enabled && size.width() > 0) { + if (QQmlProfilerService::enabled && size.width() > 0) { QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, size.width(), size.height()); } } - - bool enabled; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index ad1e9d862e..1881b554ed 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -503,8 +503,7 @@ QObject *QQmlVME::run(QList *errors, const QQmlCompiledData::TypeReference &type = TYPES.at(instr.type); Q_ASSERT(type.component); - if (profiler.enabled) { - profiler.start(); + if (profiler.start()) { profiler.updateTypeName(type.component->name); profiler.background(); } @@ -530,10 +529,8 @@ QObject *QQmlVME::run(QList *errors, QML_END_INSTR(CreateQMLObject) QML_BEGIN_INSTR(CompleteQMLObject) - if (profiler.enabled) { - profiler.foreground(); + if (profiler.foreground()) profiler.updateLocation(CTXT->url, instr.line, instr.column); - } QObject *o = objects.top(); Q_ASSERT(o); @@ -577,8 +574,10 @@ QObject *QQmlVME::run(QList *errors, QML_BEGIN_INSTR(CreateCppObject) const QQmlCompiledData::TypeReference &type = TYPES.at(instr.type); Q_ASSERT(type.type); - if (profiler.enabled) - profiler.start(CTXT->url, instr.line, instr.column, type.type->qmlTypeName()); + if (profiler.start()) { + profiler.updateLocation(CTXT->url, instr.line, instr.column); + profiler.updateTypeName(type.type->qmlTypeName()); + } QObject *o = 0; void *memory = 0; @@ -651,8 +650,10 @@ QObject *QQmlVME::run(QList *errors, QML_BEGIN_INSTR(CreateSimpleObject) const QQmlCompiledData::TypeReference &ref = TYPES.at(instr.type); - if (profiler.enabled) - profiler.start(CTXT->url, instr.line, instr.column, ref.type->qmlTypeName()); + if (profiler.start()) { + profiler.updateLocation(CTXT->url, instr.line, instr.column); + profiler.updateTypeName(ref.type->qmlTypeName()); + } QObject *o = (QObject *)operator new(instr.typeSize + sizeof(QQmlData)); ::memset(static_cast(o), 0, instr.typeSize + sizeof(QQmlData)); instr.create(o); @@ -832,8 +833,7 @@ QObject *QQmlVME::run(QList *errors, QML_END_INSTR(StoreScriptString) QML_BEGIN_INSTR(BeginObject) - if (profiler.enabled) - profiler.push(); + profiler.push(); QObject *target = objects.top(); QQmlParserStatus *status = reinterpret_cast(reinterpret_cast(target) + instr.castValue); parserStatus.push(status); @@ -1091,8 +1091,7 @@ normalExit: objects.deallocate(); lists.deallocate(); states.clear(); - if (profiler.enabled) - profiler.stop(); + profiler.stop(); return rv; } @@ -1130,8 +1129,7 @@ void QQmlVME::reset() states.clear(); rootContext = 0; creationContext = 0; - if (profiler.enabled) - profiler.clear(); + profiler.clear(); } #ifdef QML_THREADED_VME_INTERPRETER @@ -1191,8 +1189,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) if (componentCompleteEnabled()) { // the qml designer does the component complete later QQmlTrace trace("VME Component Complete"); while (!parserStatus.isEmpty()) { - if (profiler.enabled) - profiler.pop(); + profiler.pop(); QQmlParserStatus *status = parserStatus.pop(); #ifdef QML_ENABLE_TRACE QQmlData *data = parserStatusData.pop(); @@ -1212,8 +1209,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) return 0; } parserStatus.deallocate(); - if (profiler.enabled) - profiler.clear(); + profiler.clear(); } { -- cgit v1.2.3 From d580411cab0d0a91c73e111ac2c0c6c8f77118fa Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Jan 2014 20:59:43 -0200 Subject: Fix bad cast of virtual class to base class via reinterpret_cast Clang 3.4 found it: qv4managed_p.h:202:9: error: 'reinterpret_cast' to class 'QQmlDelegateModelGroupChangeArray *' from its base at non-zero offset 'QV4::Managed *' behaves differently from 'static_cast' [-Werror,--Wreinterpret-base-class] QV4::Managed and QV4::Object are non-virtual classes (they have no virtual table). I'm not sure if they are (C++11) standard layout, but they seem to fit the bill. However, QQmlDelegateModelGroupChangeArray has virtual functions, so the QV4::Managed sub-object in that class does not start at offset zero. That means reinterpret_cast'ing the base to the derived class is *wrong*, even if we're just calling a static function. In any case, we're static_cast'ing in the next line anyway, so this can't hurt. Change-Id: Icc796f7ecf8f41f859ea5fc877f5db5c87799964 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4managed_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 63972688a7..e10409f397 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -199,7 +199,7 @@ public: if (!this || !internalClass) return 0; #if !defined(QT_NO_QOBJECT_CHECK) - reinterpret_cast(this)->qt_check_for_QMANAGED_macro(*reinterpret_cast(this)); + static_cast(this)->qt_check_for_QMANAGED_macro(*static_cast(this)); #endif return internalClass->vtable == &T::static_vtbl ? static_cast(this) : 0; } -- cgit v1.2.3