15 #ifndef WPIUTIL_WPI_ERRORHANDLING_H
16 #define WPIUTIL_WPI_ERRORHANDLING_H
18 #include "wpi/Compiler.h"
27 const std::string& reason,
47 void *user_data =
nullptr);
57 void *user_data =
nullptr) {
73 bool gen_crash_diag =
true);
75 bool gen_crash_diag =
true);
77 bool gen_crash_diag =
true);
79 bool gen_crash_diag =
true);
98 void *user_data =
nullptr);
103 void install_out_of_memory_new_handler();
122 LLVM_ATTRIBUTE_NORETURN
void
136 #define wpi_unreachable(msg) \
137 ::wpi::wpi_unreachable_internal(msg, __FILE__, __LINE__)
138 #elif defined(LLVM_BUILTIN_UNREACHABLE)
139 #define wpi_unreachable(msg) LLVM_BUILTIN_UNREACHABLE
141 #define wpi_unreachable(msg) ::wpi::wpi_unreachable_internal()
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void(* fatal_error_handler_t)(void *user_data, const std::string &reason, bool gen_crash_diag)
An error handler callback.
Definition: ErrorHandling.h:26
LLVM_ATTRIBUTE_NORETURN void wpi_unreachable_internal(const char *msg=nullptr, const char *file=nullptr, unsigned line=0)
This function calls abort(), and prints the optional message to stderr.
void install_fatal_error_handler(fatal_error_handler_t handler, void *user_data=nullptr)
install_fatal_error_handler - Installs a new error handler to be used whenever a serious (non-recover...
WPILib C++ utilities (wpiutil) namespace.
Definition: EventLoopRunner.h:17
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
ScopedFatalErrorHandler - This is a simple helper class which just calls install_fatal_error_handler ...
Definition: ErrorHandling.h:55
void report_bad_alloc_error(const char *Reason, bool GenCrashDiag=true)
Reports a bad alloc error, calling any user defined bad alloc error handler.
void install_bad_alloc_error_handler(fatal_error_handler_t handler, void *user_data=nullptr)
Installs a new bad alloc error handler that should be used whenever a bad alloc error,...
void remove_bad_alloc_error_handler()
Restores default bad alloc error handling behavior.
void remove_fatal_error_handler()
Restores default error handling behaviour.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:85