diff options
| author | Thomas Fussell <thomas.fussell@gmail.com> | 2017-03-12 17:44:06 -0400 |
|---|---|---|
| committer | Thomas Fussell <thomas.fussell@gmail.com> | 2017-03-12 17:44:06 -0400 |
| commit | 2f42035ab43dd50cd863b51944aa099a99ae60f0 (patch) | |
| tree | 4b6cfd43955e946721c58028fd8564c861d5c331 /toolsrc/src/vcpkg_Checks.cpp | |
| parent | e02e85626f3206feda86a6f5757009005e0cfe3e (diff) | |
| parent | 1c9873a0daf625f67474aaf3e163c592c27ecb65 (diff) | |
| download | vcpkg-2f42035ab43dd50cd863b51944aa099a99ae60f0.tar.gz vcpkg-2f42035ab43dd50cd863b51944aa099a99ae60f0.zip | |
Merge branch 'master' of git://github.com/Microsoft/vcpkg
Diffstat (limited to 'toolsrc/src/vcpkg_Checks.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg_Checks.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index 817ac9e96..02d3480a2 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -1,11 +1,10 @@ +#include "pch.h" #include "vcpkg_Checks.h" - -#include <stdexcept> #include "vcpkg_System.h" -namespace vcpkg {namespace Checks +namespace vcpkg::Checks { - void unreachable() + __declspec(noreturn) void unreachable() { System::println(System::color::error, "Error: Unreachable code was reached"); #ifndef NDEBUG @@ -15,13 +14,13 @@ namespace vcpkg {namespace Checks #endif } - void exit_with_message(const char* errorMessage) + __declspec(noreturn) void exit_with_message(const char* errorMessage) { System::println(System::color::error, errorMessage); exit(EXIT_FAILURE); } - void throw_with_message(const char* errorMessage) + __declspec(noreturn) void throw_with_message(const char* errorMessage) { throw std::runtime_error(errorMessage); } @@ -34,6 +33,14 @@ namespace vcpkg {namespace Checks } } + void check_exit(bool expression) + { + if (!expression) + { + exit(EXIT_FAILURE); + } + } + void check_exit(bool expression, const char* errorMessage) { if (!expression) @@ -41,4 +48,4 @@ namespace vcpkg {namespace Checks exit_with_message(errorMessage); } } -}} +} |
