Permalink
Browse files

Avoid some missing case warnings.

In cases where it's intentional, be explicit to avoid warnings.
  • Loading branch information...
unknownbrackets committed Jun 30, 2018
1 parent 250885d commit 92c18c240cf5828c90c8c326974b8fc128640ec7
@@ -201,6 +201,9 @@ bool CMipsInstruction::Validate()
if (immediateData.secondary.type == MipsImmediateType::Ins)
immediateData.secondary.value += immediateData.primary.value;
break;
case MipsImmediateType::Cop2BranchType:
default:
break;
}
}
@@ -291,6 +294,9 @@ void CMipsInstruction::encodeNormal() const
case MipsImmediateType::ImmediateHalfFloat:
encoding |= immediateData.primary.value;
break;
default:
// TODO: Assert?
break;
}
switch (immediateData.secondary.type)
@@ -305,6 +311,9 @@ void CMipsInstruction::encodeNormal() const
case MipsImmediateType::Cop2BranchType:
encoding |= immediateData.secondary.value << 18;
break;
default:
// TODO: Assert?
break;
}
if (opcodeData.opcode.flags & MO_VFPU_MIXED)
@@ -341,6 +350,9 @@ void CMipsInstruction::encodeVfpu() const
case MipsImmediateType::Immediate7:
encoding |= immediateData.primary.value << 0;
break;
default:
// TODO: Assert?
break;
}
g_fileManager->writeU32((uint32_t)encoding);
@@ -55,6 +55,8 @@ bool CDirectiveConditional::evaluate()
return label->isDefined();
case ConditionType::IFNDEF:
return !label->isDefined();
default:
break;
}
Logger::queueError(Logger::Error,L"Invalid conditional type");
@@ -123,6 +123,8 @@ size_t CDirectiveData::getUnitSize() const
case EncodingMode::U64:
case EncodingMode::Double:
return 8;
case EncodingMode::Invalid:
break;
}
return 0;
@@ -143,6 +145,8 @@ size_t CDirectiveData::getDataSize() const
case EncodingMode::Float:
case EncodingMode::Double:
return normalData.size()*getUnitSize();
case EncodingMode::Invalid:
break;
}
return 0;
@@ -366,6 +370,9 @@ void CDirectiveData::Encode() const
g_fileManager->writeU64((uint64_t)value);
}
break;
case EncodingMode::Invalid:
// TODO: Assert?
break;
}
}
@@ -421,6 +428,9 @@ void CDirectiveData::writeTempData(TempData& tempData) const
str += swprintf(str,20,L"0x%16llX,",(uint64_t)normalData[i]);
}
break;
case EncodingMode::Invalid:
// TODO: Assert?
break;
}
*(str-1) = 0;
@@ -451,5 +461,8 @@ void CDirectiveData::writeSymData(SymbolData& symData) const
case EncodingMode::Double:
symData.addData(position,getDataSize(),SymbolData::Data64);
break;
case EncodingMode::Invalid:
// TODO: Assert?
break;
}
}
@@ -70,6 +70,8 @@ bool CDirectiveFile::Validate()
closeFile = g_fileManager->getOpenFile();
g_fileManager->closeFile();
return false;
case Type::Invalid:
break;
}
return false;
@@ -87,6 +89,9 @@ void CDirectiveFile::Encode() const
case Type::Close:
g_fileManager->closeFile();
break;
case Type::Invalid:
// TODO: Assert?
break;
}
}
@@ -109,6 +114,9 @@ void CDirectiveFile::writeTempData(TempData& tempData) const
case Type::Close:
str = L".close";
break;
case Type::Invalid:
// TODO: Assert?
break;
}
tempData.writeLine(virtualAddress,str);
@@ -127,6 +135,9 @@ void CDirectiveFile::writeSymData(SymbolData& symData) const
if (closeFile)
closeFile->endSymData(symData);
break;
case Type::Invalid:
// TODO: Assert?
break;
}
}
@@ -88,6 +88,8 @@ ExpressionValue ExpressionValue::operator-(const ExpressionValue& other) const
result.type = ExpressionValueType::Float;
result.floatValue = floatValue - other.floatValue;
break;
default:
break;
}
return result;
@@ -114,6 +116,8 @@ ExpressionValue ExpressionValue::operator*(const ExpressionValue& other) const
result.type = ExpressionValueType::Float;
result.floatValue = floatValue * other.floatValue;
break;
default:
break;
}
return result;
@@ -151,6 +155,8 @@ ExpressionValue ExpressionValue::operator/(const ExpressionValue& other) const
result.type = ExpressionValueType::Float;
result.floatValue = floatValue / other.floatValue;
break;
default:
break;
}
return result;
@@ -176,6 +182,8 @@ ExpressionValue ExpressionValue::operator%(const ExpressionValue& other) const
}
result.intValue = intValue % other.intValue;
break;
default:
break;
}
return result;
@@ -216,6 +224,8 @@ ExpressionValue ExpressionValue::operator<<(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = ((uint64_t) intValue) << other.intValue;
break;
default:
break;
}
return result;
@@ -230,6 +240,8 @@ ExpressionValue ExpressionValue::operator>>(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = ((uint64_t) intValue) >> other.intValue;
break;
default:
break;
}
return result;
@@ -247,6 +259,8 @@ bool ExpressionValue::operator<(const ExpressionValue& other) const
return intValue < other.floatValue;
case ExpressionValueCombination::FF:
return floatValue < other.floatValue;
default:
break;
}
return false;
@@ -264,6 +278,8 @@ bool ExpressionValue::operator<=(const ExpressionValue& other) const
return intValue <= other.floatValue;
case ExpressionValueCombination::FF:
return floatValue <= other.floatValue;
default:
break;
}
return false;
@@ -320,6 +336,8 @@ ExpressionValue ExpressionValue::operator&(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = intValue & other.intValue;
break;
default:
break;
}
return result;
@@ -334,6 +352,8 @@ ExpressionValue ExpressionValue::operator|(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = intValue | other.intValue;
break;
default:
break;
}
return result;
@@ -358,6 +378,8 @@ ExpressionValue ExpressionValue::operator&&(const ExpressionValue& other) const
case ExpressionValueCombination::FF:
result.floatValue = floatValue && other.floatValue;
break;
default:
break;
}
return result;
@@ -382,6 +404,8 @@ ExpressionValue ExpressionValue::operator||(const ExpressionValue& other) const
case ExpressionValueCombination::FF:
result.floatValue = floatValue || other.floatValue;
break;
default:
break;
}
return result;
@@ -396,6 +420,8 @@ ExpressionValue ExpressionValue::operator^(const ExpressionValue& other) const
result.type = ExpressionValueType::Integer;
result.intValue = intValue ^ other.intValue;
break;
default:
break;
}
return result;
@@ -440,6 +466,8 @@ ExpressionInternal::ExpressionInternal(const std::wstring& value, OperatorType t
break;
case OperatorType::String:
break;
default:
break;
}
}
@@ -599,6 +627,8 @@ bool ExpressionInternal::simplify(bool inUnknownOrFalseBlock)
if (isExpressionFunctionSafe(strValue, inUnknownOrFalseBlock) == false)
return false;
break;
default:
break;
}
// check if the same applies to all children
@@ -257,6 +257,8 @@ ExpressionValue expFuncAbs(const std::wstring& funcName, const std::vector<Expre
result.intValue = parameters[0].intValue >= 0 ?
parameters[0].intValue : -parameters[0].intValue;
break;
default:
break;
}
return result;
@@ -56,6 +56,8 @@ void Logger::setFlags(ErrorType type)
error = true;
fatalError = true;
break;
case Notice:
break;
}
}
@@ -240,7 +240,7 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveConditional(Parser& parser, int
const Token &next = parser.nextToken();
const std::wstring stringValue = next.getStringValue();
ConditionalResult elseResult = condResult;
ConditionalResult elseResult;
switch (condResult)
{
case ConditionalResult::True:
@@ -249,6 +249,9 @@ std::unique_ptr<CAssemblerCommand> parseDirectiveConditional(Parser& parser, int
case ConditionalResult::False:
elseResult = ConditionalResult::True;
break;
case ConditionalResult::Unknown:
elseResult = condResult;
break;
}
parser.pushConditionalResult(elseResult);
@@ -14,9 +14,6 @@ static ExpressionInternal* primaryExpression(Tokenizer& tokenizer)
{
const Token &tok = tokenizer.peekToken();
if (tok.type == TokenType::Invalid)
return nullptr;
switch (tok.type)
{
case TokenType::Float:
@@ -38,16 +35,21 @@ static ExpressionInternal* primaryExpression(Tokenizer& tokenizer)
tokenizer.eatToken();
return new ExpressionInternal(tok.intValue);
case TokenType::LParen:
tokenizer.eatToken();
ExpressionInternal* exp = expression(tokenizer);
if (tokenizer.nextToken().type != TokenType::RParen)
{
delete exp;
return nullptr;
}
tokenizer.eatToken();
ExpressionInternal* exp = expression(tokenizer);
return exp;
if (tokenizer.nextToken().type != TokenType::RParen)
{
delete exp;
return nullptr;
}
return exp;
}
case TokenType::Invalid:
default:
break;
}
return nullptr;
@@ -140,6 +142,8 @@ static ExpressionInternal* multiplicativeExpression(Tokenizer& tokenizer)
case TokenType::Mod:
op = OperatorType::Mod;
break;
default:
break;
}
if (op == OperatorType::Invalid)
@@ -177,6 +181,8 @@ static ExpressionInternal* additiveExpression(Tokenizer& tokenizer)
case TokenType::Minus:
op = OperatorType::Sub;
break;
default:
break;
}
if (op == OperatorType::Invalid)
@@ -214,6 +220,8 @@ static ExpressionInternal* shiftExpression(Tokenizer& tokenizer)
case TokenType::RightShift:
op = OperatorType::RightShift;
break;
default:
break;
}
if (op == OperatorType::Invalid)
@@ -257,6 +265,8 @@ static ExpressionInternal* relationalExpression(Tokenizer& tokenizer)
case TokenType::GreaterEqual:
op = OperatorType::GreaterEqual;
break;
default:
break;
}
if (op == OperatorType::Invalid)
@@ -294,6 +304,8 @@ static ExpressionInternal* equalityExpression(Tokenizer& tokenizer)
case TokenType::NotEqual:
op = OperatorType::NotEqual;
break;
default:
break;
}
if (op == OperatorType::Invalid)
Oops, something went wrong.

0 comments on commit 92c18c2

Please sign in to comment.