Bug 1698127 - wasm: Default initialize variables of Nothing. r=lth

clang static-analysis complains if you have a variable that is
not initialized at its definition, even if it's always initialized
before it's first use. I don't think it's worth trying to find
a way to appease this warning at this time.

This commit adds initializers to all instances of Nothing to
remove some of these warnings, as this is a trivial case to
fix.

Differential Revision: https://phabricator.services.mozilla.com/D108210
This commit is contained in:
Ryan Hunt 2021-03-18 21:27:39 +00:00
Родитель 696e732ebf
Коммит 00637161f4
2 изменённых файлов: 19 добавлений и 19 удалений

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

@ -10202,7 +10202,7 @@ bool BaseCompiler::endIfThen(ResultType type) {
bool BaseCompiler::emitElse() {
ResultType params, results;
NothingVector unused_thenValues;
NothingVector unused_thenValues{};
if (!iter_.readElse(&params, &results, &unused_thenValues)) {
return false;
@ -10309,7 +10309,7 @@ bool BaseCompiler::endIfThenElse(ResultType type) {
bool BaseCompiler::emitEnd() {
LabelKind kind;
ResultType type;
NothingVector unused_values;
NothingVector unused_values{};
if (!iter_.readEnd(&kind, &type, &unused_values, &unused_values)) {
return false;
}
@ -10362,7 +10362,7 @@ bool BaseCompiler::emitEnd() {
bool BaseCompiler::emitBr() {
uint32_t relativeDepth;
ResultType type;
NothingVector unused_values;
NothingVector unused_values{};
if (!iter_.readBr(&relativeDepth, &type, &unused_values)) {
return false;
}
@ -10393,7 +10393,7 @@ bool BaseCompiler::emitBr() {
bool BaseCompiler::emitBrIf() {
uint32_t relativeDepth;
ResultType type;
NothingVector unused_values;
NothingVector unused_values{};
Nothing unused_condition;
if (!iter_.readBrIf(&relativeDepth, &type, &unused_values,
&unused_condition)) {
@ -10419,7 +10419,7 @@ bool BaseCompiler::emitBrOnNull() {
uint32_t relativeDepth;
ResultType type;
NothingVector unused_values;
NothingVector unused_values{};
Nothing unused_condition;
if (!iter_.readBrOnNull(&relativeDepth, &type, &unused_values,
&unused_condition)) {
@ -10455,7 +10455,7 @@ bool BaseCompiler::emitBrTable() {
Uint32Vector depths;
uint32_t defaultDepth;
ResultType branchParams;
NothingVector unused_values;
NothingVector unused_values{};
Nothing unused_index;
// N.B., `branchParams' gets set to the type of the default branch target. In
// the presence of subtyping, it could be that the different branch targets
@ -10604,7 +10604,7 @@ bool BaseCompiler::emitCatch() {
LabelKind kind;
uint32_t eventIndex;
ResultType paramType, resultType;
NothingVector unused_tryValues;
NothingVector unused_tryValues{};
if (!iter_.readCatch(&kind, &eventIndex, &paramType, &resultType,
&unused_tryValues)) {
@ -10830,7 +10830,7 @@ bool BaseCompiler::endTryCatch(ResultType type) {
bool BaseCompiler::emitThrow() {
uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
uint32_t exnIndex;
NothingVector unused_argValues;
NothingVector unused_argValues{};
if (!iter_.readThrow(&exnIndex, &unused_argValues)) {
return false;
@ -10970,7 +10970,7 @@ void BaseCompiler::doReturn(ContinuationKind kind) {
}
bool BaseCompiler::emitReturn() {
NothingVector unused_values;
NothingVector unused_values{};
if (!iter_.readReturn(&unused_values)) {
return false;
}
@ -11149,7 +11149,7 @@ bool BaseCompiler::emitCall() {
uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
uint32_t funcIndex;
NothingVector args_;
NothingVector args_{};
if (!iter_.readCall(&funcIndex, &args_)) {
return false;
}
@ -11209,7 +11209,7 @@ bool BaseCompiler::emitCallIndirect() {
uint32_t funcTypeIndex;
uint32_t tableIndex;
Nothing callee_;
NothingVector args_;
NothingVector args_{};
if (!iter_.readCallIndirect(&funcTypeIndex, &tableIndex, &callee_, &args_)) {
return false;
}
@ -12511,7 +12511,7 @@ bool BaseCompiler::emitRefAsNonNull() {
bool BaseCompiler::emitAtomicCmpXchg(ValType type, Scalar::Type viewType) {
LinearMemoryAddress<Nothing> addr;
Nothing unused;
Nothing unused{};
if (!iter_.readAtomicCmpXchg(&addr, type, Scalar::byteSize(viewType), &unused,
&unused)) {
@ -13643,7 +13643,7 @@ bool BaseCompiler::emitStructNewWithRtt() {
uint32_t typeIndex;
Nothing rtt;
NothingVector args;
NothingVector args{};
if (!iter_.readStructNewWithRtt(&typeIndex, &rtt, &args)) {
return false;
}
@ -14189,8 +14189,8 @@ bool BaseCompiler::emitBrOnCast() {
uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
uint32_t relativeDepth;
Nothing unused;
NothingVector unused_values;
Nothing unused{};
NothingVector unused_values{};
uint32_t rttTypeIndex;
uint32_t rttDepth;
ResultType branchTargetType;

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

@ -522,7 +522,7 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
}
Nothing nothing;
NothingVector nothings;
NothingVector nothings{};
ResultType unusedType;
switch (op.b0) {
@ -543,12 +543,12 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
CHECK(iter.readDrop());
case uint16_t(Op::Call): {
uint32_t unusedIndex;
NothingVector unusedArgs;
NothingVector unusedArgs{};
CHECK(iter.readCall(&unusedIndex, &unusedArgs));
}
case uint16_t(Op::CallIndirect): {
uint32_t unusedIndex, unusedIndex2;
NothingVector unusedArgs;
NothingVector unusedArgs{};
CHECK(iter.readCallIndirect(&unusedIndex, &unusedIndex2, &nothing,
&unusedArgs));
}
@ -887,7 +887,7 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
switch (op.b1) {
case uint32_t(GcOp::StructNewWithRtt): {
uint32_t unusedUint;
NothingVector unusedArgs;
NothingVector unusedArgs{};
CHECK(
iter.readStructNewWithRtt(&unusedUint, &nothing, &unusedArgs));
}