summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-09-25 12:53:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-09-26 13:16:35 +0200
commit8b80ca515d50967086fdebb8df746c280fadf240 (patch)
tree013ed7a5c9d20ffb8698fadd513cac86b5dcbbdd
parent5b87292cbc4f3b94ed6426c526c4f3dcca3eaa55 (diff)
downloadqtscript-8b80ca515d50967086fdebb8df746c280fadf240.tar.gz
Fix C++11 build of qtscript
Change-Id: I168347f42b61ff00574f7ccf59cd24f044ea64f7 Task-number: QTBUG-41361 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp29
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp5
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp12
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp8
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp6
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h5
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp10
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp10
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp6
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp6
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h13
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h32
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h24
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp2
-rw-r--r--src/script/script.pro6
17 files changed, 95 insertions, 83 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp
index 532eedb..885d8a1 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp
@@ -30,7 +30,6 @@
#include "JSString.h"
#include "ObjectPrototype.h"
#include "PrototypeFunction.h"
-#include <math.h>
#include <time.h>
#include <wtf/DateMath.h>
#include <wtf/MathExtras.h>
@@ -89,13 +88,13 @@ JSObject* constructDate(ExecState* exec, const ArgList& args)
value = primitive.toNumber(exec);
}
} else {
- if (isnan(args.at(0).toNumber(exec))
- || isnan(args.at(1).toNumber(exec))
- || (numArgs >= 3 && isnan(args.at(2).toNumber(exec)))
- || (numArgs >= 4 && isnan(args.at(3).toNumber(exec)))
- || (numArgs >= 5 && isnan(args.at(4).toNumber(exec)))
- || (numArgs >= 6 && isnan(args.at(5).toNumber(exec)))
- || (numArgs >= 7 && isnan(args.at(6).toNumber(exec))))
+ if (std::isnan(args.at(0).toNumber(exec))
+ || std::isnan(args.at(1).toNumber(exec))
+ || (numArgs >= 3 && std::isnan(args.at(2).toNumber(exec)))
+ || (numArgs >= 4 && std::isnan(args.at(3).toNumber(exec)))
+ || (numArgs >= 5 && std::isnan(args.at(4).toNumber(exec)))
+ || (numArgs >= 6 && std::isnan(args.at(5).toNumber(exec)))
+ || (numArgs >= 7 && std::isnan(args.at(6).toNumber(exec))))
value = NaN;
else {
GregorianDateTime t;
@@ -157,13 +156,13 @@ static JSValue JSC_HOST_CALL dateNow(ExecState* exec, JSObject*, JSValue, const
static JSValue JSC_HOST_CALL dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
int n = args.size();
- if (isnan(args.at(0).toNumber(exec))
- || isnan(args.at(1).toNumber(exec))
- || (n >= 3 && isnan(args.at(2).toNumber(exec)))
- || (n >= 4 && isnan(args.at(3).toNumber(exec)))
- || (n >= 5 && isnan(args.at(4).toNumber(exec)))
- || (n >= 6 && isnan(args.at(5).toNumber(exec)))
- || (n >= 7 && isnan(args.at(6).toNumber(exec))))
+ if (std::isnan(args.at(0).toNumber(exec))
+ || std::isnan(args.at(1).toNumber(exec))
+ || (n >= 3 && std::isnan(args.at(2).toNumber(exec)))
+ || (n >= 4 && std::isnan(args.at(3).toNumber(exec)))
+ || (n >= 5 && std::isnan(args.at(4).toNumber(exec)))
+ || (n >= 6 && std::isnan(args.at(5).toNumber(exec)))
+ || (n >= 7 && std::isnan(args.at(6).toNumber(exec))))
return jsNaN(exec);
GregorianDateTime t;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp
index 77a92be..506067a 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp
@@ -24,7 +24,6 @@
#include "JSGlobalObject.h"
-#include <math.h>
#include <wtf/DateMath.h>
#include <wtf/MathExtras.h>
@@ -49,7 +48,7 @@ DateInstance::DateInstance(ExecState* exec, double time)
const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const
{
double milli = internalNumber();
- if (isnan(milli))
+ if (std::isnan(milli))
return 0;
if (!m_data)
@@ -65,7 +64,7 @@ const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exe
const GregorianDateTime* DateInstance::calculateGregorianDateTimeUTC(ExecState* exec) const
{
double milli = internalNumber();
- if (isnan(milli))
+ if (std::isnan(milli))
return 0;
if (!m_data)
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp
index ca9d4ea..fe24ecf 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp
@@ -299,7 +299,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, const ArgList& args, in
// milliseconds
if (idx < numArgs) {
double millis = args.at(idx).toNumber(exec);
- ok = isfinite(millis);
+ ok = std::isfinite(millis);
milliseconds += millis;
} else
milliseconds += *ms;
@@ -736,7 +736,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, J
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
- if (isnan(milli))
+ if (std::isnan(milli))
return jsNaN(exec);
double secs = floor(milli / msPerSecond);
@@ -751,7 +751,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
- if (isnan(milli))
+ if (std::isnan(milli))
return jsNaN(exec);
double secs = floor(milli / msPerSecond);
@@ -793,7 +793,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const
DateInstance* thisDateObj = asDateInstance(thisValue);
double milli = thisDateObj->internalNumber();
- if (args.isEmpty() || isnan(milli)) {
+ if (args.isEmpty() || std::isnan(milli)) {
JSValue result = jsNaN(exec);
thisDateObj->setInternalValue(result);
return result;
@@ -837,7 +837,7 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const
double ms = 0;
GregorianDateTime gregorianDateTime;
- if (numArgsToUse == 3 && isnan(milli))
+ if (numArgsToUse == 3 && std::isnan(milli))
msToGregorianDateTime(exec, 0, true, gregorianDateTime);
else {
ms = milli - floor(milli / msPerSecond) * msPerSecond;
@@ -960,7 +960,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t
double ms = 0;
GregorianDateTime gregorianDateTime;
- if (isnan(milli))
+ if (std::isnan(milli))
// Based on ECMA 262 B.2.5 (setYear)
// the time must be reset to +0 if it is NaN.
msToGregorianDateTime(exec, 0, true, gregorianDateTime);
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 0bc1274..2e2853e 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -309,9 +309,9 @@ JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, co
if (value.isDouble()) {
double d = value.asDouble();
- if (isfinite(d))
+ if (std::isfinite(d))
return jsNumber(exec, (d > 0) ? floor(d) : ceil(d));
- if (isnan(d) || isinf(d))
+ if (std::isnan(d) || std::isinf(d))
return jsNaN(exec);
return jsNumber(exec, 0);
}
@@ -326,13 +326,13 @@ JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec, JSObject*, JSValue,
JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
- return jsBoolean(isnan(args.at(0).toNumber(exec)));
+ return jsBoolean(std::isnan(args.at(0).toNumber(exec)));
}
JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
double n = args.at(0).toNumber(exec);
- return jsBoolean(!isnan(n) && !isinf(n));
+ return jsBoolean(!std::isnan(n) && !std::isinf(n));
}
JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec, JSObject*, JSValue, const ArgList& args)
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h
index 06548ce..fccf24b 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h
@@ -490,7 +490,7 @@ namespace JSC {
const int intVal = static_cast<int>(d);
// Check for data loss from conversion to int.
- if (intVal != d || (!intVal && signbit(d)))
+ if (intVal != d || (!intVal && std::signbit(d)))
return fromNumberOutsideIntegerRange(d);
return from(intVal);
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp
index daacbdb..608af9d 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp
@@ -399,7 +399,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
double numericValue;
if (value.getNumber(numericValue)) {
- if (!isfinite(numericValue))
+ if (!std::isfinite(numericValue))
builder.append("null");
else
builder.append(UString::from(numericValue));
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp
index 502312c..9108cfe 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp
@@ -43,7 +43,7 @@ double JSValue::toInteger(ExecState* exec) const
if (isInt32())
return asInt32();
double d = toNumber(exec);
- return isnan(d) ? 0.0 : trunc(d);
+ return std::isnan(d) ? 0.0 : trunc(d);
}
double JSValue::toIntegerPreserveNaN(ExecState* exec) const
@@ -141,7 +141,7 @@ int32_t toInt32SlowCase(double d, bool& ok)
if (d >= -D32 / 2 && d < D32 / 2)
return static_cast<int32_t>(d);
- if (isnan(d) || isinf(d)) {
+ if (std::isnan(d) || std::isinf(d)) {
ok = false;
return 0;
}
@@ -161,7 +161,7 @@ uint32_t toUInt32SlowCase(double d, bool& ok)
if (d >= 0.0 && d < D32)
return static_cast<uint32_t>(d);
- if (isnan(d) || isinf(d)) {
+ if (std::isnan(d) || std::isinf(d)) {
ok = false;
return 0;
}
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h
index 6da921f..501ab5e 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h
@@ -25,7 +25,6 @@
#include "CallData.h"
#include "ConstructData.h"
-#include <math.h>
#include <stddef.h> // for size_t
#include <stdint.h>
#include <wtf/AlwaysInline.h>
@@ -612,7 +611,7 @@ namespace JSC {
inline JSValue::JSValue(ExecState* exec, double d)
{
const int32_t asInt32 = static_cast<int32_t>(d);
- if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0
+ if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0
u.asDouble = d;
return;
}
@@ -693,7 +692,7 @@ namespace JSC {
inline JSValue::JSValue(JSGlobalData* globalData, double d)
{
const int32_t asInt32 = static_cast<int32_t>(d);
- if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0
+ if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0
u.asDouble = d;
return;
}
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp
index 807cfe7..023fe13 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp
@@ -29,6 +29,8 @@
#include <wtf/RandomNumber.h>
#include <wtf/RandomNumberSeed.h>
+using std::signbit;
+
namespace JSC {
ASSERT_CLASS_FITS_IN_CELL(MathObject);
@@ -168,7 +170,7 @@ JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec, JSObject*, JSValue, cons
double result = -Inf;
for (unsigned k = 0; k < argsCount; ++k) {
double val = args.at(k).toNumber(exec);
- if (isnan(val)) {
+ if (std::isnan(val)) {
result = NaN;
break;
}
@@ -184,7 +186,7 @@ JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec, JSObject*, JSValue, cons
double result = +Inf;
for (unsigned k = 0; k < argsCount; ++k) {
double val = args.at(k).toNumber(exec);
- if (isnan(val)) {
+ if (std::isnan(val)) {
result = NaN;
break;
}
@@ -201,9 +203,9 @@ JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec, JSObject*, JSValue, cons
double arg = args.at(0).toNumber(exec);
double arg2 = args.at(1).toNumber(exec);
- if (isnan(arg2))
+ if (std::isnan(arg2))
return jsNaN(exec);
- if (isinf(arg2) && fabs(arg) == 1)
+ if (std::isinf(arg2) && fabs(arg) == 1)
return jsNaN(exec);
return jsNumber(exec, pow(arg, arg2));
}
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp
index 67210fa..584a57f 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -157,7 +157,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec, JSObject*, JSValu
char s[2048 + 3];
const char* lastCharInString = s + sizeof(s) - 1;
double x = v.uncheckedGetNumber();
- if (isnan(x) || isinf(x))
+ if (std::isnan(x) || std::isinf(x))
return jsString(exec, UString::from(x));
bool isNegative = x < 0.0;
@@ -233,7 +233,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec, JSObject*, JSValue
int f = static_cast<int>(df);
double x = v.uncheckedGetNumber();
- if (isnan(x))
+ if (std::isnan(x))
return jsNontrivialString(exec, "NaN");
UString s;
@@ -319,7 +319,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, J
double x = v.uncheckedGetNumber();
- if (isnan(x) || isinf(x))
+ if (std::isnan(x) || std::isinf(x))
return jsString(exec, UString::from(x));
JSValue fractionalDigitsValue = args.at(0);
@@ -345,7 +345,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, J
decimalAdjust = static_cast<int>(logx);
}
- if (isnan(x))
+ if (std::isnan(x))
return jsNontrivialString(exec, "NaN");
if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0
@@ -391,7 +391,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec, JSObject*, JSV
double doublePrecision = args.at(0).toIntegerPreserveNaN(exec);
double x = v.uncheckedGetNumber();
- if (args.at(0).isUndefined() || isnan(x) || isinf(x))
+ if (args.at(0).isUndefined() || std::isnan(x) || std::isinf(x))
return jsString(exec, v.toString(exec));
UString s;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp
index d002e07..6c6a094 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp
@@ -480,7 +480,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec, JSObject*, JSV
dpos = len;
#if OS(SYMBIAN)
// Work around for broken NaN compare operator
- else if (isnan(dpos))
+ else if (std::isnan(dpos))
dpos = len;
#endif
return jsNumber(exec, s.rfind(u2, static_cast<int>(dpos)));
@@ -680,9 +680,9 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec, JSObject*, JSVal
double start = a0.toNumber(exec);
double end = a1.toNumber(exec);
- if (isnan(start))
+ if (std::isnan(start))
start = 0;
- if (isnan(end))
+ if (std::isnan(end))
end = 0;
if (start < 0)
start = 0;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp
index e72f94b..a6eb0d6 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp
@@ -846,7 +846,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString)
bool haveTZ;
int offset;
double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
- if (isnan(ms))
+ if (std::isnan(ms))
return NaN;
// fall back to local timezone
@@ -858,7 +858,7 @@ double parseDateFromNullTerminatedCharacters(const char* dateString)
double timeClip(double t)
{
- if (!isfinite(t))
+ if (!std::isfinite(t))
return NaN;
if (fabs(t) > maxECMAScriptTime)
return NaN;
@@ -971,7 +971,7 @@ double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateSt
bool haveTZ;
int offset;
double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
- if (isnan(ms))
+ if (std::isnan(ms))
return NaN;
// fall back to local timezone
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
index 42a9233..8149375 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
@@ -257,19 +257,20 @@ namespace WTF {
using std::swap;
-#if !COMPILER(MSVC) && !OS(QNX) && !defined(_LIBCPP_VERSION)
- // The Dinkumware C++ library (used by MSVC and QNX) and clang's libc++ have a swap for pairs defined.
+ // Work around MSVC's standard library, whose swap for pairs does not swap by component.
+ template<typename T> inline void hashTableSwap(T& a, T& b)
+ {
+ swap(a, b);
+ }
- // swap pairs by component, in case of pair members that specialize swap
- template<typename T, typename U> inline void swap(pair<T, U>& a, pair<T, U>& b)
+ template<typename T, typename U> inline void hashTableSwap(pair<T, U>& a, pair<T, U>& b)
{
swap(a.first, b.first);
swap(a.second, b.second);
}
-#endif
template<typename T, bool useSwap> struct Mover;
- template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { swap(from, to); } };
+ template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { hashTableSwap(from, to); } };
template<typename T> struct Mover<T, false> { static void move(T& from, T& to) { to = from; } };
template<typename Key, typename Value, typename HashFunctions> class IdentityHashTranslator {
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
index 81a1d8a..7185c1b 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
@@ -28,7 +28,7 @@
#include <float.h>
#include <limits>
-#include <math.h>
+#include <cmath>
#include <stdlib.h>
#if OS(SOLARIS)
@@ -67,20 +67,26 @@ inline double wtf_ceil(double x) { return copysign(ceil(x), x); }
#if OS(SOLARIS)
+namespace std {
+
#ifndef isfinite
inline bool isfinite(double x) { return finite(x) && !isnand(x); }
#endif
+#ifndef signbit
+inline bool signbit(double x) { return copysign(1.0, x) < 0; }
+#endif
#ifndef isinf
inline bool isinf(double x) { return !finite(x) && !isnand(x); }
#endif
-#ifndef signbit
-inline bool signbit(double x) { return x < 0.0; } // FIXME: Wrong for negative 0.
-#endif
+
+} // namespace std
#endif
#if OS(OPENBSD)
+namespace std {
+
#ifndef isfinite
inline bool isfinite(double x) { return finite(x); }
#endif
@@ -88,6 +94,8 @@ inline bool isfinite(double x) { return finite(x); }
inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x; return p->dbl_sign; }
#endif
+} // namespace std
+
#endif
#if (COMPILER(MSVC) && _MSC_VER < 1800) || COMPILER(RVCT)
@@ -115,17 +123,23 @@ inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
#endif
-#if COMPILER(MSVC) && _MSC_VER < 1800
+#if COMPILER(MSVC)
+
+namespace std {
inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
+inline bool isfinite(double x) { return _finite(x); }
+#if _MSC_VER < 1800
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
+#endif
+
+} // namespace std
inline double nextafter(double x, double y) { return _nextafter(x, y); }
inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
inline double copysign(double x, double y) { return _copysign(x, y); }
-inline int isfinite(double x) { return _finite(x); }
// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
inline double wtf_atan2(double x, double y)
@@ -151,10 +165,10 @@ inline double wtf_atan2(double x, double y)
}
// Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) yields NaN instead of x.
-inline double wtf_fmod(double x, double y) { return (!isinf(x) && isinf(y)) ? x : fmod(x, y); }
+extern "C" inline double wtf_fmod(double x, double y) { return (!std::isinf(x) && std::isinf(y)) ? x : fmod(x, y); }
// Work around a bug in the Microsoft CRT, where pow(NaN, 0) yields NaN instead of 1.
-inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
+extern "C" inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
#define atan2(x, y) wtf_atan2(x, y)
#define fmod(x, y) wtf_fmod(x, y)
@@ -185,7 +199,7 @@ inline double wtf_pow(double x, double y)
{
// MinGW-w64 has a custom implementation for pow.
// This handles certain special cases that are different.
- if ((x == 0.0 || isinf(x)) && isfinite(y)) {
+ if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) {
double f;
if (modf(y, &f) != 0.0)
return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
index 7ba487f..3ef0f9f 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
@@ -26,6 +26,9 @@
#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
#include <type_traits>
+#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#include <tr1/memory>
+#endif
#endif
namespace WTF {
@@ -166,13 +169,21 @@ namespace WTF {
typedef T Type;
};
-#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
-
+#if COMPILER(CLANG) || GCC_VERSION_AT_LEAST(4, 6, 0) || (defined(_MSC_VER) && (_MSC_VER >= 1400) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER))
+ // VC8 (VS2005) and later has __has_trivial_constructor and __has_trivial_destructor,
+ // but the implementation returns false for built-in types. We add the extra IsPod condition to
+ // work around this.
+ template <typename T> struct HasTrivialConstructor {
+ static const bool value = __has_trivial_constructor(T) || IsPod<RemoveConstVolatile<T> >::value;
+ };
+ template <typename T> struct HasTrivialDestructor {
+ static const bool value = __has_trivial_destructor(T) || IsPod<RemoveConstVolatile<T> >::value;
+ };
+#elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
// GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace.
// VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace.
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
-
#else
// This compiler doesn't provide type traits, so we provide basic HasTrivialConstructor
@@ -189,15 +200,8 @@ namespace WTF {
typedef IntegralConstant<bool, true> true_type;
typedef IntegralConstant<bool, false> false_type;
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER)
- // VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor,
- // but for some unexplained reason it doesn't work on built-in types.
- template <typename T> struct HasTrivialConstructor : public IntegralConstant<bool, __has_trivial_constructor(T)>{ };
- template <typename T> struct HasTrivialDestructor : public IntegralConstant<bool, __has_trivial_destructor(T)>{ };
-#else
template <typename T> struct HasTrivialConstructor : public false_type{ };
template <typename T> struct HasTrivialDestructor : public false_type{ };
-#endif
template <typename T> struct HasTrivialConstructor<T*> : public true_type{ };
template <typename T> struct HasTrivialDestructor<T*> : public true_type{ };
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp
index 6289d04..fe65042 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp
@@ -2395,7 +2395,7 @@ void doubleToStringInJavaScriptFormat(double d, DtoaBuffer buffer, unsigned* res
ASSERT(buffer);
// avoid ever printing -NaN, in JS conceptually there is only one NaN value
- if (isnan(d)) {
+ if (std::isnan(d)) {
append(buffer, "NaN", 3);
if (resultLength)
*resultLength = 3;
diff --git a/src/script/script.pro b/src/script/script.pro
index d343ab3..e48abac 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -75,10 +75,4 @@ integrity {
CFLAGS += --diag_remark=236,82
}
-# WebKit doesn't compile in C++0x mode
-!mac {
- *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
- CONFIG -= c++11
-}
-
TR_EXCLUDE = $$WEBKITDIR/*