43 #include "Teuchos_Assert.hpp" 48 #if defined(HAVE_GCC_ABI_DEMANGLE) && defined(HAVE_TEUCHOS_DEMANGLE) 55 #if defined(HAVE_GCC_ABI_DEMANGLE) && defined(HAVE_TEUCHOS_DEMANGLE) 57 char* _demangledName = abi::__cxa_demangle (mangledName.c_str (), 0, 0, &status);
58 if (status != 0 || 0 == _demangledName) {
61 std::string nullstr (
"NULL");
62 const char* demangle_output = _demangledName ? _demangledName : nullstr.c_str ();
65 true, std::logic_error,
66 "Error, name demangling with g++ has been enabled but the function " 67 "abi::__cxa_demangle(" << mangledName <<
") returned returnVal = " <<
68 demangle_output <<
" and status = " << status <<
"." << endl <<
"This " 69 "suggests that name demangling may be broken on this platform." << endl
70 <<
"You may prevent this exception from being thrown in the future by " 71 "turning off name demangling for this build at configure time." << endl
72 <<
"Do this by setting the CMake configuration option " 73 "Teuchos_ENABLE_GCC_DEMANGLE to OFF." << endl <<
"Add the following to " 74 "your list of CMake options:" << endl << endl <<
75 " -D Teuchos_ENABLE_GCC_DEMANGLE:BOOL=OFF" << endl);
77 if (_demangledName != NULL) {
80 free (_demangledName);
82 return (mangledName +
"<demangle-failed>");
84 const std::string demangledName (_demangledName);
85 free (_demangledName);
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
TEUCHOSCORE_LIB_DLL_EXPORT std::string demangleName(const std::string &mangledName)
Demangle a C++ name if valid.
Defines basic traits returning the name of a type in a portable and readable way. ...