aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-08-20 13:38:15 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-22 04:24:00 +0200
commite04cadca4a6c0b43d29c83d23ac74393694a5ea5 (patch)
treeaa495250e8fa420b6b262c76b1d5ad2050067cb9
parentff959399c9bd13e4c881cd6aa7f953dce92bda5b (diff)
Fix compilation with MSVC 2008 (and prospective Windows CE build fix)
* Only 2010 and newer ship stdint.h, so for 2008 we have to provide a little stdint.h compat header, for some of the third-party code we import. Our own Qt code this patch changes to use quint* types instead. * Include math.h and float.h for some math functions. * disable the JIT on Windows CE for now. * Change use of intptr_t to qintptr in Qt code. intptr_t is in inttypes.h, except that with VS 2008 it is indirectly available through stdio.h. Let's avoid the mess and just use the qt type, that's always available. Change-Id: I19055edd89e0a6b147d9edbb3b711798ed3c05a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/3rdparty/masm/masm-defs.pri3
-rw-r--r--src/3rdparty/masm/stubs/compat/stdint.h55
-rw-r--r--src/imports/localstorage/plugin.cpp6
-rw-r--r--src/qml/jsruntime/qv4global_p.h3
-rw-r--r--src/qml/jsruntime/qv4mm.cpp4
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4unwindhelper_p-arm.h2
-rw-r--r--src/qml/jsruntime/qv4unwindhelper_p-dw2.h4
-rw-r--r--src/qml/qml/ftw/qhashedstring.cpp2
-rw-r--r--src/qml/qml/ftw/qhashedstring_p.h10
-rw-r--r--src/qml/qml/qqmlabstractbinding_p.h4
-rw-r--r--src/qml/qml/qqmlaccessors_p.h8
-rw-r--r--src/qml/qml/qqmllocale.cpp2
-rw-r--r--src/qml/qml/qqmlnotifier.cpp10
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h2
-rw-r--r--src/quick/items/qquickitem.cpp2
-rw-r--r--src/quick/util/qquickglobal.cpp2
17 files changed, 90 insertions, 33 deletions
diff --git a/src/3rdparty/masm/masm-defs.pri b/src/3rdparty/masm/masm-defs.pri
index 2f44f075d4..20f5378518 100644
--- a/src/3rdparty/masm/masm-defs.pri
+++ b/src/3rdparty/masm/masm-defs.pri
@@ -1,4 +1,4 @@
-!ios:!if(win*:isEqual(QT_ARCH, "x86_64")): DEFINES += V4_ENABLE_JIT
+!wince*:!ios:!if(win*:isEqual(QT_ARCH, "x86_64")): DEFINES += V4_ENABLE_JIT
# On Qt/Android/ARM release builds are thumb and debug builds arm,
# but we'll force the JIT to always generate thumb2
@@ -33,3 +33,4 @@ INCLUDEPATH += $$PWD/disassembler
INCLUDEPATH += $$PWD/disassembler/udis86
INCLUDEPATH += $$_OUT_PWD
+win32-msvc2008|wince*: INCLUDEPATH += $$PWD/stubs/compat
diff --git a/src/3rdparty/masm/stubs/compat/stdint.h b/src/3rdparty/masm/stubs/compat/stdint.h
new file mode 100644
index 0000000000..f1d18d331d
--- /dev/null
+++ b/src/3rdparty/masm/stubs/compat/stdint.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QSTDINT_WRAPPER_H
+#define QSTDINT_WRAPPER_H
+
+/* Needed for VS 2008 and earlier that don't ship stdint.h */
+
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+typedef signed long long int64_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+#endif
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 452a3d3127..0bee6d1198 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -191,7 +191,7 @@ static QString qmlsqldatabase_databaseFile(const QString& connectionName, QV8Eng
return qmlsqldatabase_databasesPath(engine) + QDir::separator() + connectionName;
}
-static Value qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, uint32_t index, bool *hasProperty = 0)
+static Value qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = 0)
{
QV8Engine *v8 = v4->v8Engine;
@@ -263,8 +263,8 @@ static Value qmlsqldatabase_executeSql(SimpleCallContext *ctx)
if (ctx->argumentCount > 1) {
Value values = ctx->arguments[1];
if (ArrayObject *array = values.asArrayObject()) {
- uint32_t size = array->arrayLength();
- for (uint32_t ii = 0; ii < size; ++ii)
+ quint32 size = array->arrayLength();
+ for (quint32 ii = 0; ii < size; ++ii)
query.bindValue(ii, engine->toVariant(array->getIndexed(ii), -1));
} else if (Object *object = values.asObject()) {
ObjectIterator it(object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly);
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h
index c5a31eb555..d354e7646c 100644
--- a/src/qml/jsruntime/qv4global_p.h
+++ b/src/qml/jsruntime/qv4global_p.h
@@ -47,6 +47,9 @@
#include <qtqmlglobal.h>
#if defined(Q_CC_MSVC)
+#include <float.h>
+#include <math.h>
+
namespace std {
inline bool isinf(double d) { return !_finite(d) && !_isnan(d); }
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 0e53a2088f..095d27e1c0 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -150,7 +150,7 @@ MemoryManager::MemoryManager()
// TLS is at the top of each thread's stack,
// so the stack base for thread is the result of __tls()
m_d->stackTop = reinterpret_cast<quintptr *>(
- (((uintptr_t)__tls() + __PAGESIZE - 1) & ~(__PAGESIZE - 1)));
+ (((quintptr)__tls() + __PAGESIZE - 1) & ~(__PAGESIZE - 1)));
#elif USE(PTHREADS)
# if OS(DARWIN)
void *st = pthread_get_stackaddr_np(pthread_self());
@@ -404,7 +404,7 @@ std::size_t MemoryManager::sweep(char *chunkStart, std::size_t chunkSize, size_t
// qDebug("chunk @ %p, size = %lu, in use: %s, mark bit: %s",
// chunk, m->size, (m->inUse ? "yes" : "no"), (m->markBit ? "true" : "false"));
- assert((intptr_t) chunk % 16 == 0);
+ assert((qintptr) chunk % 16 == 0);
if (m->inUse) {
if (m->markBit) {
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index c4d9a71519..c248c9c524 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -454,8 +454,8 @@ public:
static QVariant toVariant(QV4::ArrayObject *array)
{
Container result;
- uint32_t length = array->arrayLength();
- for (uint32_t i = 0; i < length; ++i)
+ quint32 length = array->arrayLength();
+ for (quint32 i = 0; i < length; ++i)
result << convertValueToElement<typename Container::value_type>(array->getIndexed(i));
return QVariant::fromValue(result);
}
diff --git a/src/qml/jsruntime/qv4unwindhelper_p-arm.h b/src/qml/jsruntime/qv4unwindhelper_p-arm.h
index 8f5febc3d5..740e6c8ca0 100644
--- a/src/qml/jsruntime/qv4unwindhelper_p-arm.h
+++ b/src/qml/jsruntime/qv4unwindhelper_p-arm.h
@@ -64,7 +64,7 @@ namespace QV4 {
static void *removeThumbBit(void *addr)
{
- return reinterpret_cast<void*>(reinterpret_cast<intptr_t>(addr) & ~1u);
+ return reinterpret_cast<void*>(reinterpret_cast<qintptr>(addr) & ~1u);
}
static QMutex functionProtector;
diff --git a/src/qml/jsruntime/qv4unwindhelper_p-dw2.h b/src/qml/jsruntime/qv4unwindhelper_p-dw2.h
index 3a6204f991..c53d20612c 100644
--- a/src/qml/jsruntime/qv4unwindhelper_p-dw2.h
+++ b/src/qml/jsruntime/qv4unwindhelper_p-dw2.h
@@ -89,7 +89,7 @@ static const int initial_location_offset = 28;
static const int address_range_offset = 32;
#endif
-void writeIntPtrValue(unsigned char *addr, intptr_t val)
+void writeIntPtrValue(unsigned char *addr, qintptr val)
{
addr[0] = (val >> 0) & 0xff;
addr[1] = (val >> 8) & 0xff;
@@ -144,7 +144,7 @@ static void ensureUnwindInfo(Function *f)
unsigned char *cie_and_fde = reinterpret_cast<unsigned char *>(info.data());
memcpy(cie_and_fde, cie_fde_data, sizeof(cie_fde_data));
- intptr_t ptr = static_cast<char *>(chunk->pages->base()) - static_cast<char *>(0);
+ qintptr ptr = static_cast<char *>(chunk->pages->base()) - static_cast<char *>(0);
writeIntPtrValue(cie_and_fde + initial_location_offset, ptr);
writeIntPtrValue(cie_and_fde + address_range_offset, chunk->pages->size());
diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp
index 7e6ea59ef9..40caaf379f 100644
--- a/src/qml/qml/ftw/qhashedstring.cpp
+++ b/src/qml/qml/ftw/qhashedstring.cpp
@@ -394,7 +394,7 @@ QString QHashedCStringRef::toUtf16() const
QString rv;
rv.resize(m_length);
- writeUtf16((uint16_t*)rv.data());
+ writeUtf16((quint16*)rv.data());
return rv;
}
diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h
index 4815f787b6..9b7215f0ae 100644
--- a/src/qml/qml/ftw/qhashedstring_p.h
+++ b/src/qml/qml/ftw/qhashedstring_p.h
@@ -64,8 +64,6 @@
#include <stdlib.h>
#endif
-#include <stdint.h>
-
QT_BEGIN_NAMESPACE
// Enable this to debug hash linking assumptions.
@@ -164,7 +162,7 @@ public:
QString toUtf16() const;
inline int utf16length() const;
inline void writeUtf16(QChar *) const;
- inline void writeUtf16(uint16_t *) const;
+ inline void writeUtf16(quint16 *) const;
private:
friend class QHashedStringRef;
@@ -232,7 +230,7 @@ public:
void setQString(bool v) { if (v) next.setFlag(); else next.clearFlag(); }
inline char *cStrData() const { return (char *)ckey; }
- inline uint16_t *utf16Data() const { return (uint16_t *)strData->data(); }
+ inline quint16 *utf16Data() const { return (quint16 *)strData->data(); }
inline bool equals(const QV4::Value &string) const {
QString s = string.toQString();
@@ -1274,10 +1272,10 @@ int QHashedCStringRef::utf16length() const
void QHashedCStringRef::writeUtf16(QChar *output) const
{
- writeUtf16((uint16_t *)output);
+ writeUtf16((quint16 *)output);
}
-void QHashedCStringRef::writeUtf16(uint16_t *output) const
+void QHashedCStringRef::writeUtf16(quint16 *output) const
{
int l = m_length;
const char *d = m_data;
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h
index 7ac10a6d63..40d42d8284 100644
--- a/src/qml/qml/qqmlabstractbinding_p.h
+++ b/src/qml/qml/qqmlabstractbinding_p.h
@@ -171,7 +171,7 @@ private:
// the vTables array are used for dispatching.
// This saves a compiler-generated pointer to a compiler-generated vTable, and thus reduces
// the binding object size by sizeof(void*).
- uintptr_t m_nextBindingPtr;
+ qintptr m_nextBindingPtr;
static VTable *vTables[];
inline const VTable *vtable() const { return vTables[bindingType()]; }
@@ -200,7 +200,7 @@ QQmlAbstractBinding *QQmlAbstractBinding::nextBinding() const
void QQmlAbstractBinding::setNextBinding(QQmlAbstractBinding *b)
{
- m_nextBindingPtr = uintptr_t(b) | (m_nextBindingPtr & 0x3);
+ m_nextBindingPtr = qintptr(b) | (m_nextBindingPtr & 0x3);
}
QQmlAbstractBinding::BindingType QQmlAbstractBinding::bindingType() const
diff --git a/src/qml/qml/qqmlaccessors_p.h b/src/qml/qml/qqmlaccessors_p.h
index 6df624eaf1..1a4aae0ef7 100644
--- a/src/qml/qml/qqmlaccessors_p.h
+++ b/src/qml/qml/qqmlaccessors_p.h
@@ -94,7 +94,7 @@ class QQmlNotifier;
} while (false);
#define QML_PRIVATE_ACCESSOR(clazz, cpptype, name, variable) \
- static void clazz ## _ ## name ## Read(QObject *o, intptr_t, void *rv) \
+ static void clazz ## _ ## name ## Read(QObject *o, qintptr, void *rv) \
{ \
clazz ## Private *d = clazz ## Private::get(static_cast<clazz *>(o)); \
*static_cast<cpptype *>(rv) = d->variable; \
@@ -105,15 +105,15 @@ class QQmlNotifier;
class QQmlAccessors
{
public:
- void (*read)(QObject *object, intptr_t property, void *output);
- void (*notifier)(QObject *object, intptr_t property, QQmlNotifier **notifier);
+ void (*read)(QObject *object, qintptr property, void *output);
+ void (*notifier)(QObject *object, qintptr property, QQmlNotifier **notifier);
};
namespace QQmlAccessorProperties {
struct Property {
const char *name;
unsigned int nameLength;
- intptr_t data;
+ qintptr data;
QQmlAccessors *accessors;
};
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index c07144a66c..4694e33abd 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -416,7 +416,7 @@ QV4::Value QQmlNumberExtension::toLocaleString(QV4::SimpleCallContext *ctx)
GET_LOCALE_DATA_RESOURCE(ctx->arguments[0]);
- uint16_t format = 'f';
+ quint16 format = 'f';
if (ctx->argumentCount > 1) {
if (!ctx->arguments[1].isString())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index da016c90a5..3d4b260574 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -61,15 +61,15 @@ static Callback QQmlNotifier_callbacks[] = {
void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a)
{
- intptr_t originalSenderPtr;
- intptr_t *disconnectWatch;
+ qintptr originalSenderPtr;
+ qintptr *disconnectWatch;
if (!endpoint->isNotifying()) {
originalSenderPtr = endpoint->senderPtr;
disconnectWatch = &originalSenderPtr;
- endpoint->senderPtr = intptr_t(disconnectWatch) | 0x1;
+ endpoint->senderPtr = qintptr(disconnectWatch) | 0x1;
} else {
- disconnectWatch = (intptr_t *)(endpoint->senderPtr & ~0x1);
+ disconnectWatch = (qintptr *)(endpoint->senderPtr & ~0x1);
}
if (endpoint->next)
@@ -111,7 +111,7 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine
qPrintable(engineName));
}
- senderPtr = intptr_t(source);
+ senderPtr = qintptr(source);
this->sourceSignal = sourceSignal;
QQmlPropertyPrivate::flushSignal(source, sourceSignal);
QQmlData *ddata = QQmlData::get(source, true);
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index daba6e856d..21fee28b02 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -205,7 +205,7 @@ public:
};
struct { // When HasAccessors
QQmlAccessors *accessors;
- intptr_t accessorData;
+ qintptr accessorData;
};
};
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index a7c7416b5f..b6a3ae1ea5 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -106,7 +106,7 @@ void printFocusTree(QQuickItem *item, QQuickItem *scope, int depth)
}
#endif
-static void QQuickItem_parentNotifier(QObject *o, intptr_t, QQmlNotifier **n)
+static void QQuickItem_parentNotifier(QObject *o, qintptr, QQmlNotifier **n)
{
QQuickItemPrivate *d = QQuickItemPrivate::get(static_cast<QQuickItem *>(o));
*n = &d->parentNotifier;
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index ce7b7f69eb..c8f8574f9d 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -398,7 +398,7 @@ public:
return QMatrix4x4();
float matVals[16];
- for (uint32_t i = 0; i < 16; ++i) {
+ for (quint32 i = 0; i < 16; ++i) {
QV4::Value v = array->getIndexed(i);
if (!v.isNumber())
return QMatrix4x4();