24 #include "rawspeedconfig.h"
26 #include "common/Common.h"
35 [[noreturn]]
void RAWSPEED_UNLIKELY_FUNCTION RAWSPEED_NOINLINE
36 __attribute__((
noreturn, format(printf, 1, 2)))
38 static constexpr size_t bufSize = 8192;
39 #if defined(HAVE_CXX_THREAD_LOCAL
)
40 static thread_local std::array<
char, bufSize> buf;
41 #elif defined(HAVE_GCC_THREAD_LOCAL)
42 static __thread char buf[bufSize];
45 "Don't have thread-local-storage! Exception text may be garbled if used multithreaded"
46 static char buf[bufSize];
51 vsnprintf(buf.data(),
sizeof(buf), fmt, val);
53 writeLog(DEBUG_PRIO_EXTRA,
"EXCEPTION: %s", buf.data());
59 static void RAWSPEED_UNLIKELY_FUNCTION RAWSPEED_NOINLINE
60 log(
const char* msg) {
65 explicit RAWSPEED_UNLIKELY_FUNCTION RAWSPEED_NOINLINE
67 : std::runtime_error(msg) {
79 #define ThrowExceptionHelper(CLASS, fmt, ...)
80 rawspeed::ThrowException<CLASS>("%s, line " STR(__LINE__) ": " fmt,
81 __PRETTY_FUNCTION__, ##__VA_ARGS__)
83 #define ThrowExceptionHelper(CLASS, fmt, ...)
84 rawspeed::ThrowException<CLASS>(__FILE__ ":" STR(__LINE__) ": %s: " fmt,
85 __PRETTY_FUNCTION__, ##__VA_ARGS__)