Remove Enums::unreachable(). Use Checks::unreachable() instead

This commit is contained in:
Alexander Karatarakis 2017-03-13 17:07:06 -07:00
parent c55bbc3c46
commit 2590371023
6 changed files with 11 additions and 15 deletions

View File

@ -6,6 +6,4 @@ namespace vcpkg::Enums
std::string nullvalue_toString(const std::string& enum_name); std::string nullvalue_toString(const std::string& enum_name);
__declspec(noreturn) void nullvalue_used(const std::string& enum_name); __declspec(noreturn) void nullvalue_used(const std::string& enum_name);
__declspec(noreturn) void unreachable(const std::string& enum_name);
} }

View File

@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include "PostBuildLint_BuildPolicies.h" #include "PostBuildLint_BuildPolicies.h"
#include "vcpkg_Enums.h" #include "vcpkg_Enums.h"
#include "vcpkg_Checks.h"
namespace vcpkg::PostBuildLint::BuildPolicies namespace vcpkg::PostBuildLint::BuildPolicies
{ {
@ -23,7 +24,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies
case NULLVALUE: case NULLVALUE:
return NULLVALUE_STRING; return NULLVALUE_STRING;
default: default:
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
} }
@ -44,7 +45,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies
case NULLVALUE: case NULLVALUE:
Enums::nullvalue_used(ENUM_NAME); Enums::nullvalue_used(ENUM_NAME);
default: default:
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
} }

View File

@ -1,6 +1,6 @@
#include "pch.h" #include "pch.h"
#include "PostBuildLint_BuildType.h" #include "PostBuildLint_BuildType.h"
#include "vcpkg_Enums.h" #include "vcpkg_Checks.h"
namespace vcpkg::PostBuildLint::BuildType namespace vcpkg::PostBuildLint::BuildType
{ {
@ -26,7 +26,7 @@ namespace vcpkg::PostBuildLint::BuildType
return RELEASE_DYNAMIC; return RELEASE_DYNAMIC;
} }
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
const ConfigurationType::type& type::config() const const ConfigurationType::type& type::config() const
@ -57,7 +57,7 @@ namespace vcpkg::PostBuildLint::BuildType
case BuildType::RELEASE_DYNAMIC: case BuildType::RELEASE_DYNAMIC:
return REGEX_RELEASE_DYNAMIC; return REGEX_RELEASE_DYNAMIC;
default: default:
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
} }
@ -79,7 +79,7 @@ namespace vcpkg::PostBuildLint::BuildType
case BuildType::RELEASE_DYNAMIC: case BuildType::RELEASE_DYNAMIC:
return NAME_RELEASE_DYNAMIC; return NAME_RELEASE_DYNAMIC;
default: default:
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
} }
} }

View File

@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include "PostBuildLint_ConfigurationType.h" #include "PostBuildLint_ConfigurationType.h"
#include "vcpkg_Enums.h" #include "vcpkg_Enums.h"
#include "package_spec.h"
namespace vcpkg::PostBuildLint::ConfigurationType namespace vcpkg::PostBuildLint::ConfigurationType
{ {
@ -20,7 +21,7 @@ namespace vcpkg::PostBuildLint::ConfigurationType
case ConfigurationType::NULLVALUE: case ConfigurationType::NULLVALUE:
return NULLVALUE_STRING; return NULLVALUE_STRING;
default: default:
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
} }
} }

View File

@ -1,6 +1,7 @@
#include "pch.h" #include "pch.h"
#include "PostBuildLint_LinkageType.h" #include "PostBuildLint_LinkageType.h"
#include "vcpkg_Enums.h" #include "vcpkg_Enums.h"
#include "vcpkg_Checks.h"
namespace vcpkg::PostBuildLint::LinkageType namespace vcpkg::PostBuildLint::LinkageType
{ {
@ -20,7 +21,7 @@ namespace vcpkg::PostBuildLint::LinkageType
case LinkageType::NULLVALUE: case LinkageType::NULLVALUE:
return NULLVALUE_STRING; return NULLVALUE_STRING;
default: default:
Enums::unreachable(ENUM_NAME); Checks::unreachable(VCPKG_LINE_INFO);
} }
} }

View File

@ -13,9 +13,4 @@ namespace vcpkg::Enums
{ {
Checks::exit_with_message("NULLVALUE of enum %s was used", enum_name); Checks::exit_with_message("NULLVALUE of enum %s was used", enum_name);
} }
__declspec(noreturn) void unreachable(const std::string& enum_name)
{
Checks::exit_with_message("Unreachable code for enum, %s", enum_name);
}
} }