y3c-stl 0.3.3
Friendly C++ STL wrapper with automatic stacktrace
Loading...
Searching...
No Matches
terminate.h File Reference
#include "y3c-config.h"
#include "y3c/what.h"
#include <stdexcept>
#include <string>
#include <memory>
#include <unordered_map>
#include <atomic>
Include dependency graph for terminate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  skip_trace_tag
 
struct  terminate_detail
 
class  exception_base
 y3cの例外クラスのベース。 More...
 
class  ub_out_of_range
 
class  ub_access_nullptr
 
class  ub_access_deleted
 
class  ub_wrong_iter
 
class  ub_invalid_iter
 
class  ub_iter_after_end
 
class  ub_iter_before_begin
 
class  out_of_range
 

Namespaces

namespace  y3c
 
namespace  y3c::internal
 

Macros

#define define_terminate_func(ub_name)
 
#define y3c_assert_internal(cond)
 

Enumerations

enum class  terminate_type {
  exception , terminate , internal , ub_out_of_range ,
  ub_access_nullptr , ub_access_deleted , ub_wrong_iter , ub_invalid_iter ,
  ub_iter_after_end , ub_iter_before_begin
}
 

Functions

void link () noexcept
 
void handle_final_terminate_message () noexcept
 
void do_terminate_with (terminate_detail &&detail)
 例外を表示して強制終了する
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_out_of_range (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_access_nullptr (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_access_deleted (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_wrong_iter (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_invalid_iter (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_iter_after_end (std::string func, Args &&...args)
 
template<typename... Args, typename = skip_trace_tag>
void terminate_ub_iter_before_begin (std::string func, Args &&...args)
 
void terminate_internal (std::string func, std::string what, skip_trace_tag={})
 
void link ()
 

Variables

bool throw_on_terminate
 

Macro Definition Documentation

◆ define_terminate_func

#define define_terminate_func (   ub_name)
Value:
class ub_name : public std::exception { \
public: \
ub_name() = default; \
const char *what() const noexcept override { return #ub_name; } \
}; \
template <typename... Args, typename = skip_trace_tag> \
[[noreturn]] void terminate_##ub_name(std::string func, Args &&...args) { \
if (throw_on_terminate) { \
throw ub_name(); \
} \
do_terminate_with({terminate_type::ub_name, std::move(func), \
what::ub_name(std::forward<Args>(args)...)}); \
}

◆ y3c_assert_internal

#define y3c_assert_internal (   cond)
Value:
if (!(cond)) { \
y3c::internal::terminate_internal(__func__, \
"asserion '" #cond "' failed"); \
}