summaryrefslogtreecommitdiff
path: root/gcc/ada/raise-gcc.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-14 13:29:23 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-14 13:29:23 +0000
commit24d7b9d67057c599fd7caff8d7125a24b943795e (patch)
treee84bb877232a8e1517bc69224d07162ff4e174dc /gcc/ada/raise-gcc.c
parent670bb5f38c99378df2c763963eee3307f3c90d00 (diff)
downloadgcc-24d7b9d67057c599fd7caff8d7125a24b943795e.tar.gz
2013-10-14 Vincent Celier <celier@adacore.com>
* snames.ads-tmpl: Add new standard name Library_Rpath_Options. 2013-10-14 Tristan Gingold <gingold@adacore.com> * sem_prag.adb (Process_Import_Or_Interface): Allow importing of exception using convention Cpp. * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Expand cpp imported exceptions. * raise-gcc.c (is_handled_by): Filter C++ exception occurrences. * gnat_rm.texi: Document how to import C++ exceptions. 2013-10-14 Jose Ruiz <ruiz@adacore.com> * sem_ch13.adb (Sem_Ch13.Analyze_Aspect_Specification): For Priority and CPU aspects, when checking, issue a warning only if it is obviously not a main program. 2013-10-14 Tristan Gingold <gingold@adacore.com> * adaint.c: Fix condition for AIX. Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203549 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/raise-gcc.c')
-rw-r--r--gcc/ada/raise-gcc.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c
index 897dca285c9..5d321677516 100644
--- a/gcc/ada/raise-gcc.c
+++ b/gcc/ada/raise-gcc.c
@@ -87,6 +87,36 @@ extern void __gnat_unhandled_except_handler (_Unwind_Exception *);
#define CXX_EXCEPTION_CLASS 0x474e5543432b2b00ULL
#define GNAT_EXCEPTION_CLASS 0x474e552d41646100ULL
+/* Structure of a C++ exception, represented as a C structure... See
+ unwind-cxx.h for the full definition. */
+
+struct __cxa_exception
+{
+ void *exceptionType;
+ void (*exceptionDestructor)(void *);
+
+ void (*unexpectedHandler)();
+ void (*terminateHandler)();
+
+ struct __cxa_exception *nextException;
+
+ int handlerCount;
+
+#ifdef __ARM_EABI_UNWINDER__
+ struct __cxa_exception* nextPropagatingException;
+
+ int propagationCount;
+#else
+ int handlerSwitchValue;
+ const unsigned char *actionRecord;
+ const unsigned char *languageSpecificData;
+ _Unwind_Ptr catchTemp;
+ void *adjustedPtr;
+#endif
+
+ _Unwind_Exception unwindHeader;
+};
+
/* --------------------------------------------------------------
-- The DB stuff below is there for debugging purposes only. --
-------------------------------------------------------------- */
@@ -882,6 +912,22 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception * propagated_exception)
|| choice == (_Unwind_Ptr) &Foreign_Exception)
return handler;
+ /* C++ exception occurrences. */
+ if (propagated_exception->common.exception_class == CXX_EXCEPTION_CLASS
+ && Language_For (choice) == 'C')
+ {
+ void *choice_typeinfo = Foreign_Data_For (choice);
+ void *except_typeinfo =
+ (((struct __cxa_exception *)
+ ((_Unwind_Exception *)propagated_exception + 1)) - 1)->exceptionType;
+
+ /* Typeinfo are directly compared, which might not be correct if they
+ aren't merged. ??? We should call the == operator if this module is
+ compiled in C++. */
+ if (choice_typeinfo == except_typeinfo)
+ return handler;
+ }
+
return nothing;
}