33 #ifndef STACKTRACE_H_INCLUDED
34 #define STACKTRACE_H_INCLUDED
39 #ifdef __GNUC__ // GCC has __PRETTY_FUNCTION__
40 #define FUNCTION_DESCR __PRETTY_FUNCTION__
41 #elif defined _MSC_VER // MSVC++ has __FUNCTION__
42 #define FUNCTION_DESCR __FUNCTION__
43 #else // do it the standard way
44 #define FUNCTION_DESCR __FILE__
47 #define STRACE_PREPARE \
48 std::string(FUNCTION_DESCR) + ":" + \
49 static_cast<ostringstream*>( &(ostringstream() << __LINE__) )->str()
55 #define STRACE_THROW(msg) \
56 STRACE_PREPARE + ( std::string(msg).empty() ? "" : (std::string("\n : ") + msg) ) + "\n"
63 #define STRACE_RETHROW(exception, msg) \
64 STRACE_THROW(msg) + exception.what()
133 #endif // STACKTRACE_H_INCLUDED