Bug 1125371 - Silence some GCC-only warnings about uninitialized varaibles when building with --enable-optimize. r=jandem.

--HG--
extra : rebase_source : dae6430359a99e683639e740248d58899350c9e2
This commit is contained in:
Jason Orendorff 2015-01-23 16:05:38 -06:00
Родитель f233dc0d72
Коммит 7b38f74598
10 изменённых файлов: 19 добавлений и 15 удалений

Просмотреть файл

@ -1919,13 +1919,13 @@ class ModuleChars
public:
static uint32_t beginOffset(AsmJSParser &parser) {
return parser.pc->maybeFunction->pn_pos.begin;
return parser.pc->maybeFunction->pn_pos.begin;
}
static uint32_t endOffset(AsmJSParser &parser) {
TokenPos pos;
MOZ_ALWAYS_TRUE(parser.tokenStream.peekTokenPos(&pos));
return pos.end;
TokenPos pos(0, 0); // initialize to silence GCC warning
MOZ_ALWAYS_TRUE(parser.tokenStream.peekTokenPos(&pos));
return pos.end;
}
};

Просмотреть файл

@ -635,6 +635,7 @@ class RetType
RetType() : which_(Which(-1)) {}
MOZ_IMPLICIT RetType(Which w) : which_(w) {}
MOZ_IMPLICIT RetType(AsmJSCoercion coercion) {
which_ = Which(-1); // initialize to silence GCC warning
switch (coercion) {
case AsmJS_ToInt32: which_ = Signed; break;
case AsmJS_ToNumber: which_ = Double; break;
@ -3031,7 +3032,7 @@ class FunctionCompiler
uint32_t line, column;
m_.tokenStream().srcCoords.lineNumAndColumnIndex(call.node_->pn_pos.begin, &line, &column);
CallSiteDesc::Kind kind;
CallSiteDesc::Kind kind = CallSiteDesc::Kind(-1); // initialize to silence GCC warning
switch (callee.which()) {
case MAsmJSCall::Callee::Internal: kind = CallSiteDesc::Relative; break;
case MAsmJSCall::Callee::Dynamic: kind = CallSiteDesc::Register; break;
@ -7292,7 +7293,7 @@ CheckChangeHeap(ModuleCompiler &m, ParseNode *fn, bool *validated)
if (ParseNode *elseStmt = TernaryKid3(stmtIter))
return m.fail(elseStmt, "unexpected else statement");
uint32_t mask, min, max;
uint32_t mask, min = 0, max; // initialize min to silence GCC warning
if (!CheckHeapLengthCondition(m, cond, newBufferName, &mask, &min, &max))
return false;
@ -7416,7 +7417,7 @@ CheckFunction(ModuleCompiler &m, LifoAlloc &lifo, MIRGenerator **mir, ModuleComp
// the backing LifoAlloc after parsing/compiling each function.
AsmJSParser::Mark mark = m.parser().mark();
ParseNode *fn;
ParseNode *fn = nullptr; // initialize to silence GCC warning
if (!ParseFunction(m, &fn))
return false;

Просмотреть файл

@ -3101,6 +3101,7 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo
if (bce->script->bindingIsAliased(bi)) {
ScopeCoordinate sc;
sc.setHops(0);
sc.setSlot(0); // initialize to silence GCC warning
JS_ALWAYS_TRUE(LookupAliasedNameSlot(bce, bce->script, cx->names().arguments, &sc));
if (!EmitAliasedVarOp(cx, JSOP_SETALIASEDVAR, sc, DontCheckLexical, bce))
return false;

Просмотреть файл

@ -7533,6 +7533,8 @@ ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space)
Value expandoVal;
if (kind == ICStub::GetProp_CallDOMProxyNative) {
expandoVal = expandoSlot;
expandoAndGeneration = nullptr; // initialize to silence GCC warning
generation = 0; // initialize to silence GCC warning
} else {
MOZ_ASSERT(kind == ICStub::GetProp_CallDOMProxyWithGenerationNative);
MOZ_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined());

Просмотреть файл

@ -7552,7 +7552,7 @@ IonBuilder::pushReferenceLoadFromTypedObject(MDefinition *typedObj,
types::TemporaryTypeSet *observedTypes = bytecodeTypes(pc);
MInstruction *load;
MInstruction *load = nullptr; // initialize to silence GCC warning
BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(),
typedObj, name, observedTypes);
@ -11634,7 +11634,7 @@ IonBuilder::storeReferenceTypedObjectValue(MDefinition *typedObj,
size_t alignment = ReferenceTypeDescr::alignment(type);
loadTypedObjectElements(typedObj, byteOffset, alignment, &elements, &scaledOffset, &adjustment);
MInstruction *store;
MInstruction *store = nullptr; // initialize to silence GCC warning
switch (type) {
case ReferenceTypeDescr::TYPE_ANY:
if (NeedsPostBarrier(info(), value))

Просмотреть файл

@ -47,7 +47,7 @@ Requirement::toString() const
char *cursor = buf;
char *end = cursor + sizeof(buf);
int n;
int n = -1; // initialize to silence GCC warning
switch (kind()) {
case NONE:
return "none";

Просмотреть файл

@ -2574,7 +2574,7 @@ IonBuilder::inlineConstructSimdObject(CallInfo &callInfo, SimdTypeDescr *descr)
return InliningStatus_NotInlined;
// Generic constructor of SIMD valuesX4.
MIRType simdType;
MIRType simdType = MIRType(-1); // initialize to silence GCC warning
switch (descr->type()) {
case SimdTypeDescr::TYPE_INT32:
simdType = MIRType_Int32x4;

Просмотреть файл

@ -171,7 +171,7 @@ LIRGeneratorX64::visitAsmJSStoreHeap(MAsmJSStoreHeap *ins)
? useRegisterAtStart(ptr)
: useRegisterOrNonNegativeConstantAtStart(ptr);
LAsmJSStoreHeap *lir;
LAsmJSStoreHeap *lir = nullptr; // initialize to silence GCC warning
switch (ins->viewType()) {
case Scalar::Int8:
case Scalar::Uint8:

Просмотреть файл

@ -182,7 +182,7 @@ str_escape(JSContext *cx, unsigned argc, Value *vp)
return false;
ScopedJSFreePtr<Latin1Char> newChars;
uint32_t newLength;
uint32_t newLength = 0; // initialize to silence GCC warning
if (str->hasLatin1Chars()) {
AutoCheckCannotGC nogc;
newChars = Escape(cx, str->latin1Chars(nogc), str->length(), &newLength);

Просмотреть файл

@ -485,8 +485,8 @@ js::ConcatStrings(ExclusiveContext *cx,
? JSInlineString::lengthFits<Latin1Char>(wholeLength)
: JSInlineString::lengthFits<char16_t>(wholeLength);
if (canUseInline && cx->isJSContext()) {
Latin1Char *latin1Buf;
char16_t *twoByteBuf;
Latin1Char *latin1Buf = nullptr; // initialize to silence GCC warning
char16_t *twoByteBuf = nullptr; // initialize to silence GCC warning
JSInlineString *str = isLatin1
? AllocateInlineString<allowGC>(cx, wholeLength, &latin1Buf)
: AllocateInlineString<allowGC>(cx, wholeLength, &twoByteBuf);