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

Fix -Wswitch warning #2399

Merged
merged 1 commit into from May 11, 2015
Merged

Fix -Wswitch warning #2399

merged 1 commit into from May 11, 2015

Conversation

Tilka
Copy link
Member

@Tilka Tilka commented May 11, 2015

Fixes enumeration value ‘LANGUAGE_UNKNOWN’ not handled in switch

degasus added a commit that referenced this pull request May 11, 2015
@degasus degasus merged commit 7dc6728 into dolphin-emu:master May 11, 2015
@Tilka Tilka deleted the fix_warning branch May 11, 2015 08:56
@lioncash
Copy link
Member

This will still cause warnings on higher warning levels (using default in a switch with enum types (ie. strictly defined case values)). The correct way of doing this is:

u8 WiiConfigPane::GetSADRCountryCode(DiscIO::IVolume::ELanguage language)
{
    switch (language)
    {
    case DiscIO::IVolume::LANGUAGE_JAPANESE:
        return 1;   // Japan
    case DiscIO::IVolume::LANGUAGE_ENGLISH:
        return 49;  // USA
    case DiscIO::IVolume::LANGUAGE_GERMAN:
        return 78;  // Germany
    case DiscIO::IVolume::LANGUAGE_FRENCH:
        return 77;  // France
    case DiscIO::IVolume::LANGUAGE_SPANISH:
        return 105; // Spain
    case DiscIO::IVolume::LANGUAGE_ITALIAN:
        return 83;  // Italy
    case DiscIO::IVolume::LANGUAGE_DUTCH:
        return 94;  // Netherlands
    case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
    case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE:
        return 157; // China
    case DiscIO::IVolume::LANGUAGE_KOREAN:
        return 136; // Korea
    case DiscIO::IVolume::LANGUAGE_UNKNOWN:
        break;
    }

    PanicAlert("Invalid language");
    return 1;
}

@Tilka
Copy link
Member Author

Tilka commented May 11, 2015

@lioncash It's your problem now. 😜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants