[PATCH] [libcxxabi] Make new preprocessor guards for SJLJ and ARM_EHABI

Jon Roelofs jonathan at codesourcery.com
Tue Apr 15 14:06:13 PDT 2014


jroelofs added you to the CC list for the revision "[libcxxabi] Make new preprocessor guards for SJLJ and ARM_EHABI".

Hi mclow.lists,

This is in preparation to commit ARM EHABI support. Not functional change intended.

http://reviews.llvm.org/D3384

Files:
  include/unwind.h
  src/cxa_exception.cpp

Index: include/unwind.h
===================================================================
--- include/unwind.h
+++ include/unwind.h
@@ -23,6 +23,18 @@
 #define LIBUNWIND_UNAVAIL
 #endif
 
+#if defined(__USING_SJLJ_EXCEPTIONS__)
+#  define LIBCXXABI_SJLJ 1
+#else
+#  define LIBCXXABI_SJLJ 0
+#endif
+
+#if __arm__ && !LIBCXXABI_SJLJ
+#  define LIBCXXABI_ARM_EHABI 1
+#else
+#  define LIBCXXABI_ARM_EHABI 0
+#endif
+
 typedef enum {
   _URC_NO_REASON = 0,
   _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
@@ -83,7 +95,7 @@
 //
 // The following are the base functions documented by the C++ ABI
 //
-#if __arm__
+#if LIBCXXABI_SJLJ
 extern _Unwind_Reason_Code
     _Unwind_SjLj_RaiseException(struct _Unwind_Exception *exception_object);
 extern void _Unwind_SjLj_Resume(struct _Unwind_Exception *exception_object);
@@ -101,7 +113,7 @@
 extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context);
 extern uintptr_t
     _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context);
-#if __arm__
+#if LIBCXXABI_SJLJ
 extern _Unwind_Reason_Code
     _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *exception_object,
                               _Unwind_Stop_Fn stop, void *stop_parameter);
@@ -111,7 +123,7 @@
                          _Unwind_Stop_Fn stop, void *stop_parameter);
 #endif
 
-#if __arm__
+#if LIBCXXABI_SJLJ
 typedef struct _Unwind_FunctionContext *_Unwind_FunctionContext_t;
 extern void _Unwind_SjLj_Register(_Unwind_FunctionContext_t fc);
 extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc);
@@ -124,7 +136,7 @@
 //
 //  called by __cxa_rethrow().
 //
-#if __arm__
+#if LIBCXXABI_SJLJ
 extern _Unwind_Reason_Code
     _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *exception_object);
 #else
Index: src/cxa_exception.cpp
===================================================================
--- src/cxa_exception.cpp
+++ src/cxa_exception.cpp
@@ -232,7 +232,7 @@
     globals->uncaughtExceptions += 1;   // Not atomically, since globals are thread-local
 
     exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
-#if __arm__
+#if LIBCXXABI_SJLJ
     _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
 #else
     _Unwind_RaiseException(&exception_header->unwindHeader);
@@ -465,7 +465,7 @@
         //   nothing
         globals->caughtExceptions = 0;
     }
-#if __arm__
+#if LIBCXXABI_SJLJ
     _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
 #else
     _Unwind_RaiseException(&exception_header->unwindHeader);
@@ -594,7 +594,7 @@
         setDependentExceptionClass(&dep_exception_header->unwindHeader);
         __cxa_get_globals()->uncaughtExceptions += 1;
         dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup;
-#if __arm__
+#if LIBCXXABI_SJLJ
         _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader);
 #else
         _Unwind_RaiseException(&dep_exception_header->unwindHeader);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3384.1.patch
Type: text/x-patch
Size: 2942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140415/6f22ecc3/attachment.bin>


More information about the cfe-commits mailing list