Add some friendly messages to libcxx calls to abort().

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186951 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2013-07-23 16:05:56 +00:00
parent 01fbfc2fa6
commit ed14a76beb
3 changed files with 13 additions and 0 deletions

View File

@ -7,6 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include "exception" #include "exception"
@ -88,12 +89,14 @@ terminate() _NOEXCEPT
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
(*get_terminate())(); (*get_terminate())();
// handler should not return // handler should not return
printf("terminate_handler unexpectedly returned\n");
::abort (); ::abort ();
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
{ {
// handler should not throw exception // handler should not throw exception
printf("terminate_handler unexpectedly threw an exception\n");
::abort (); ::abort ();
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
@ -109,6 +112,7 @@ bool uncaught_exception() _NOEXCEPT
return __cxa_uncaught_exception(); return __cxa_uncaught_exception();
#else // __APPLE__ #else // __APPLE__
#warning uncaught_exception not yet implemented #warning uncaught_exception not yet implemented
printf("uncaught_exception not yet implemented\n");
::abort(); ::abort();
#endif // __APPLE__ #endif // __APPLE__
} }
@ -146,6 +150,7 @@ exception_ptr::~exception_ptr() _NOEXCEPT
__cxa_decrement_exception_refcount(__ptr_); __cxa_decrement_exception_refcount(__ptr_);
#else #else
#warning exception_ptr not yet implemented #warning exception_ptr not yet implemented
printf("exception_ptr not yet implemented\n");
::abort(); ::abort();
#endif // __APPLE__ #endif // __APPLE__
} }
@ -157,6 +162,7 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
__cxa_increment_exception_refcount(__ptr_); __cxa_increment_exception_refcount(__ptr_);
#else #else
#warning exception_ptr not yet implemented #warning exception_ptr not yet implemented
printf("exception_ptr not yet implemented\n");
::abort(); ::abort();
#endif // __APPLE__ #endif // __APPLE__
} }
@ -173,6 +179,7 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
return *this; return *this;
#else // __APPLE__ #else // __APPLE__
#warning exception_ptr not yet implemented #warning exception_ptr not yet implemented
printf("exception_ptr not yet implemented\n");
::abort(); ::abort();
#endif // __APPLE__ #endif // __APPLE__
} }
@ -207,6 +214,7 @@ exception_ptr current_exception() _NOEXCEPT
return ptr; return ptr;
#else // __APPLE__ #else // __APPLE__
#warning exception_ptr not yet implemented #warning exception_ptr not yet implemented
printf("exception_ptr not yet implemented\n");
::abort(); ::abort();
#endif // __APPLE__ #endif // __APPLE__
} }
@ -220,6 +228,7 @@ void rethrow_exception(exception_ptr p)
terminate(); terminate();
#else // __APPLE__ #else // __APPLE__
#warning exception_ptr not yet implemented #warning exception_ptr not yet implemented
printf("exception_ptr not yet implemented\n");
::abort(); ::abort();
#endif // __APPLE__ #endif // __APPLE__
} }

View File

@ -31,6 +31,7 @@
#include <langinfo.h> #include <langinfo.h>
#endif // _!WIN32 #endif // _!WIN32
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
// On Linux, wint_t and wchar_t have different signed-ness, and this causes // On Linux, wint_t and wchar_t have different signed-ness, and this causes
// lots of noise in the build log, but no bugs that I know of. // lots of noise in the build log, but no bugs that I know of.
@ -1017,6 +1018,7 @@ ctype<char>::classic_table() _NOEXCEPT
// Platform not supported: abort so the person doing the port knows what to // Platform not supported: abort so the person doing the port knows what to
// fix // fix
# warning ctype<char>::classic_table() is not implemented # warning ctype<char>::classic_table() is not implemented
printf("ctype<char>::classic_table() is not implemented\n");
abort(); abort();
return NULL; return NULL;
#endif #endif

View File

@ -16,6 +16,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "support/win32/support.h" #include "support/win32/support.h"
#endif // _WIN32 #endif // _WIN32
#include <stdio.h>
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@ -38,6 +39,7 @@ void throw_helper( const string& msg )
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw T( msg ); throw T( msg );
#else #else
printf("%s\n", msg.c_str());
abort(); abort();
#endif #endif
} }