13 #ifndef __STOUT_ABORT_HPP__ 14 #define __STOUT_ABORT_HPP__ 33 #define __STRINGIZE(x) #x 34 #define _STRINGIZE(x) __STRINGIZE(x) 38 #define _ABORT_PREFIX "ABORT: (" __FILE__ ":" _STRINGIZE(__LINE__) "): " 40 #define ABORT(...) _Abort(_ABORT_PREFIX, __VA_ARGS__) 47 const size_t prefix_len = strlen(prefix);
48 const size_t message_len = strlen(message);
59 while (message !=
nullptr &&
74 const DWORD prefix_len =
static_cast<DWORD
>(strlen(prefix));
75 const DWORD message_len =
static_cast<DWORD
>(strlen(message));
77 const HANDLE fd = ::GetStdHandle(STD_ERROR_HANDLE);
82 ::WriteFile(fd, prefix, prefix_len, &bytes,
nullptr);
83 ::WriteFile(fd, message, message_len, &bytes,
nullptr);
84 ::WriteFile(fd,
"\n", 1, &bytes,
nullptr);
94 _Abort(prefix, message.c_str());
98 #endif // __STOUT_ABORT_HPP__ constexpr const char * prefix
Definition: os.hpp:96
#define STDERR_FILENO
Definition: windows.hpp:155
#define STOUT_NORETURN
Definition: attributes.hpp:31
constexpr Handle HANDLE
Definition: ingress.hpp:37
Protocol< WriteRequest, WriteResponse > write
STOUT_NORETURN void _Abort(const char *prefix, const char *message)
Definition: abort.hpp:44