From b79c80a6dddaf2c84d939b748da9c0e392811a6a Mon Sep 17 00:00:00 2001 From: "rogerl%netscape.com" Date: Fri, 1 Nov 2002 20:55:10 +0000 Subject: [PATCH] Whole slew of Linux build warning fixes. Fixed over-pop from default constructor. git-svn-id: svn://10.0.0.236/trunk@132832 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js2/src/bytecodecontainer.cpp | 9 ++--- mozilla/js2/src/bytecodecontainer.h | 13 +++---- mozilla/js2/src/epimetheus.cpp | 7 ++-- mozilla/js2/src/js2array.cpp | 6 ++-- mozilla/js2/src/js2date.cpp | 17 ++++----- mozilla/js2/src/js2engine.cpp | 21 +++++------ mozilla/js2/src/js2engine.h | 15 ++++---- mozilla/js2/src/js2eval.cpp | 6 +--- mozilla/js2/src/js2math.cpp | 5 +-- mozilla/js2/src/js2metadata.cpp | 52 +++++++++++++-------------- mozilla/js2/src/js2metadata.h | 28 +++++++-------- mozilla/js2/src/js2number.cpp | 5 +-- mozilla/js2/src/js2op_arithmetic.cpp | 10 +++--- mozilla/js2/src/js2op_invocation.cpp | 2 +- mozilla/js2/src/js2regexp.cpp | 7 ++-- mozilla/js2/src/js2string.cpp | 17 ++++----- mozilla/js2/src/jslong.h | 4 +-- mozilla/js2/src/systemtypes.h | 8 ++++- mozilla/js2/src/world.cpp | 10 ++++-- 19 files changed, 107 insertions(+), 135 deletions(-) diff --git a/mozilla/js2/src/bytecodecontainer.cpp b/mozilla/js2/src/bytecodecontainer.cpp index 4d758f46cd1..205546a43c6 100644 --- a/mozilla/js2/src/bytecodecontainer.cpp +++ b/mozilla/js2/src/bytecodecontainer.cpp @@ -33,10 +33,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif @@ -106,7 +103,7 @@ namespace MetaData { { adjustStack(op); addByte((uint8)op); - pcMap.push_back(MapEntry(mBuffer.size(), pos)); + pcMap.push_back(MapEntry((uint16)mBuffer.size(), pos)); } // insert the opcode, marking it's position in the pcmap and @@ -115,7 +112,7 @@ namespace MetaData { { adjustStack(op, effect); addByte((uint8)op); - pcMap.push_back(std::pair(mBuffer.size(), pos)); + pcMap.push_back(std::pair((uint16)mBuffer.size(), pos)); } // Track the high-water mark for the stack diff --git a/mozilla/js2/src/bytecodecontainer.h b/mozilla/js2/src/bytecodecontainer.h index ca8fc1bc054..86598f159bf 100644 --- a/mozilla/js2/src/bytecodecontainer.h +++ b/mozilla/js2/src/bytecodecontainer.h @@ -33,10 +33,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #ifndef bytecodecontainer_h___ @@ -80,7 +77,7 @@ public: uint32 mLocation; }; -#define NotALabel (-1) +#define NotALabel (BytecodeContainer::LabelID)(-1) class Multiname; class Frame; @@ -135,10 +132,10 @@ public: // Maintain list of associated pointers, so as to keep the objects safe across gc's - void addMultiname(Multiname *mn) { mMultinameList.push_back(mn); addShort(mMultinameList.size() - 1); } - void addFrame(Frame *f) { mFrameList.push_back(f); addShort(mFrameList.size() - 1); } + void addMultiname(Multiname *mn) { mMultinameList.push_back(mn); addShort((uint16)(mMultinameList.size() - 1)); } + void addFrame(Frame *f) { mFrameList.push_back(f); addShort((uint16)(mFrameList.size() - 1)); } void saveFrame(Frame *f) { mFrameList.push_back(f); } - void addRegExp(RegExpInstance *x, size_t pos) { emitOp(eRegExp, pos); mRegExpList.push_back(x); addShort(mRegExpList.size() - 1); } + void addRegExp(RegExpInstance *x, size_t pos) { emitOp(eRegExp, pos); mRegExpList.push_back(x); addShort((uint16)(mRegExpList.size() - 1)); } void addOffset(int32 v) { mBuffer.insert(mBuffer.end(), (uint8 *)&v, (uint8 *)(&v) + sizeof(int32)); } void setOffset(uint32 index, int32 v) { *((int32 *)(mBuffer.begin() + index)) = v; } diff --git a/mozilla/js2/src/epimetheus.cpp b/mozilla/js2/src/epimetheus.cpp index 406c11c3faa..92cd894251c 100644 --- a/mozilla/js2/src/epimetheus.cpp +++ b/mozilla/js2/src/epimetheus.cpp @@ -22,8 +22,7 @@ // #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information - #pragma warning(disable: 4786) +#include "msvc_pragma.h" #endif #define EXITCODE_RUNTIME_ERROR 3 @@ -202,7 +201,7 @@ static bool processArgs(int argc, char **argv, int *result) using namespace MetaData; -js2val print(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 argc) +js2val print(JS2Metadata * /* meta */, const js2val /* thisValue */, js2val argv[], uint32 argc) { for (uint32 i = 0; i < argc; i++) { stdOut << *metadata->toString(argv[i]) << '\n'; @@ -210,7 +209,7 @@ js2val print(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 ar return JS2VAL_UNDEFINED; } -js2val load(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 argc) +js2val load(JS2Metadata *meta, const js2val /* thisValue */, js2val argv[], uint32 argc) { // Set the environment to global object and system frame so that the // load happens into the top frame. diff --git a/mozilla/js2/src/js2array.cpp b/mozilla/js2/src/js2array.cpp index 7a9954d2551..ee5121ee1d5 100644 --- a/mozilla/js2/src/js2array.cpp +++ b/mozilla/js2/src/js2array.cpp @@ -32,12 +32,10 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif + #include #include #include diff --git a/mozilla/js2/src/js2date.cpp b/mozilla/js2/src/js2date.cpp index 0bec9565545..2b271807d51 100644 --- a/mozilla/js2/src/js2date.cpp +++ b/mozilla/js2/src/js2date.cpp @@ -32,10 +32,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #include @@ -104,7 +101,7 @@ static float64 firstDayOfMonth[2][12] = { #define Day(t) floor((t) / msPerDay) #define TIMECLIP(d) ((JSDOUBLE_IS_FINITE(d) \ && !((d < 0 ? -d : d) > HalfTimeDomain)) \ - ? meta->engine->toInt32(d + (+0.)) : nan) + ? JS2Engine::float64toInt32(d + (+0.)) : nan) #define LocalTime(t) ((t) + LocalTZA + DaylightSavingTA(t)) #define DayFromMonth(m, leap) firstDayOfMonth[leap][(int32)m]; #define DayFromYear(y) (365 * ((y)-1970) + fd::floor(((y)-1969)/4.0) \ @@ -393,7 +390,7 @@ static js2val Date_makeTime(JS2Metadata *meta, const js2val thisValue, js2val *a *date = nan; return meta->engine->nanValue; } - args[i] = meta->engine->allocNumber(toInt32(f)); + args[i] = (float64)(JS2Engine::float64toInt32(f)); } if (local) @@ -459,7 +456,7 @@ static js2val Date_makeDate(JS2Metadata *meta, const js2val thisValue, js2val *a *date = nan; return meta->engine->nanValue; } - args[i] = meta->engine->allocNumber(toInt32(f)); + args[i] = (float64)(JS2Engine::float64toInt32(f)); } /* return NaN if date is NaN and we're not setting the year, @@ -853,7 +850,7 @@ static js2val Date_format(JS2Metadata *meta, float64 date, formatspec format) #define MAXARGS 7 -js2val Date_Constructor(JS2Metadata *meta, const js2val thisValue, js2val *argv, uint32 argc) +js2val Date_Constructor(JS2Metadata *meta, const js2val /* thisValue */, js2val *argv, uint32 argc) { js2val thatValue = OBJECT_TO_JS2VAL(new DateInstance(meta->dateClass)); DateInstance *thisInst = checked_cast(JS2VAL_TO_OBJECT(thatValue)); @@ -898,7 +895,7 @@ js2val Date_Constructor(JS2Metadata *meta, const js2val thisValue, js2val *argv, thisInst->ms = nan; return thatValue; } - array[loop] = meta->engine->allocNumber(meta->engine->toInt32(double_arg)); + array[loop] = meta->engine->allocNumber(JS2Engine::float64toInt32(double_arg)); } else { if (loop == 2) { array[loop] = 1; /* Default the date argument to 1. */ @@ -1292,7 +1289,7 @@ static js2val Date_setYear(JS2Metadata *meta, const js2val thisValue, js2val arg return meta->engine->allocNumber(*date); } - year = meta->engine->toInt32(year); + year = JS2Engine::float64toInt32(year); if (!JSDOUBLE_IS_FINITE(result)) { t = +0.0; diff --git a/mozilla/js2/src/js2engine.cpp b/mozilla/js2/src/js2engine.cpp index a601a077d55..1714e000f87 100644 --- a/mozilla/js2/src/js2engine.cpp +++ b/mozilla/js2/src/js2engine.cpp @@ -35,10 +35,7 @@ /* JS2 Engine - */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #include @@ -181,7 +178,7 @@ namespace MetaData { } u; u.x = x; - uint8 hash = u.a[0] ^ u.a[1] ^ u.a[2] ^ u.a[3] ^ u.a[4] ^ u.a[5] ^ u.a[6] ^ u.a[7]; + uint8 hash = (uint8)(u.a[0] ^ u.a[1] ^ u.a[2] ^ u.a[3] ^ u.a[4] ^ u.a[5] ^ u.a[6] ^ u.a[7]); if (float64Table[hash]) { if (*float64Table[hash] == x) return float64Table[hash]; @@ -297,7 +294,7 @@ namespace MetaData { return i; } - int32 JS2Engine::toInt32(float64 d) + int32 JS2Engine::float64toInt32(float64 d) { if ((d == 0.0) || !JSDOUBLE_IS_FINITE(d) ) return 0; @@ -309,7 +306,7 @@ namespace MetaData { return (int32)(d); } - uint32 JS2Engine::toUInt32(float64 d) + uint32 JS2Engine::float64toUInt32(float64 d) { if ((d == 0.0) || !JSDOUBLE_IS_FINITE(d) ) return 0; @@ -321,7 +318,7 @@ namespace MetaData { return (uint32)(d); } - uint16 JS2Engine::toUInt16(float64 d) + uint16 JS2Engine::float64toUInt16(float64 d) { if ((d == 0.0) || !JSDOUBLE_IS_FINITE(d)) return 0; @@ -338,7 +335,7 @@ namespace MetaData { { ASSERT(sp < (execStack + MAX_EXEC_STACK)); js2val *p = ++sp; - for (uint32 i = 0; i < count; i++) { + for (int32 i = 0; i < count; i++) { *p = p[-1]; --p; } @@ -536,14 +533,14 @@ namespace MetaData { // Return the mapped source location for the current pc size_t JS2Engine::errorPos() { - return bCon->getPosition(pc - bCon->getCodeStart()); + return bCon->getPosition((uint16)(pc - bCon->getCodeStart())); } // XXX Default construction of an instance of the class // that is the value at the top of the execution stack - js2val JS2Engine::defaultConstructor(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 argc) + js2val JS2Engine::defaultConstructor(JS2Metadata *meta, const js2val /* thisValue */, js2val /* argv */ [], uint32 /* argc */) { - js2val v = meta->engine->pop(); + js2val v = meta->engine->top(); ASSERT(JS2VAL_IS_OBJECT(v) && !JS2VAL_IS_NULL(v)); JS2Object *obj = JS2VAL_TO_OBJECT(v); ASSERT(obj->kind == ClassKind); diff --git a/mozilla/js2/src/js2engine.h b/mozilla/js2/src/js2engine.h index ca8c08d2213..b5f158b0ca3 100644 --- a/mozilla/js2/src/js2engine.h +++ b/mozilla/js2/src/js2engine.h @@ -36,10 +36,7 @@ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif namespace JavaScript { @@ -162,12 +159,12 @@ public: // Use the pc map in the current bytecode container to get a source offset size_t errorPos(); - static int32 toInt32(float64 f); - static uint32 toUInt32(float64 f); - static uint16 toUInt16(float64 f); + static int32 float64toInt32(float64 f); + static uint32 float64toUInt32(float64 f); + static uint16 float64toUInt16(float64 f); - js2val assignmentConversion(js2val val, JS2Class *type) { return val; } // XXX s'more code, please + js2val assignmentConversion(js2val val, JS2Class * /*type*/) { return val; } // XXX s'more code, please int64 checkInteger(js2val x); @@ -187,7 +184,7 @@ public: js2val allocString(const String &s) { return allocString(&s); } js2val allocString(const char *s) { return STRING_TO_JS2VAL(allocStringPtr(s)); } String *allocStringPtr(const String *s); - String *allocStringPtr(const char *s) { return allocStringPtr(&widenCString(s)); } + String *allocStringPtr(const char *s) { String &str = widenCString(s); return allocStringPtr(&str); } js2val allocFloat(float32 x); js2val pushFloat(float32 x) { js2val retval = allocFloat(x); push(retval); return retval; } diff --git a/mozilla/js2/src/js2eval.cpp b/mozilla/js2/src/js2eval.cpp index b8983f1e5e5..2e85c458afc 100644 --- a/mozilla/js2/src/js2eval.cpp +++ b/mozilla/js2/src/js2eval.cpp @@ -33,13 +33,9 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif - namespace JavaScript { namespace MetaData { diff --git a/mozilla/js2/src/js2math.cpp b/mozilla/js2/src/js2math.cpp index 45334238618..d77c244e0fd 100644 --- a/mozilla/js2/src/js2math.cpp +++ b/mozilla/js2/src/js2math.cpp @@ -32,10 +32,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #include diff --git a/mozilla/js2/src/js2metadata.cpp b/mozilla/js2/src/js2metadata.cpp index 173038878a4..1ed1dc650c0 100644 --- a/mozilla/js2/src/js2metadata.cpp +++ b/mozilla/js2/src/js2metadata.cpp @@ -33,10 +33,7 @@ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif @@ -622,7 +619,7 @@ namespace MetaData { if (!superClass->complete || superClass->final) reportError(Exception::definitionError, "Illegal inheritance", p->pos); JS2Object *proto = NULL; - bool final; + bool final = false; switch (a->memberMod) { case Attribute::NoModifier: final = false; @@ -793,7 +790,7 @@ namespace MetaData { */ { ForStmtNode *f = checked_cast(p); - Reference *v; + Reference *v = NULL; if (f->initializer->getKind() == StmtNode::Var) { VariableStmtNode *vs = checked_cast(f->initializer); VariableBinding *vb = vs->bindings; @@ -1299,7 +1296,6 @@ namespace MetaData { case ExprNode::identifier: { const StringAtom &name = checked_cast(p)->name; - CompoundAttribute *ca = NULL; switch (name.tokenKind) { case Token::Public: return; @@ -1680,7 +1676,7 @@ namespace MetaData { js2val JS2Metadata::EvalExpression(Environment *env, Phase phase, ExprNode *p) { js2val retval; - uint8 *savePC; + uint8 *savePC = NULL; CompilationData *oldData = startCompilationUnit(NULL, bCon->mSource, bCon->mSourceLocation); try { @@ -1962,10 +1958,10 @@ doUnary: { NumUnitExprNode *n = checked_cast(p); if (n->str == L"UL") - bCon->addUInt64(n->num, p->pos); + bCon->addUInt64((uint64)(n->num), p->pos); else if (n->str == L"L") - bCon->addInt64(n->num, p->pos); + bCon->addInt64((uint64)(n->num), p->pos); else reportError(Exception::badValueError, "Unrecognized unit", p->pos); } @@ -2131,7 +2127,7 @@ doUnary: break; case ExprNode::arrayLiteral: { - uint32 argCount = 0; + int32 argCount = 0; PairListExprNode *plen = checked_cast(p); ExprPairList *e = plen->pairs; while (e) { @@ -2143,12 +2139,12 @@ doUnary: e = e->next; } bCon->emitOp(eNewArray, p->pos, -argCount + 1); // pop argCount args and push a new array - bCon->addShort(argCount); + bCon->addShort((uint16)argCount); } break; case ExprNode::objectLiteral: { - uint32 argCount = 0; + int32 argCount = 0; PairListExprNode *plen = checked_cast(p); ExprPairList *e = plen->pairs; while (e) { @@ -2172,7 +2168,7 @@ doUnary: e = e->next; } bCon->emitOp(eNewObject, p->pos, -argCount + 1); // pop argCount args and push a new object - bCon->addShort(argCount); + bCon->addShort((uint16)argCount); } break; case ExprNode::Typeof: @@ -2732,12 +2728,12 @@ doUnary: return result; } - static js2val Object_toString(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 argc) + static js2val Object_toString(JS2Metadata *meta, const js2val /* thisValue */, js2val /* argv */ [], uint32 /* argc */) { return STRING_TO_JS2VAL(meta->engine->object_StringAtom); } - static js2val GlobalObject_isNaN(JS2Metadata *meta, const js2val thisValue, js2val argv[], uint32 argc) + static js2val GlobalObject_isNaN(JS2Metadata *meta, const js2val /* thisValue */, js2val argv[], uint32 /* argc */) { float64 d = meta->toFloat64(argv[0]); return BOOLEAN_TO_JS2VAL(JSDOUBLE_IS_NaN(d)); @@ -2994,7 +2990,7 @@ doUnary: return false; // 'None' } - void DynamicInstance::writeProperty(JS2Metadata *meta, const String *name, js2val newValue) + void DynamicInstance::writeProperty(JS2Metadata * /* meta */, const String *name, js2val newValue) { const DynamicPropertyMap::value_type e(*name, newValue); dynamicProperties.insert(e); @@ -3013,7 +3009,7 @@ doUnary: char16 *numEnd; float64 f = stringToDouble(name->data(), name->data() + name->length(), numEnd); - uint32 index = JS2Engine::toUInt32(f); + uint32 index = JS2Engine::float64toUInt32(f); if (index == f) { uint32 length = getLength(meta, this); @@ -3102,7 +3098,7 @@ doUnary: } // Write a value to the static member - bool JS2Metadata::writeStaticMember(StaticMember *m, js2val newValue, Phase phase) + bool JS2Metadata::writeStaticMember(StaticMember *m, js2val newValue, Phase /* phase */) // phase not used? { if (m == NULL) return false; // 'None' @@ -3437,7 +3433,7 @@ deleteClassProperty: } } - bool JS2Metadata::deleteDynamicProperty(JS2Object *container, Multiname *multiname, LookupKind *lookupKind, bool *result) + bool JS2Metadata::deleteDynamicProperty(JS2Object *container, Multiname *multiname, LookupKind * /* lookupKind */, bool *result) { ASSERT(container && ((container->kind == DynamicInstanceKind) || (container->kind == GlobalObjectKind) @@ -3494,7 +3490,7 @@ deleteClassProperty: // Find a binding that matches the multiname and access. // It's an error if more than one such binding exists. - StaticMember *JS2Metadata::findFlatMember(Frame *container, Multiname *multiname, Access access, Phase phase) + StaticMember *JS2Metadata::findFlatMember(Frame *container, Multiname *multiname, Access access, Phase /* phase */) { StaticMember *found = NULL; StaticBindingIterator b, end; @@ -3530,7 +3526,7 @@ deleteClassProperty: // Find the multiname in the class - either in the static bindings (first) or // in the instance bindings. If not there, look in the super class. - bool JS2Metadata::findStaticMember(JS2Class *c, Multiname *multiname, Access access, Phase phase, MemberDescriptor *result) + bool JS2Metadata::findStaticMember(JS2Class *c, Multiname *multiname, Access access, Phase /* phase */, MemberDescriptor *result) { JS2Class *s = c; while (s) { @@ -3841,14 +3837,14 @@ deleteClassProperty: } if (JS2VAL_IS_FLOAT(x)) { float64 f = *JS2VAL_TO_FLOAT(x); - return toInt32(f); + return JS2Engine::float64toInt32(f); } if (JS2VAL_IS_DOUBLE(x)) { float64 d = *JS2VAL_TO_DOUBLE(x); - return toInt32(d); + return JS2Engine::float64toInt32(d); } float64 d = convertValueToDouble(x); - return toInt32(d); + return JS2Engine::float64toInt32(d); } // Save off info about the current compilation and begin a @@ -4094,7 +4090,7 @@ deleteClassProperty: { if (temps == NULL) temps = new std::vector; - uint16 result = temps->size(); + uint16 result = (uint16)(temps->size()); temps->push_back(JS2VAL_VOID); return result; } @@ -4309,7 +4305,7 @@ deleteClassProperty: // make sure that the thing is 16-byte aligned if (s & 0xF) s += 16 - (s & 0xF); ASSERT(s <= 0x7FFFFFFF); - void *p = pond.allocFromPond((int32)s); + void *p = pond.allocFromPond(s); ASSERT(((ptrdiff_t)p & 0xF) == 0); return p; } @@ -4371,7 +4367,7 @@ deleteClassProperty: } // Allocate from this or the next Pond (make a new one if necessary) - void *Pond::allocFromPond(int32 sz) + void *Pond::allocFromPond(size_t sz) { // Try scannning the free list... PondScum *p = freeHeader; diff --git a/mozilla/js2/src/js2metadata.h b/mozilla/js2/src/js2metadata.h index 4b8bf95a919..cc152d4b502 100644 --- a/mozilla/js2/src/js2metadata.h +++ b/mozilla/js2/src/js2metadata.h @@ -117,7 +117,7 @@ class Pond { public: Pond(size_t sz, Pond *nextPond); - void *allocFromPond(int32 sz); + void *allocFromPond(size_t sz); void returnToPond(PondScum *p); void resetMarks(); @@ -435,7 +435,7 @@ public: std::vector *temps; // temporaries allocted in this frame uint16 allocateTemp(); - virtual void instantiate(Environment *env) { ASSERT(false); } + virtual void instantiate(Environment * /*env*/) { ASSERT(false); } Frame *nextFrame; Frame *pluralFrame; // for a singular frame, this the plural frame from which it will be instantiated @@ -655,8 +655,8 @@ private: bool buildNameList(); const String **nameList; - int32 it; - int32 length; + uint32 it; + uint32 length; }; // A METHODCLOSURE tuple describes an instance method with a bound this value. @@ -674,18 +674,18 @@ public: // References are generated during the eval stage (bytecode generation), but shouldn't live beyond that class Reference { public: - virtual void emitReadBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitWriteBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitReadForInvokeBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitReadForWriteBackBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitWriteBackBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } + virtual void emitReadBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitWriteBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitReadForInvokeBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitReadForWriteBackBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitWriteBackBytecode(BytecodeContainer *, size_t) { ASSERT(false); } - virtual void emitPostIncBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitPostDecBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitPreIncBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } - virtual void emitPreDecBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } + virtual void emitPostIncBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitPostDecBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitPreIncBytecode(BytecodeContainer *, size_t) { ASSERT(false); } + virtual void emitPreDecBytecode(BytecodeContainer *, size_t) { ASSERT(false); } - virtual void emitDeleteBytecode(BytecodeContainer *bCon, size_t pos) { ASSERT(false); } + virtual void emitDeleteBytecode(BytecodeContainer *, size_t) { ASSERT(false); } }; class LexicalReference : public Reference { diff --git a/mozilla/js2/src/js2number.cpp b/mozilla/js2/src/js2number.cpp index 8ad4ea77c9c..58822c3bef5 100644 --- a/mozilla/js2/src/js2number.cpp +++ b/mozilla/js2/src/js2number.cpp @@ -32,10 +32,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #include diff --git a/mozilla/js2/src/js2op_arithmetic.cpp b/mozilla/js2/src/js2op_arithmetic.cpp index 396b7951cd2..e0eb1665d6b 100644 --- a/mozilla/js2/src/js2op_arithmetic.cpp +++ b/mozilla/js2/src/js2op_arithmetic.cpp @@ -393,7 +393,7 @@ float64 y = meta->toFloat64(b); float64 z = x + y; if (JS2VAL_IS_FLOAT(a) || JS2VAL_IS_FLOAT(b)) - pushFloat(z); + pushFloat((float32)z); else pushNumber(z); } @@ -460,7 +460,7 @@ float64 y = meta->toFloat64(b); float64 z = x - y; if (JS2VAL_IS_FLOAT(a) || JS2VAL_IS_FLOAT(b)) - pushFloat(z); + pushFloat((float32)z); else pushNumber(z); } @@ -526,7 +526,7 @@ float64 y = meta->toFloat64(b); float64 z = x * y; if (JS2VAL_IS_FLOAT(a) || JS2VAL_IS_FLOAT(b)) - pushFloat(z); + pushFloat((float32)z); else pushNumber(z); } @@ -592,7 +592,7 @@ float64 y = meta->toFloat64(b); float64 z = x / y; if (JS2VAL_IS_FLOAT(a) || JS2VAL_IS_FLOAT(b)) - pushFloat(z); + pushFloat((float32)z); else pushNumber(z); } @@ -665,7 +665,7 @@ #endif z = fd::fmod(x, y); if (JS2VAL_IS_FLOAT(a) || JS2VAL_IS_FLOAT(b)) - pushFloat(z); + pushFloat((float32)z); else pushNumber(z); } diff --git a/mozilla/js2/src/js2op_invocation.cpp b/mozilla/js2/src/js2op_invocation.cpp index 28a80b1ceff..8b7e7904c4b 100644 --- a/mozilla/js2/src/js2op_invocation.cpp +++ b/mozilla/js2/src/js2op_invocation.cpp @@ -213,7 +213,7 @@ if (obj->kind != ClassKind) meta->reportError(Exception::badValueError, "Type expected", errorPos()); JS2Class *isClass = checked_cast(obj); - push(c == obj); + push(c == isClass); } break; diff --git a/mozilla/js2/src/js2regexp.cpp b/mozilla/js2/src/js2regexp.cpp index c4a951c5c93..27c3a3af10d 100644 --- a/mozilla/js2/src/js2regexp.cpp +++ b/mozilla/js2/src/js2regexp.cpp @@ -32,10 +32,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #include @@ -183,7 +180,7 @@ namespace MetaData { return result; } - js2val RegExp_Constructor(JS2Metadata *meta, const js2val thisValue, js2val *argv, uint32 argc) + js2val RegExp_Constructor(JS2Metadata *meta, const js2val /* thisValue */, js2val *argv, uint32 argc) { // XXX Change constructors to take js2val pointer for the result (which would be an already // rooted pointer). diff --git a/mozilla/js2/src/js2string.cpp b/mozilla/js2/src/js2string.cpp index f90f0c822c5..f632d6cb7f5 100644 --- a/mozilla/js2/src/js2string.cpp +++ b/mozilla/js2/src/js2string.cpp @@ -32,10 +32,7 @@ */ #ifdef _WIN32 - // Turn off warnings about identifiers too long in browser information -#pragma warning(disable: 4786) -#pragma warning(disable: 4711) -#pragma warning(disable: 4710) +#include "msvc_pragma.h" #endif #include @@ -77,7 +74,7 @@ js2val String_fromCharCode(JS2Metadata *meta, const js2val /*thisValue*/, js2val String *resultStr = meta->engine->allocStringPtr((String *)NULL); // can't use Empty_StringAtom; because we're modifying this below resultStr->reserve(argc); for (uint32 i = 0; i < argc; i++) - *resultStr += (char16)(meta->engine->toUInt16(argv[i])); + *resultStr += (char16)(JS2Engine::float64toUInt16(argv[i])); return STRING_TO_JS2VAL(resultStr); } @@ -402,9 +399,9 @@ static js2val String_split(JS2Metadata *meta, const js2val thisValue, js2val *ar js2val limitV = (argc > 1) ? argv[1] : JS2VAL_UNDEFINED; if (JS2VAL_IS_UNDEFINED(limitV)) - lim = toUInt32(two32minus1); + lim = JS2Engine::float64toUInt32(two32minus1); else - lim = toUInt32(limitV); + lim = toUInt32(meta->toInteger(limitV)); uint32 s = S->size(); uint32 p = 0; @@ -581,7 +578,7 @@ static js2val String_lastIndexOf(JS2Metadata *meta, const js2val thisValue, js2v return meta->engine->allocNumber((float64)pos); } -static js2val String_localeCompare(JS2Metadata *meta, const js2val /*thisValue*/, js2val * /*argv*/, uint32 /*argc*/) +static js2val String_localeCompare(JS2Metadata * /* meta */, const js2val /*thisValue*/, js2val * /*argv*/, uint32 /*argc*/) { return JS2VAL_UNDEFINED; } @@ -716,7 +713,7 @@ static js2val String_substring(JS2Metadata *meta, const js2val thisValue, js2val if (!JSDOUBLE_IS_FINITE(farg0)) start = sourceLength; else { - start = JS2Engine::toUInt32(farg0); + start = JS2Engine::float64toUInt32(farg0); if (start > sourceLength) start = sourceLength; } @@ -733,7 +730,7 @@ static js2val String_substring(JS2Metadata *meta, const js2val thisValue, js2val if (!JSDOUBLE_IS_FINITE(farg1)) end = sourceLength; else { - end = JS2Engine::toUInt32(farg1); + end = JS2Engine::float64toUInt32(farg1); if (end > sourceLength) end = sourceLength; } diff --git a/mozilla/js2/src/jslong.h b/mozilla/js2/src/jslong.h index 79dbd4219f7..95df09710d1 100644 --- a/mozilla/js2/src/jslong.h +++ b/mozilla/js2/src/jslong.h @@ -165,13 +165,13 @@ extern int64 JSLL_Zero(); #define JSLL_L2D(d, l) ((d) = (float64)(l)) #ifdef _WIN32 #define JSLL_UL2D(d, ul) { \ - if (ul > JSLL_MAXINT) { \ + if (ul > (uint64)JSLL_MAXINT) { \ int64 _l2 = ul - JSLL_MAXINT; \ JSLL_L2D(d, _l2); \ (d) += JSLL_MININT; \ } \ else \ - (d) = (int64)ul; \ + (d) = (float64)(int64)ul; \ } #else #define JSLL_UL2D(d, ul) ((d) = (float64)(ul)) diff --git a/mozilla/js2/src/systemtypes.h b/mozilla/js2/src/systemtypes.h index eeead7e6fb2..65f45933abc 100644 --- a/mozilla/js2/src/systemtypes.h +++ b/mozilla/js2/src/systemtypes.h @@ -38,9 +38,15 @@ #ifdef _WIN32 // Turn off warnings about identifiers too long in browser information - #pragma warning(disable: 4786) +#pragma warning(disable: 4786) +#pragma warning(disable: 4711) +#pragma warning(disable: 4710) +// Turn off 'failure to generate copy constructor/assignment operator' warning +#pragma warning(disable: 4610) +#pragma warning(disable: 4512) #endif + #define MAX_UINT16 (65535) diff --git a/mozilla/js2/src/world.cpp b/mozilla/js2/src/world.cpp index 487fdc464fa..6c6c7ef51a5 100644 --- a/mozilla/js2/src/world.cpp +++ b/mozilla/js2/src/world.cpp @@ -33,11 +33,15 @@ #ifdef _WIN32 // Turn off warnings about identifiers too long in browser information - #pragma warning(disable: 4786) -//#pragma warning(disable: 4711) -//#pragma warning(disable: 4710) +#pragma warning(disable: 4786) +#pragma warning(disable: 4711) +#pragma warning(disable: 4710) +// Turn off 'failure to generate copy constructor/assignment operator' warning +#pragma warning(disable: 4610) +#pragma warning(disable: 4512) #endif + #include "world.h" namespace JS = JavaScript;