Support 24-bit LAF files
[openal-soft.git] / common / alassert.cpp
bloba6908cc5564398702e19c19d14dbc9383d51d441
2 #include "alassert.h"
4 #include <exception>
5 #include <stdexcept>
6 #include <string>
8 namespace al {
10 [[noreturn]]
11 void do_assert(const char *message, int linenum, const char *filename, const char *funcname) noexcept
13 /* Calling std::terminate in a catch block hopefully causes the system to
14 * provide info about the caught exception in the error dialog. At least on
15 * Linux, this results in the process printing
17 * terminate called after throwing an instance of 'std::runtime_error'
18 * what(): <message here>
20 * before terminating from a SIGABRT. Hopefully Windows and Mac will do the
21 * appropriate things with the message for an abnormal termination.
23 try {
24 std::string errstr{filename};
25 errstr += ':';
26 errstr += std::to_string(linenum);
27 errstr += ": ";
28 errstr += funcname;
29 errstr += ": ";
30 errstr += message;
31 throw std::runtime_error{errstr};
33 catch(...) {
34 std::terminate();
38 } /* namespace al */