diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-02-19 13:24:27 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-02-19 13:27:48 (GMT) |
commit | 09dc6df0472957d75f6c99cf81c939cb9a31602c (patch) | |
tree | 437c9a3ea9239a44752373463116651dc4efa763 /src/script | |
parent | ce2201566188a7b079c073b6a9aae637455aa530 (diff) | |
download | Qt-09dc6df0472957d75f6c99cf81c939cb9a31602c.zip Qt-09dc6df0472957d75f6c99cf81c939cb9a31602c.tar.gz Qt-09dc6df0472957d75f6c99cf81c939cb9a31602c.tar.bz2 |
Work around MSVC2008 compiler crash
"e:\pulse\work\91088\src\script\api\qscriptengine.h(360) :
fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c[0x510A0530:0x00000007]', line 243)
To work around this problem, try simplifying or changing the program near the locations listed above."
Apparently the compiler doesn't like that a few functions are inlined.
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 15 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 13 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 739b3fc..33104c9 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -393,6 +393,21 @@ qsreal ToInteger(qsreal n) return sign * ::floor(::fabs(n)); } +#ifdef Q_CC_MSVC +// MSVC2008 crashes if these are inlined. + +QString ToString(qsreal value) +{ + return JSC::UString::from(value); +} + +qsreal ToNumber(const QString &value) +{ + return ((JSC::UString)value).toDouble(); +} + +#endif + void GlobalClientData::mark(JSC::MarkStack& markStack) { engine->mark(markStack); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index eff34af..f69e537 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -106,12 +106,18 @@ namespace QScript inline bool ToBool(qsreal); inline bool ToBool(const QString &); - inline qsreal ToNumber(const QString &); inline qint32 ToInt32(const QString &); inline quint32 ToUInt32(const QString &); inline quint16 ToUInt16(const QString &); inline qsreal ToInteger(const QString &); +#ifdef Q_CC_MSVC + // MSVC2008 crashes if these are inlined. + qsreal ToNumber(const QString &); + QString ToString(qsreal); +#else + inline qsreal ToNumber(const QString &); inline QString ToString(qsreal); +#endif //some conversion helper functions inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec); @@ -463,6 +469,9 @@ inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec) return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine; } +#ifndef Q_CC_MSVC +// MSVC2008 crashes if these are inlined. + inline QString ToString(qsreal value) { return JSC::UString::from(value); @@ -473,6 +482,8 @@ inline qsreal ToNumber(const QString &value) return ((JSC::UString)value).toDouble(); } +#endif + inline qint32 ToInt32(const QString &value) { return ToInt32(ToNumber(value)); |