[cfe-commits] [libcxxabi] r153039 - in /libcxxabi/trunk: include/cxxabi.h src/cxa_default_handlers.cpp src/cxa_default_handlers.hpp src/cxa_exception.hpp src/cxa_handlers.cpp src/cxa_handlers.hpp

Howard Hinnant hhinnant at apple.com
Mon Mar 19 09:20:34 PDT 2012


Author: hhinnant
Date: Mon Mar 19 11:20:34 2012
New Revision: 153039

URL: http://llvm.org/viewvc/llvm-project?rev=153039&view=rev
Log:
I've moved __cxa_terminate_handler, __cxa_unexpected_handler and __cxa_new_handler from the public header cxxabi.h into the private header cxa_handlers.hpp.  During this move I've also moved them from namespace __cxxabiapple into the global namespace.  They are, and have always been extern C and so the namespace (or lack of it) does not affect their ABI.  In general external clients should not reference these symbols.  They are atomic variables and will be changing into C++11 atomic variables in the future.  However for those few clients who really need access to them, their name, mangling, size, alignment and layout will remain stable.  You just may need your own declaration of them.  Include guards have been added to the private header cxa_exception.hpp.  The private header cxa_default_handlers.hpp has been removed and the default handlers are now file-static.  Include guards have been added to the private header cxa_handlers.hpp.

Removed:
    libcxxabi/trunk/src/cxa_default_handlers.hpp
Modified:
    libcxxabi/trunk/include/cxxabi.h
    libcxxabi/trunk/src/cxa_default_handlers.cpp
    libcxxabi/trunk/src/cxa_exception.hpp
    libcxxabi/trunk/src/cxa_handlers.cpp
    libcxxabi/trunk/src/cxa_handlers.hpp

Modified: libcxxabi/trunk/include/cxxabi.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/cxxabi.h?rev=153039&r1=153038&r2=153039&view=diff
==============================================================================
--- libcxxabi/trunk/include/cxxabi.h (original)
+++ libcxxabi/trunk/include/cxxabi.h Mon Mar 19 11:20:34 2012
@@ -172,21 +172,4 @@
 
 namespace abi = __cxxabiv1;
 
-// Below are Apple extensions to support implementing C++ ABI in a seperate dylib
-namespace __cxxabiapple
-{
-extern "C"
-{
-
-// Apple additions to support multiple STL stacks that share common 
-// terminate, unexpected, and new handlers
-//   But touching these is a bad idea.  It is not thread safe.
-//   Use get_terminate, set_terminate, etc. instead.
-extern void (*__cxa_terminate_handler)();
-extern void (*__cxa_unexpected_handler)();
-extern void (*__cxa_new_handler)();
-
-} // extern "C"
-} // namespace __cxxabiv1
-
 #endif // __CXXABI_H 

Modified: libcxxabi/trunk/src/cxa_default_handlers.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_default_handlers.cpp?rev=153039&r1=153038&r2=153039&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_default_handlers.cpp (original)
+++ libcxxabi/trunk/src/cxa_default_handlers.cpp Mon Mar 19 11:20:34 2012
@@ -17,7 +17,6 @@
 #include "cxa_handlers.hpp"
 #include "cxa_exception.hpp"
 #include "private_typeinfo.h"
-#include "cxa_default_handlers.hpp"
 
 __attribute__((noreturn))
 static void default_handler(const char* cause)
@@ -76,14 +75,14 @@
 }
 
 
-__attribute__((visibility("hidden"), noreturn))
-void default_terminate_handler() 
+__attribute__((noreturn))
+static void default_terminate_handler() 
 {
 	default_handler("terminate");
 }
 
-__attribute__((visibility("hidden"), noreturn))
-void default_unexpected_handler() 
+__attribute__((noreturn))
+static void default_unexpected_handler() 
 {
 	default_handler("unexpected");
 }
@@ -103,7 +102,7 @@
 {
 	if (func == 0)
 		func = default_unexpected_handler;
-	return __sync_swap(&__cxxabiapple::__cxa_unexpected_handler, func);
+	return __sync_swap(&__cxa_unexpected_handler, func);
 }
 
 terminate_handler
@@ -111,7 +110,7 @@
 {
 	if (func == 0)
 		func = default_terminate_handler;
-	return __sync_swap(&__cxxabiapple::__cxa_terminate_handler, func);
+	return __sync_swap(&__cxa_terminate_handler, func);
 }
 
 };

Removed: libcxxabi/trunk/src/cxa_default_handlers.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_default_handlers.hpp?rev=153038&view=auto
==============================================================================
--- libcxxabi/trunk/src/cxa_default_handlers.hpp (original)
+++ libcxxabi/trunk/src/cxa_default_handlers.hpp (removed)
@@ -1,19 +0,0 @@
-//===------------------------- cxa_default_handlers.cpp -------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//
-// This file declares the default terminate_handler and unexpected_handler.
-//===----------------------------------------------------------------------===//
-
-
-__attribute__((visibility("hidden"), noreturn))
-void
-default_terminate_handler();
-
-__attribute__((visibility("hidden"), noreturn))
-void
-default_unexpected_handler();

Modified: libcxxabi/trunk/src/cxa_exception.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.hpp?rev=153039&r1=153038&r2=153039&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_exception.hpp (original)
+++ libcxxabi/trunk/src/cxa_exception.hpp Mon Mar 19 11:20:34 2012
@@ -11,6 +11,9 @@
 //  
 //===----------------------------------------------------------------------===//
 
+#ifndef _CXA_EXCEPTION_H
+#define _CXA_EXCEPTION_H
+
 #include <exception> // for std::unexpected_handler and std::terminate_handler
 #include <cxxabi.h>
 #include "unwind.h"
@@ -116,3 +119,5 @@
 
 #pragma GCC visibility pop
 }
+
+#endif  // _CXA_EXCEPTION_H

Modified: libcxxabi/trunk/src/cxa_handlers.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_handlers.cpp?rev=153039&r1=153038&r2=153039&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_handlers.cpp (original)
+++ libcxxabi/trunk/src/cxa_handlers.cpp Mon Mar 19 11:20:34 2012
@@ -17,18 +17,15 @@
 #include "cxxabi.h"
 #include "cxa_handlers.hpp"
 #include "cxa_exception.hpp"
-#include "cxa_default_handlers.hpp"
 #include "private_typeinfo.h"
 
-std::new_handler __cxa_new_handler = 0;
-
 namespace std
 {
 
 unexpected_handler
 get_unexpected() _NOEXCEPT
 {
-    return __cxxabiapple::__cxa_unexpected_handler;
+    return __cxa_unexpected_handler;
 }
 
 __attribute__((visibility("hidden"), noreturn))
@@ -50,7 +47,7 @@
 terminate_handler
 get_terminate() _NOEXCEPT
 {
-    return __cxxabiapple::__cxa_terminate_handler;
+    return __cxa_terminate_handler;
 }
 
 __attribute__((visibility("hidden"), noreturn))
@@ -98,16 +95,18 @@
     __terminate(get_terminate());
 }
 
+new_handler __cxa_new_handler = 0;
+
 new_handler
 set_new_handler(new_handler handler) _NOEXCEPT
 {
-    return __sync_swap(&__cxxabiapple::__cxa_new_handler, handler);
+    return __sync_swap(&__cxa_new_handler, handler);
 }
 
 new_handler
 get_new_handler() _NOEXCEPT
 {
-    return __cxxabiapple::__cxa_new_handler;
+    return __cxa_new_handler;
 }
 
 }  // std

Modified: libcxxabi/trunk/src/cxa_handlers.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_handlers.hpp?rev=153039&r1=153038&r2=153039&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_handlers.hpp (original)
+++ libcxxabi/trunk/src/cxa_handlers.hpp Mon Mar 19 11:20:34 2012
@@ -10,6 +10,9 @@
 //   unexpected_handler, and new_handler.
 //===----------------------------------------------------------------------===//
 
+#ifndef _CXA_HANDLERS_H
+#define _CXA_HANDLERS_H
+
 #include <exception>
 
 namespace std
@@ -24,3 +27,14 @@
 __terminate(terminate_handler func) _NOEXCEPT;
 
 }  // std
+
+extern "C"
+{
+
+extern void (*__cxa_terminate_handler)();
+extern void (*__cxa_unexpected_handler)();
+extern void (*__cxa_new_handler)();
+
+} // extern "C"
+
+#endif  // _CXA_HANDLERS_H





More information about the cfe-commits mailing list