aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg_Checks.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-13 18:37:41 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-10-13 18:37:41 -0700
commite17de99599a2f114faab1bb4821fbaad4d266c95 (patch)
tree397fec8a85af3ef002c125ce013eceb60d27116d /toolsrc/src/vcpkg_Checks.cpp
parent1fb5313a881fe0fcfd90dff5255045c8367ee00b (diff)
downloadvcpkg-e17de99599a2f114faab1bb4821fbaad4d266c95.tar.gz
vcpkg-e17de99599a2f114faab1bb4821fbaad4d266c95.zip
[vcpkg] Re-layout all files using new organization scheme.
All filenames and directories are lowercase. Use dots for namespace separation.
Diffstat (limited to 'toolsrc/src/vcpkg_Checks.cpp')
-rw-r--r--toolsrc/src/vcpkg_Checks.cpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp
deleted file mode 100644
index e7c9046a4..000000000
--- a/toolsrc/src/vcpkg_Checks.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "pch.h"
-
-#include "metrics.h"
-#include "vcpkg_Checks.h"
-#include "vcpkg_GlobalState.h"
-#include "vcpkg_System.h"
-#include "vcpkglib.h"
-
-namespace vcpkg::Checks
-{
- [[noreturn]] static void cleanup_and_exit(const int exit_code)
- {
- const auto elapsed_us = GlobalState::timer.lock()->microseconds();
-
- auto metrics = Metrics::g_metrics.lock();
- metrics->track_metric("elapsed_us", elapsed_us);
- GlobalState::debugging = false;
- metrics->flush();
-
- SetConsoleCP(GlobalState::g_init_console_cp);
- SetConsoleOutputCP(GlobalState::g_init_console_output_cp);
-
- fflush(nullptr);
-
- ::TerminateProcess(::GetCurrentProcess(), exit_code);
- }
-
- static BOOL ctrl_handler(DWORD fdw_ctrl_type)
- {
- {
- auto locked_metrics = Metrics::g_metrics.lock();
- locked_metrics->track_property("CtrlHandler", std::to_string(fdw_ctrl_type));
- locked_metrics->track_property("error", "CtrlHandler was fired.");
- }
- cleanup_and_exit(EXIT_FAILURE);
- }
-
- void register_console_ctrl_handler()
- {
- SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE);
- }
-
- [[noreturn]] void unreachable(const LineInfo& line_info)
- {
- System::println(System::Color::error, "Error: Unreachable code was reached");
- System::println(System::Color::error, line_info.to_string()); // Always print line_info here
-#ifndef NDEBUG
- std::abort();
-#else
- cleanup_and_exit(EXIT_FAILURE);
-#endif
- }
-
- [[noreturn]] void exit_with_code(const LineInfo& line_info, const int exit_code)
- {
- Debug::println(System::Color::error, line_info.to_string());
- cleanup_and_exit(exit_code);
- }
-
- [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView error_message)
- {
- System::println(System::Color::error, error_message);
- exit_fail(line_info);
- }
-
- void check_exit(const LineInfo& line_info, bool expression)
- {
- if (!expression)
- {
- exit_with_message(line_info, Strings::EMPTY);
- }
- }
-
- void check_exit(const LineInfo& line_info, bool expression, const CStringView error_message)
- {
- if (!expression)
- {
- exit_with_message(line_info, error_message);
- }
- }
-}