Bug 1012971 - SpiderMonkey: Fix various warnings. r=nbp

This commit is contained in:
Dan Gohman 2014-05-22 11:15:06 -07:00
parent 9d60155558
commit ad6d8397a0
13 changed files with 52 additions and 52 deletions

View File

@ -1165,7 +1165,9 @@ class PersistentRooted : private mozilla::LinkedListElement<PersistentRooted<T>
registerWithRuntime(rt);
}
PersistentRooted(PersistentRooted &rhs) : ptr(rhs.ptr)
PersistentRooted(PersistentRooted &rhs)
: mozilla::LinkedListElement<PersistentRooted<T> >(),
ptr(rhs.ptr)
{
/*
* Copy construction takes advantage of the fact that the original

View File

@ -1162,6 +1162,7 @@ if test "$GNU_CC"; then
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)

View File

@ -177,7 +177,6 @@ class OsiIndex
// < highest - - - - - - - - - - - - - - lowest >
static const uintptr_t FRAMESIZE_SHIFT = 4;
static const uintptr_t FRAMETYPE_BITS = 4;
static const uintptr_t FRAMETYPE_MASK = (1 << FRAMETYPE_BITS) - 1;
// Ion frames have a few important numbers associated with them:
// Local depth: The number of bytes required to spill local variables.
@ -464,7 +463,7 @@ class IonExitFrameLayout : public IonCommonFrameLayout
public:
// Pushed for "bare" fake exit frames that have no GC things on stack to be
// marked.
static JitCode *const BareToken() { return (JitCode *)0xFF; }
static JitCode *BareToken() { return (JitCode *)0xFF; }
static inline size_t Size() {
return sizeof(IonExitFrameLayout);
@ -518,7 +517,7 @@ class IonNativeExitFrameLayout
uint32_t hiCalleeResult_;
public:
static JitCode *const Token() { return (JitCode *)0x0; }
static JitCode *Token() { return (JitCode *)0x0; }
static inline size_t Size() {
return sizeof(IonNativeExitFrameLayout);
@ -556,7 +555,7 @@ class IonOOLNativeExitFrameLayout
uint32_t hiThis_;
public:
static JitCode *const Token() { return (JitCode *)0x4; }
static JitCode *Token() { return (JitCode *)0x4; }
static inline size_t Size(size_t argc) {
// The frame accounts for the callee/result and |this|, so we only need args.
@ -602,7 +601,7 @@ class IonOOLPropertyOpExitFrameLayout
JitCode *stubCode_;
public:
static JitCode *const Token() { return (JitCode *)0x5; }
static JitCode *Token() { return (JitCode *)0x5; }
static inline size_t Size() {
return sizeof(IonOOLPropertyOpExitFrameLayout);
@ -654,7 +653,7 @@ class IonOOLProxyExitFrameLayout
JitCode *stubCode_;
public:
static JitCode *const Token() { return (JitCode *)0x6; }
static JitCode *Token() { return (JitCode *)0x6; }
static inline size_t Size() {
return sizeof(IonOOLProxyExitFrameLayout);
@ -694,8 +693,8 @@ class IonDOMExitFrameLayout
uint32_t hiCalleeResult_;
public:
static JitCode *const GetterToken() { return (JitCode *)0x1; }
static JitCode *const SetterToken() { return (JitCode *)0x2; }
static JitCode *GetterToken() { return (JitCode *)0x1; }
static JitCode *SetterToken() { return (JitCode *)0x2; }
static inline size_t Size() {
return sizeof(IonDOMExitFrameLayout);
@ -734,7 +733,7 @@ class IonDOMMethodExitFrameLayout
friend struct IonDOMMethodExitFrameLayoutTraits;
public:
static JitCode *const Token() { return (JitCode *)0x3; }
static JitCode *Token() { return (JitCode *)0x3; }
static inline size_t Size() {
return sizeof(IonDOMMethodExitFrameLayout);

View File

@ -14,8 +14,6 @@
#include "mozilla/Array.h"
#include "jsinfer.h"
#include "jit/CompilerRoot.h"
#include "jit/FixedList.h"
#include "jit/InlineList.h"
@ -37,7 +35,7 @@ class BaselineInspector;
class ValueNumberData;
class Range;
static const inline
static inline
MIRType MIRTypeFromValue(const js::Value &vp)
{
if (vp.isDouble())
@ -1074,7 +1072,7 @@ class MConstant : public MNullaryInstruction
const js::Value *vp() const {
return &value_;
}
const bool valueToBoolean() const {
bool valueToBoolean() const {
// A hack to avoid this wordy pattern everywhere in the JIT.
return ToBoolean(HandleValue::fromMarkedLocation(&value_));
}
@ -8579,13 +8577,13 @@ class MSetDOMProperty
public:
INSTRUCTION_HEADER(SetDOMProperty)
static MSetDOMProperty *New(TempAllocator &alloc, const JSJitSetterOp func, MDefinition *obj,
static MSetDOMProperty *New(TempAllocator &alloc, JSJitSetterOp func, MDefinition *obj,
MDefinition *val)
{
return new(alloc) MSetDOMProperty(func, obj, val);
}
const JSJitSetterOp fun() {
JSJitSetterOp fun() const {
return func_;
}
@ -8652,7 +8650,7 @@ class MGetDOMProperty
return new(alloc) MGetDOMProperty(info, obj, guard);
}
const JSJitGetterOp fun() {
JSJitGetterOp fun() const {
return info_->getter;
}
bool isInfallible() const {

View File

@ -212,7 +212,7 @@ PerfSpewer::writeProfile(JSScript *script,
size_t size = code->instructionsSize();
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%d: Func%02d\n",
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d\n",
reinterpret_cast<uintptr_t>(code->raw()),
size,
script->filename(),
@ -236,7 +236,7 @@ PerfSpewer::writeProfile(JSScript *script,
size_t prologueSize = masm.actualOffset(basicBlocks_[0].start.offset());
if (prologueSize > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%d: Func%02d-Prologue\n",
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Prologue\n",
funcStart, prologueSize, script->filename(), script->lineno(), thisFunctionIndex);
}
@ -249,7 +249,7 @@ PerfSpewer::writeProfile(JSScript *script,
JS_ASSERT(cur <= blockStart);
if (cur < blockStart) {
fprintf(PerfFilePtr, "%zx %zx %s:%d: Func%02d-Block?\n",
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Block?\n",
static_cast<uintptr_t>(cur),
static_cast<uintptr_t>(blockStart - cur),
script->filename(), script->lineno(),
@ -269,7 +269,7 @@ PerfSpewer::writeProfile(JSScript *script,
JS_ASSERT(cur <= funcEndInlineCode);
if (cur < funcEndInlineCode) {
fprintf(PerfFilePtr, "%zx %zx %s:%d: Func%02d-Epilogue\n",
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Epilogue\n",
cur, funcEndInlineCode - cur,
script->filename(), script->lineno(),
thisFunctionIndex);
@ -277,7 +277,7 @@ PerfSpewer::writeProfile(JSScript *script,
JS_ASSERT(funcEndInlineCode <= funcEnd);
if (funcEndInlineCode < funcEnd) {
fprintf(PerfFilePtr, "%zx %zx %s:%d: Func%02d-OOL\n",
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-OOL\n",
funcEndInlineCode, funcEnd - funcEndInlineCode,
script->filename(), script->lineno(),
thisFunctionIndex);
@ -299,7 +299,7 @@ js::jit::writePerfSpewerBaselineProfile(JSScript *script, JitCode *code)
size_t size = code->instructionsSize();
if (size > 0) {
fprintf(PerfFilePtr, "%zx %zx %s:%d: Baseline\n",
fprintf(PerfFilePtr, "%zx %zx %s:%zu: Baseline\n",
reinterpret_cast<uintptr_t>(code->raw()),
size, script->filename(), script->lineno());
}

View File

@ -60,7 +60,7 @@ struct AnyRegister {
const char *name() const {
return isFloat() ? fpu().name() : gpr().name();
}
const Code code() const {
Code code() const {
return code_;
}
bool volatile_() const {

View File

@ -244,7 +244,7 @@ struct ThreadSafeContext : ContextFriendFields,
public:
static size_t offsetOfAllocator() { return offsetof(ThreadSafeContext, allocator_); }
inline Allocator *const allocator();
inline Allocator *allocator() const;
// Allocations can only trigger GC when running on the main thread.
inline AllowGC allowGC() const { return isJSContext() ? CanGC : NoGC; }

View File

@ -42,8 +42,8 @@ struct AutoMarkInDeadZone
bool scheduled;
};
inline Allocator *const
ThreadSafeContext::allocator()
inline Allocator *
ThreadSafeContext::allocator() const
{
JS_ASSERT_IF(isJSContext(), &asJSContext()->zone()->allocator == allocator_);
return allocator_;

View File

@ -1610,7 +1610,7 @@ ExpressionDecompiler::write(JSString *str)
bool
ExpressionDecompiler::quote(JSString *s, uint32_t quote)
{
return QuoteString(&sprinter, s, quote) >= 0;
return QuoteString(&sprinter, s, quote) != nullptr;
}
JSAtom *

View File

@ -3422,11 +3422,11 @@ JSScript::getStaticScope(jsbytecode *pc)
if (!hasBlockScopes())
return nullptr;
ptrdiff_t offset = pc - main();
if (offset < 0)
if (pc < main())
return nullptr;
size_t offset = pc - main();
BlockScopeArray *scopes = blockScopes();
NestedScopeObject *blockChain = nullptr;

View File

@ -755,7 +755,7 @@ CreateMappedArrayBuffer(JSContext *cx, unsigned argc, Value *vp)
JS_ReportError(cx, "Unable to stat file");
return false;
}
if (st.st_size < offset) {
if (st.st_size < off_t(offset)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_ARG_INDEX_OUT_OF_RANGE, "2");
return false;

View File

@ -388,14 +388,14 @@ struct uint8_clamped {
};
/* Note that we can't use std::numeric_limits here due to uint8_clamped. */
template<typename T> inline const bool TypeIsFloatingPoint() { return false; }
template<> inline const bool TypeIsFloatingPoint<float>() { return true; }
template<> inline const bool TypeIsFloatingPoint<double>() { return true; }
template<typename T> inline bool TypeIsFloatingPoint() { return false; }
template<> inline bool TypeIsFloatingPoint<float>() { return true; }
template<> inline bool TypeIsFloatingPoint<double>() { return true; }
template<typename T> inline const bool TypeIsUnsigned() { return false; }
template<> inline const bool TypeIsUnsigned<uint8_t>() { return true; }
template<> inline const bool TypeIsUnsigned<uint16_t>() { return true; }
template<> inline const bool TypeIsUnsigned<uint32_t>() { return true; }
template<typename T> inline bool TypeIsUnsigned() { return false; }
template<> inline bool TypeIsUnsigned<uint8_t>() { return true; }
template<> inline bool TypeIsUnsigned<uint16_t>() { return true; }
template<> inline bool TypeIsUnsigned<uint32_t>() { return true; }
} // namespace js

View File

@ -172,16 +172,16 @@ js::ClampDoubleToUint8(const double x)
return y;
}
template<typename NativeType> static inline const int TypeIDOfType();
template<> inline const int TypeIDOfType<int8_t>() { return ScalarTypeDescr::TYPE_INT8; }
template<> inline const int TypeIDOfType<uint8_t>() { return ScalarTypeDescr::TYPE_UINT8; }
template<> inline const int TypeIDOfType<int16_t>() { return ScalarTypeDescr::TYPE_INT16; }
template<> inline const int TypeIDOfType<uint16_t>() { return ScalarTypeDescr::TYPE_UINT16; }
template<> inline const int TypeIDOfType<int32_t>() { return ScalarTypeDescr::TYPE_INT32; }
template<> inline const int TypeIDOfType<uint32_t>() { return ScalarTypeDescr::TYPE_UINT32; }
template<> inline const int TypeIDOfType<float>() { return ScalarTypeDescr::TYPE_FLOAT32; }
template<> inline const int TypeIDOfType<double>() { return ScalarTypeDescr::TYPE_FLOAT64; }
template<> inline const int TypeIDOfType<uint8_clamped>() { return ScalarTypeDescr::TYPE_UINT8_CLAMPED; }
template<typename NativeType> static inline int TypeIDOfType();
template<> inline int TypeIDOfType<int8_t>() { return ScalarTypeDescr::TYPE_INT8; }
template<> inline int TypeIDOfType<uint8_t>() { return ScalarTypeDescr::TYPE_UINT8; }
template<> inline int TypeIDOfType<int16_t>() { return ScalarTypeDescr::TYPE_INT16; }
template<> inline int TypeIDOfType<uint16_t>() { return ScalarTypeDescr::TYPE_UINT16; }
template<> inline int TypeIDOfType<int32_t>() { return ScalarTypeDescr::TYPE_INT32; }
template<> inline int TypeIDOfType<uint32_t>() { return ScalarTypeDescr::TYPE_UINT32; }
template<> inline int TypeIDOfType<float>() { return ScalarTypeDescr::TYPE_FLOAT32; }
template<> inline int TypeIDOfType<double>() { return ScalarTypeDescr::TYPE_FLOAT64; }
template<> inline int TypeIDOfType<uint8_clamped>() { return ScalarTypeDescr::TYPE_UINT8_CLAMPED; }
template<typename ElementType>
static inline JSObject *
@ -195,9 +195,9 @@ class TypedArrayObjectTemplate : public TypedArrayObject
public:
typedef NativeType ThisType;
typedef TypedArrayObjectTemplate<NativeType> ThisTypedArrayObject;
static const int ArrayTypeID() { return TypeIDOfType<NativeType>(); }
static const bool ArrayTypeIsUnsigned() { return TypeIsUnsigned<NativeType>(); }
static const bool ArrayTypeIsFloatingPoint() { return TypeIsFloatingPoint<NativeType>(); }
static int ArrayTypeID() { return TypeIDOfType<NativeType>(); }
static bool ArrayTypeIsUnsigned() { return TypeIsUnsigned<NativeType>(); }
static bool ArrayTypeIsFloatingPoint() { return TypeIsFloatingPoint<NativeType>(); }
static const size_t BYTES_PER_ELEMENT = sizeof(ThisType);