From e5e9f5de591ff3ff56f2e97f41bbf36673fc7669 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Aug 2013 15:07:38 +0200 Subject: [PATCH] Silence MinGW/gcc-4.8.1 compiler warnings. Reorder V4::Object's and V4::Value's private object inline functions such that its definitions are visible from where they are being referenced. qv4object_p.h:418:13: warning: 'uint QV4::Object::arrayLength() const' redeclared without dllimport attribute after being referenced with dll linkage qv4object_p.h:430:13: warning: 'void QV4::Object::setArrayLengthUnchecked(uint)' redeclared without dllimport attribute after being referenced with dll linkage Change-Id: I49a3c9d1da637eaf038f53b29ec13c35253de9f1 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4object_p.h | 116 ++++++++++++++++++++++------------------ src/qml/jsruntime/qv4value_p.h | 13 +++-- 2 files changed, 69 insertions(+), 60 deletions(-) diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index ea89111..ce3a271 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -222,47 +222,10 @@ public: void setArrayLengthUnchecked(uint l); - Property *arrayInsert(uint index, PropertyAttributes attributes = Attr_Data) { - if (attributes.isAccessor()) - hasAccessorProperty = 1; - - Property *pd; - if (!sparseArray && (index < 0x1000 || index < arrayDataLen + (arrayDataLen >> 2))) { - if (index >= arrayAlloc) - arrayReserve(index + 1); - if (index >= arrayDataLen) { - ensureArrayAttributes(); - for (uint i = arrayDataLen; i < index; ++i) - arrayAttributes[i].clear(); - arrayDataLen = index + 1; - } - pd = arrayData + index; - } else { - initSparse(); - SparseArrayNode *n = sparseArray->insert(index); - if (n->value == UINT_MAX) - n->value = allocArrayValue(); - pd = arrayData + n->value; - } - if (index >= arrayLength()) - setArrayLengthUnchecked(index + 1); - if (arrayAttributes || attributes != Attr_Data) { - if (!arrayAttributes) - ensureArrayAttributes(); - attributes.resolve(); - arrayAttributes[pd - arrayData] = attributes; - } - return pd; - } + Property *arrayInsert(uint index, PropertyAttributes attributes = Attr_Data); - void arraySet(uint index, const Property *pd) { - *arrayInsert(index) = *pd; - } - - void arraySet(uint index, Value value) { - Property *pd = arrayInsert(index); - pd->value = value; - } + void arraySet(uint index, const Property *pd); + void arraySet(uint index, Value value); uint propertyIndexFromArrayIndex(uint index) const { @@ -295,19 +258,7 @@ public: void markArrayObjects() const; - void push_back(Value v) { - uint idx = arrayLength(); - if (!sparseArray) { - if (idx >= arrayAlloc) - arrayReserve(idx + 1); - arrayData[idx].value = v; - arrayDataLen = idx + 1; - } else { - uint idx = allocArrayValue(v); - sparseArray->push_back(idx, arrayLength()); - } - setArrayLengthUnchecked(idx + 1); - } + void push_back(Value v); SparseArrayNode *sparseArrayBegin() { return sparseArray ? sparseArray->begin() : 0; } SparseArrayNode *sparseArrayEnd() { return sparseArray ? sparseArray->end() : 0; } @@ -436,6 +387,65 @@ inline void Object::setArrayLengthUnchecked(uint l) } } +inline void Object::push_back(Value v) +{ + uint idx = arrayLength(); + if (!sparseArray) { + if (idx >= arrayAlloc) + arrayReserve(idx + 1); + arrayData[idx].value = v; + arrayDataLen = idx + 1; + } else { + uint idx = allocArrayValue(v); + sparseArray->push_back(idx, arrayLength()); + } + setArrayLengthUnchecked(idx + 1); +} + +inline Property *Object::arrayInsert(uint index, PropertyAttributes attributes) { + if (attributes.isAccessor()) + hasAccessorProperty = 1; + + Property *pd; + if (!sparseArray && (index < 0x1000 || index < arrayDataLen + (arrayDataLen >> 2))) { + if (index >= arrayAlloc) + arrayReserve(index + 1); + if (index >= arrayDataLen) { + ensureArrayAttributes(); + for (uint i = arrayDataLen; i < index; ++i) + arrayAttributes[i].clear(); + arrayDataLen = index + 1; + } + pd = arrayData + index; + } else { + initSparse(); + SparseArrayNode *n = sparseArray->insert(index); + if (n->value == UINT_MAX) + n->value = allocArrayValue(); + pd = arrayData + n->value; + } + if (index >= arrayLength()) + setArrayLengthUnchecked(index + 1); + if (arrayAttributes || attributes != Attr_Data) { + if (!arrayAttributes) + ensureArrayAttributes(); + attributes.resolve(); + arrayAttributes[pd - arrayData] = attributes; + } + return pd; +} + +inline void Object::arraySet(uint index, Value value) +{ + Property *pd = arrayInsert(index); + pd->value = value; +} + +inline void Object::arraySet(uint index, const Property *pd) +{ + *arrayInsert(index) = *pd; +} + } QT_END_NAMESPACE diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 986f5e2..20b78a4 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -63,6 +63,12 @@ double __qmljs_to_number(const QV4::Value &value); Q_QML_EXPORT QV4::String *__qmljs_convert_to_string(QV4::ExecutionContext *ctx, const QV4::Value &value); QV4::Object *__qmljs_convert_to_object(QV4::ExecutionContext *ctx, const QV4::Value &value); +inline Managed *Value::asManaged() const +{ + if (isManaged()) + return managed(); + return 0; +} inline ExecutionEngine *Value::engine() const { Managed *m = asManaged(); @@ -273,13 +279,6 @@ inline String *Value::asString() const return 0; } -inline Managed *Value::asManaged() const -{ - if (isManaged()) - return managed(); - return 0; -} - inline Object *Value::asObject() const { return isObject() ? objectValue() : 0; -- 2.7.4