Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Explicitly declare enum values in switch statements #1996

Closed
wants to merge 1 commit into from

Conversation

lioncash
Copy link
Member

@lioncash lioncash commented Feb 1, 2015

Gets rid of a swath of warnings when compiling with -Weverything.

@@ -296,7 +298,10 @@ u8* GetPointer(const u32 address)
return m_pEXRAM + (address & EXRAM_MASK);
}
else
{

This comment was marked as off-topic.

Gets rid of a swath of warnings when compiling with -Weverything.
@@ -124,11 +120,6 @@ float Interpreter::Helper_Dequantize(const u32 _Addr, const EQuantizeType _quant
case QUANTIZE_S16:
fResult = static_cast<float>((s16)Memory::Read_U16(_Addr)) * m_dequantizeTable[_uScale];
break;

default:

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@BhaaLseN
Copy link
Member

BhaaLseN commented Feb 1, 2015

Regarding those enums, they've been around forever. Maybe @hrydgard used them on purpose instead of a define/const back then, for whatever reason?
They don't look like comprehensive enums that cover every possible value, so those default cases should still be there (altho its probably unlikely for them to be hit, unless some exotic stuff comes around).

@@ -37,6 +37,7 @@ void LoadCodes(const IniFile& globalIni, const IniFile& localIni, std::vector<Ge
// enabled or disabled code
case '+' :
ss.seekg(1);
// Fallthrough

This comment was marked as off-topic.

@ghost
Copy link

ghost commented Feb 2, 2015

The use of enums was probably just to get sensible names to show up when debugging, as sonicadvance1 has already pointed out they don't cover all the usable values and assuming they do is a Bad Idea(tm). Good job fixing the out-of-range-MEM2-access-hitting-the-locked-cache bug though, since it was ignored when I pointed it out 6 months ago...

@lioncash
Copy link
Member Author

Will sort this out when I have time/feel like doing it again.

@lioncash lioncash closed this Apr 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants