debug/panic: use fmt for `unhandled` messages

This commit is contained in:
Danny Robson 2021-04-13 15:18:37 +10:00
parent 986e7d18d8
commit 4848178cc7
4 changed files with 10 additions and 8 deletions

View File

@ -10,7 +10,7 @@ include (search_libs)
find_package (PythonInterp 3 REQUIRED)
find_package (RAGEL 6.9 REQUIRED)
find_package (fmt REQUIRED)
if (WIN32)
# Enable features for Windows Vista and higher
@ -38,7 +38,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
###############################################################################
add_library(cruft)
target_link_libraries(cruft ${NC_CXX_STDCXXFS})
target_link_libraries(cruft ${NC_CXX_STDCXXFS} fmt::fmt)
# Setup a directory to hold built sources we may need to export to clients.

View File

@ -8,8 +8,9 @@
#pragma once
#include <fmt/format.h>
#include <type_traits>
#include <sstream>
#include <utility>
@ -127,9 +128,7 @@ namespace cruft::debug::detail {
if constexpr (std::is_enum_v<base_type>) {
unhandled (static_cast<std::underlying_type_t<base_type>> (t));
} else {
std::ostringstream os;
os << "unhandled value: " << t << '\n';
::panic (os.str ());
::panic (fmt::format ("unhandled value: {}", t));
}
}
}

View File

@ -13,6 +13,8 @@
#include "vector.hpp"
#include "coord/ops.hpp"
#include <ostream>
///////////////////////////////////////////////////////////////////////////////
using cruft::quaternion;

View File

@ -8,12 +8,13 @@
#include "version.hpp"
#include "maths.hpp"
#include "debug/assert.hpp"
#include "debug/panic.hpp"
#include <cstring>
#include <stdexcept>
#include <ostream>
#include "debug/assert.hpp"
#include <cstring>
// We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)