diff --git a/js/js2/icode.h b/js/js2/icode.h index 7ce11bee74ce..2b6614ff8276 100644 --- a/js/js2/icode.h +++ b/js/js2/icode.h @@ -121,7 +121,7 @@ f << opcodeNames[BRANCH] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset); return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -258,7 +258,7 @@ f << opcodeNames[DEBUGGER]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -435,7 +435,7 @@ f << opcodeNames[JSR] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset); return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -635,7 +635,7 @@ f << opcodeNames[NOP]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -732,7 +732,7 @@ f << opcodeNames[RETURN_VOID]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -747,7 +747,7 @@ f << opcodeNames[RTS]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -967,7 +967,7 @@ f << opcodeNames[TRYIN] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset) << ", " << "Offset " << ((mOp2) ? mOp2->mOffset : NotAnOffset); return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -982,7 +982,7 @@ f << opcodeNames[TRYOUT]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -1038,7 +1038,7 @@ f << opcodeNames[WITHOUT]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; diff --git a/js/js2/icodegenerator.cpp b/js/js2/icodegenerator.cpp index bfe84121f650..fa194e400934 100644 --- a/js/js2/icodegenerator.cpp +++ b/js/js2/icodegenerator.cpp @@ -1902,7 +1902,7 @@ TypedRegister ICodeGenerator::genStmt(StmtNode *p, LabelSet *currentLabelSet) FILE* f = fopen(str.c_str(), "r"); if (f) { Context cx(*mWorld, mGlobal); - JSValue result = cx.readEvalFile(f, *fileName); + (void)cx.readEvalFile(f, *fileName); fclose(f); } } diff --git a/js/js2/interpreter.cpp b/js/js2/interpreter.cpp index 7ac19d1dad6a..6581cc4e6ad9 100644 --- a/js/js2/interpreter.cpp +++ b/js/js2/interpreter.cpp @@ -504,7 +504,7 @@ void Context::initOperatorsPackage() { "defineIdentical", defineIdentical }, }; - for (int i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++) + for (uint i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++) mGlobal->defineNativeFunction(mWorld.identifiers[widenCString(OBOs[i].name)], OBOs[i].fun); mHasOperatorsPackageLoaded = true; @@ -535,7 +535,7 @@ void Context::initContext() { "none", &None_Type } }; - for (int i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++) + for (uint i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++) mGlobal->defineVariable(widenCString(PDTs[i].name), &Type_Type, JSValue(PDTs[i].type)); // set up the correct [[Class]] for the global object (matching SpiderMonkey) diff --git a/js/js2/jsmath.cpp b/js/js2/jsmath.cpp index f624aa4a38f6..566aea0a84fb 100644 --- a/js/js2/jsmath.cpp +++ b/js/js2/jsmath.cpp @@ -190,7 +190,7 @@ struct MathConstantEntry { // the properties of the Math object void JSMath::initMathObject(JSScope *g) { - int i; + uint i; JSMath *m = new JSMath(); m->setClass(new JSString("Math")); diff --git a/js/js2/jstypes.cpp b/js/js2/jstypes.cpp index aea230c5c14a..0745d5a13ab5 100644 --- a/js/js2/jstypes.cpp +++ b/js/js2/jstypes.cpp @@ -58,7 +58,7 @@ static JSValue object_toString(Context *, const JSValues& argv) return kUndefinedValue; } -static JSValue object_constructor(Context *cx, const JSValues& argv) +static JSValue object_constructor(Context *, const JSValues& /*argv*/) { // argv[0] will be NULL return JSValue(new JSObject()); @@ -82,13 +82,13 @@ JSObject *JSObject::initJSObject() { JSObject *result = new JSObject(); - for (int i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++) + for (uint i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++) result->setProperty(widenCString(ObjectFunctions[i].name), JSValue(new JSNativeFunction(ObjectFunctions[i].fn) ) ); return result; } -void JSObject::initObjectObject(JSScope *g) +void JSObject::initObjectObject(JSScope *) { // The ObjectPrototypeObject has already been constructed by static initialization. @@ -168,7 +168,7 @@ void JSFunction::initFunctionObject(JSScope *g) { // first build the Function Prototype Object FunctionPrototypeObject = new JSNativeFunction(functionPrototypeFunction); - for (int i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++) + for (uint i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++) FunctionPrototypeObject->setProperty(widenCString(FunctionFunctions[i].name), JSValue(new JSNativeFunction(FunctionFunctions[i].fn) ) ); ASSERT(g->getProperty(*FunctionString).isObject()); @@ -183,7 +183,7 @@ void JSFunction::initFunctionObject(JSScope *g) JSString* JSBoolean::BooleanString = new JSString("Boolean"); -static JSValue boolean_constructor(Context *cx, const JSValues& argv) +static JSValue boolean_constructor(Context */*cx*/, const JSValues& argv) { // argv[0] will be NULL if (argv.size() > 1) @@ -192,7 +192,7 @@ static JSValue boolean_constructor(Context *cx, const JSValues& argv) return JSValue(new JSBoolean(false)); } -static JSValue boolean_toString(Context *cx, const JSValues& argv) +static JSValue boolean_toString(Context */*cx*/, const JSValues& argv) { if (argv.size() > 0) { JSValue theThis = argv[0]; @@ -209,7 +209,7 @@ static JSValue boolean_toString(Context *cx, const JSValues& argv) return kUndefinedValue; } -static JSValue boolean_valueOf(Context *cx, const JSValues& argv) +static JSValue boolean_valueOf(Context *, const JSValues&) { return kUndefinedValue; } @@ -230,7 +230,7 @@ void JSBoolean::initBooleanObject(JSScope *g) BooleanPrototypeObject = new JSObject(); BooleanPrototypeObject->setClass(new JSString(BooleanString)); - for (int i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++) + for (uint i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++) BooleanPrototypeObject->setProperty(widenCString(BooleanFunctions[i].name), JSValue(new JSNativeFunction(BooleanFunctions[i].fn) ) ); ASSERT(g->getProperty(*BooleanString).isObject()); @@ -240,13 +240,13 @@ void JSBoolean::initBooleanObject(JSScope *g) /********** Date Object Stuff **************************/ -static JSValue date_constructor(Context *cx, const JSValues& argv) +static JSValue date_constructor(Context *, const JSValues&) { // return JSValue(new JSDate()); return JSValue(new JSObject()); } -static JSValue date_invokor(Context *cx, const JSValues& argv) +static JSValue date_invokor(Context *, const JSValues&) { return JSValue(new JSString("now")); } @@ -447,6 +447,8 @@ int JSValue::operator==(const JSValue& value) const case integer_tag : return (this->f64 == value.f64); // question: are all undefined values equal to one another? case undefined_tag: return 1; + default: + NOT_REACHED("Broken compiler?"); } } return 0; @@ -654,7 +656,7 @@ JSValue JSValue::valueToInteger(const JSValue& value) ASSERT(result.tag == f64_tag); result.tag = i32_tag; bool neg = (result.f64 < 0); - result.i32 = floor((neg) ? -result.f64 : result.f64); + result.i32 = (int32)floor((neg) ? -result.f64 : result.f64); result.i32 = (neg) ? -result.i32 : result.i32; return result; } diff --git a/js/js2/jstypes.h b/js/js2/jstypes.h index 2bba970ee01a..1e7bbdd5d041 100644 --- a/js/js2/jstypes.h +++ b/js/js2/jstypes.h @@ -661,7 +661,7 @@ namespace JSTypes { static JSObject* BooleanPrototypeObject; static JSString* BooleanString; public: - JSBoolean(bool value) : mValue(value), JSObject(BooleanPrototypeObject) { setClass(BooleanString); } + JSBoolean(bool value) : JSObject(BooleanPrototypeObject), mValue(value) { setClass(BooleanString); } static void initBooleanObject(JSScope *g); diff --git a/js/js2/tools/gencode.pl b/js/js2/tools/gencode.pl index 338a35b64a5d..d1d353d87180 100644 --- a/js/js2/tools/gencode.pl +++ b/js/js2/tools/gencode.pl @@ -429,8 +429,11 @@ sub collect { my $printops_body = &get_printops_body(@types); my $printops_decl = "virtual Formatter& printOperands(Formatter& f, "; - $printops_decl .= ($dec_list =~ /ArgumentList/) ? - "const JSValues& registers" : +# $printops_decl .= ($dec_list =~ /ArgumentList/) ? +# "const JSValues& registers" : +# "const JSValues& registers"; + $printops_decl .= ($printops_body eq "") ? + "const JSValues& /*registers*/" : "const JSValues& registers"; $printops_decl .= ") {\n"; diff --git a/js2/src/icode.h b/js2/src/icode.h index 7ce11bee74ce..2b6614ff8276 100644 --- a/js2/src/icode.h +++ b/js2/src/icode.h @@ -121,7 +121,7 @@ f << opcodeNames[BRANCH] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset); return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -258,7 +258,7 @@ f << opcodeNames[DEBUGGER]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -435,7 +435,7 @@ f << opcodeNames[JSR] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset); return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -635,7 +635,7 @@ f << opcodeNames[NOP]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -732,7 +732,7 @@ f << opcodeNames[RETURN_VOID]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -747,7 +747,7 @@ f << opcodeNames[RTS]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -967,7 +967,7 @@ f << opcodeNames[TRYIN] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset) << ", " << "Offset " << ((mOp2) ? mOp2->mOffset : NotAnOffset); return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -982,7 +982,7 @@ f << opcodeNames[TRYOUT]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; @@ -1038,7 +1038,7 @@ f << opcodeNames[WITHOUT]; return f; } - virtual Formatter& printOperands(Formatter& f, const JSValues& registers) { + virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) { return f; } }; diff --git a/js2/src/icodegenerator.cpp b/js2/src/icodegenerator.cpp index bfe84121f650..fa194e400934 100644 --- a/js2/src/icodegenerator.cpp +++ b/js2/src/icodegenerator.cpp @@ -1902,7 +1902,7 @@ TypedRegister ICodeGenerator::genStmt(StmtNode *p, LabelSet *currentLabelSet) FILE* f = fopen(str.c_str(), "r"); if (f) { Context cx(*mWorld, mGlobal); - JSValue result = cx.readEvalFile(f, *fileName); + (void)cx.readEvalFile(f, *fileName); fclose(f); } } diff --git a/js2/src/interpreter.cpp b/js2/src/interpreter.cpp index 7ac19d1dad6a..6581cc4e6ad9 100644 --- a/js2/src/interpreter.cpp +++ b/js2/src/interpreter.cpp @@ -504,7 +504,7 @@ void Context::initOperatorsPackage() { "defineIdentical", defineIdentical }, }; - for (int i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++) + for (uint i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++) mGlobal->defineNativeFunction(mWorld.identifiers[widenCString(OBOs[i].name)], OBOs[i].fun); mHasOperatorsPackageLoaded = true; @@ -535,7 +535,7 @@ void Context::initContext() { "none", &None_Type } }; - for (int i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++) + for (uint i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++) mGlobal->defineVariable(widenCString(PDTs[i].name), &Type_Type, JSValue(PDTs[i].type)); // set up the correct [[Class]] for the global object (matching SpiderMonkey) diff --git a/js2/src/jsmath.cpp b/js2/src/jsmath.cpp index f624aa4a38f6..566aea0a84fb 100644 --- a/js2/src/jsmath.cpp +++ b/js2/src/jsmath.cpp @@ -190,7 +190,7 @@ struct MathConstantEntry { // the properties of the Math object void JSMath::initMathObject(JSScope *g) { - int i; + uint i; JSMath *m = new JSMath(); m->setClass(new JSString("Math")); diff --git a/js2/src/jstypes.cpp b/js2/src/jstypes.cpp index aea230c5c14a..0745d5a13ab5 100644 --- a/js2/src/jstypes.cpp +++ b/js2/src/jstypes.cpp @@ -58,7 +58,7 @@ static JSValue object_toString(Context *, const JSValues& argv) return kUndefinedValue; } -static JSValue object_constructor(Context *cx, const JSValues& argv) +static JSValue object_constructor(Context *, const JSValues& /*argv*/) { // argv[0] will be NULL return JSValue(new JSObject()); @@ -82,13 +82,13 @@ JSObject *JSObject::initJSObject() { JSObject *result = new JSObject(); - for (int i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++) + for (uint i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++) result->setProperty(widenCString(ObjectFunctions[i].name), JSValue(new JSNativeFunction(ObjectFunctions[i].fn) ) ); return result; } -void JSObject::initObjectObject(JSScope *g) +void JSObject::initObjectObject(JSScope *) { // The ObjectPrototypeObject has already been constructed by static initialization. @@ -168,7 +168,7 @@ void JSFunction::initFunctionObject(JSScope *g) { // first build the Function Prototype Object FunctionPrototypeObject = new JSNativeFunction(functionPrototypeFunction); - for (int i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++) + for (uint i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++) FunctionPrototypeObject->setProperty(widenCString(FunctionFunctions[i].name), JSValue(new JSNativeFunction(FunctionFunctions[i].fn) ) ); ASSERT(g->getProperty(*FunctionString).isObject()); @@ -183,7 +183,7 @@ void JSFunction::initFunctionObject(JSScope *g) JSString* JSBoolean::BooleanString = new JSString("Boolean"); -static JSValue boolean_constructor(Context *cx, const JSValues& argv) +static JSValue boolean_constructor(Context */*cx*/, const JSValues& argv) { // argv[0] will be NULL if (argv.size() > 1) @@ -192,7 +192,7 @@ static JSValue boolean_constructor(Context *cx, const JSValues& argv) return JSValue(new JSBoolean(false)); } -static JSValue boolean_toString(Context *cx, const JSValues& argv) +static JSValue boolean_toString(Context */*cx*/, const JSValues& argv) { if (argv.size() > 0) { JSValue theThis = argv[0]; @@ -209,7 +209,7 @@ static JSValue boolean_toString(Context *cx, const JSValues& argv) return kUndefinedValue; } -static JSValue boolean_valueOf(Context *cx, const JSValues& argv) +static JSValue boolean_valueOf(Context *, const JSValues&) { return kUndefinedValue; } @@ -230,7 +230,7 @@ void JSBoolean::initBooleanObject(JSScope *g) BooleanPrototypeObject = new JSObject(); BooleanPrototypeObject->setClass(new JSString(BooleanString)); - for (int i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++) + for (uint i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++) BooleanPrototypeObject->setProperty(widenCString(BooleanFunctions[i].name), JSValue(new JSNativeFunction(BooleanFunctions[i].fn) ) ); ASSERT(g->getProperty(*BooleanString).isObject()); @@ -240,13 +240,13 @@ void JSBoolean::initBooleanObject(JSScope *g) /********** Date Object Stuff **************************/ -static JSValue date_constructor(Context *cx, const JSValues& argv) +static JSValue date_constructor(Context *, const JSValues&) { // return JSValue(new JSDate()); return JSValue(new JSObject()); } -static JSValue date_invokor(Context *cx, const JSValues& argv) +static JSValue date_invokor(Context *, const JSValues&) { return JSValue(new JSString("now")); } @@ -447,6 +447,8 @@ int JSValue::operator==(const JSValue& value) const case integer_tag : return (this->f64 == value.f64); // question: are all undefined values equal to one another? case undefined_tag: return 1; + default: + NOT_REACHED("Broken compiler?"); } } return 0; @@ -654,7 +656,7 @@ JSValue JSValue::valueToInteger(const JSValue& value) ASSERT(result.tag == f64_tag); result.tag = i32_tag; bool neg = (result.f64 < 0); - result.i32 = floor((neg) ? -result.f64 : result.f64); + result.i32 = (int32)floor((neg) ? -result.f64 : result.f64); result.i32 = (neg) ? -result.i32 : result.i32; return result; } diff --git a/js2/src/jstypes.h b/js2/src/jstypes.h index 2bba970ee01a..1e7bbdd5d041 100644 --- a/js2/src/jstypes.h +++ b/js2/src/jstypes.h @@ -661,7 +661,7 @@ namespace JSTypes { static JSObject* BooleanPrototypeObject; static JSString* BooleanString; public: - JSBoolean(bool value) : mValue(value), JSObject(BooleanPrototypeObject) { setClass(BooleanString); } + JSBoolean(bool value) : JSObject(BooleanPrototypeObject), mValue(value) { setClass(BooleanString); } static void initBooleanObject(JSScope *g); diff --git a/js2/tools/gencode.pl b/js2/tools/gencode.pl index 338a35b64a5d..d1d353d87180 100644 --- a/js2/tools/gencode.pl +++ b/js2/tools/gencode.pl @@ -429,8 +429,11 @@ sub collect { my $printops_body = &get_printops_body(@types); my $printops_decl = "virtual Formatter& printOperands(Formatter& f, "; - $printops_decl .= ($dec_list =~ /ArgumentList/) ? - "const JSValues& registers" : +# $printops_decl .= ($dec_list =~ /ArgumentList/) ? +# "const JSValues& registers" : +# "const JSValues& registers"; + $printops_decl .= ($printops_body eq "") ? + "const JSValues& /*registers*/" : "const JSValues& registers"; $printops_decl .= ") {\n";