From d3c1c626f569e5aa58085425924cca45927b6199 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Sun, 4 Feb 2018 23:07:12 +0000 Subject: Deal with covered switches consistently (#4161) * Fixes a number of ": not all control paths return a value" warnings on MSVC. * Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults. * Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message() --- src/WorldStorage/FastNBT.h | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) (limited to 'src/WorldStorage/FastNBT.h') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index 1894903ac..0185a49ec 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -125,41 +125,8 @@ enum class eNBTParseError npUnknownTag, }; - - - - -class cNBTParseErrorCategory final: - public std::error_category -{ - cNBTParseErrorCategory() = default; -public: - /** Category name */ - virtual const char * name() const NOEXCEPT override - { - return "NBT parse error"; - } - - /** Maps a parse error code to an error message */ - virtual AString message(int a_Condition) const override; - - /** Returns the canonical error category instance. */ - static const cNBTParseErrorCategory & Get() - { - static cNBTParseErrorCategory Category; - return Category; - } -}; - - - - - // The following is required to make an error_code constructible from an eNBTParseError -inline std::error_code make_error_code(eNBTParseError a_Err) NOEXCEPT -{ - return { static_cast(a_Err), cNBTParseErrorCategory::Get() }; -} +std::error_code make_error_code(eNBTParseError a_Err) NOEXCEPT; namespace std { -- cgit v1.2.3