[libcxx] r186951 - Add some friendly messages to libcxx calls to abort().

Howard Hinnant hhinnant at apple.com
Tue Jul 23 09:05:56 PDT 2013


Author: hhinnant
Date: Tue Jul 23 11:05:56 2013
New Revision: 186951

URL: http://llvm.org/viewvc/llvm-project?rev=186951&view=rev
Log:
Add some friendly messages to libcxx calls to abort().

Modified:
    libcxx/trunk/src/exception.cpp
    libcxx/trunk/src/locale.cpp
    libcxx/trunk/src/string.cpp

Modified: libcxx/trunk/src/exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/exception.cpp?rev=186951&r1=186950&r2=186951&view=diff
==============================================================================
--- libcxx/trunk/src/exception.cpp (original)
+++ libcxx/trunk/src/exception.cpp Tue Jul 23 11:05:56 2013
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "exception"
 
@@ -88,12 +89,14 @@ terminate() _NOEXCEPT
 #endif  // _LIBCPP_NO_EXCEPTIONS
         (*get_terminate())();
         // handler should not return
+        printf("terminate_handler unexpectedly returned\n");
         ::abort ();
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
         // handler should not throw exception
+        printf("terminate_handler unexpectedly threw an exception\n");
         ::abort ();
     }
 #endif  // _LIBCPP_NO_EXCEPTIONS
@@ -109,6 +112,7 @@ bool uncaught_exception() _NOEXCEPT
     return __cxa_uncaught_exception();
 #else  // __APPLE__
     #warning uncaught_exception not yet implemented
+    printf("uncaught_exception not yet implemented\n");
     ::abort();
 #endif  // __APPLE__
 }
@@ -146,6 +150,7 @@ exception_ptr::~exception_ptr() _NOEXCEP
     __cxa_decrement_exception_refcount(__ptr_);
 #else
     #warning exception_ptr not yet implemented
+    printf("exception_ptr not yet implemented\n");
     ::abort();
 #endif  // __APPLE__
 }
@@ -157,6 +162,7 @@ exception_ptr::exception_ptr(const excep
     __cxa_increment_exception_refcount(__ptr_);
 #else
     #warning exception_ptr not yet implemented
+    printf("exception_ptr not yet implemented\n");
     ::abort();
 #endif  // __APPLE__
 }
@@ -173,6 +179,7 @@ exception_ptr& exception_ptr::operator=(
     return *this;
 #else  // __APPLE__
     #warning exception_ptr not yet implemented
+    printf("exception_ptr not yet implemented\n");
     ::abort();
 #endif  // __APPLE__
 }
@@ -207,6 +214,7 @@ exception_ptr current_exception() _NOEXC
     return ptr;
 #else  // __APPLE__
     #warning exception_ptr not yet implemented
+    printf("exception_ptr not yet implemented\n");
     ::abort();
 #endif  // __APPLE__
 }
@@ -220,6 +228,7 @@ void rethrow_exception(exception_ptr p)
     terminate();
 #else  // __APPLE__
     #warning exception_ptr not yet implemented
+    printf("exception_ptr not yet implemented\n");
     ::abort();
 #endif  // __APPLE__
 }

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=186951&r1=186950&r2=186951&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Tue Jul 23 11:05:56 2013
@@ -31,6 +31,7 @@
 #include <langinfo.h>
 #endif // _!WIN32
 #include <stdlib.h>
+#include <stdio.h>
 
 // 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. 
@@ -1017,6 +1018,7 @@ ctype<char>::classic_table()  _NOEXCEPT
     // Platform not supported: abort so the person doing the port knows what to
     // fix
 # warning  ctype<char>::classic_table() is not implemented
+    printf("ctype<char>::classic_table() is not implemented\n");
     abort();
     return NULL;
 #endif

Modified: libcxx/trunk/src/string.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=186951&r1=186950&r2=186951&view=diff
==============================================================================
--- libcxx/trunk/src/string.cpp (original)
+++ libcxx/trunk/src/string.cpp Tue Jul 23 11:05:56 2013
@@ -16,6 +16,7 @@
 #ifdef _WIN32
 #include "support/win32/support.h"
 #endif // _WIN32
+#include <stdio.h>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -38,6 +39,7 @@ void throw_helper( const string& msg )
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw T( msg );
 #else
+    printf("%s\n", msg.c_str());
     abort();
 #endif
 }





More information about the cfe-commits mailing list