From 5644b7e8e7fcc55fe544949c58ce049039e671c9 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 14 Oct 2013 15:29:23 +0200 Subject: [multiple changes] 2013-10-14 Vincent Celier * snames.ads-tmpl: Add new standard name Library_Rpath_Options. 2013-10-14 Tristan Gingold * 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 * 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 * adaint.c: Fix condition for AIX. Minor reformatting. From-SVN: r203549 --- gcc/ada/raise-gcc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'gcc/ada/raise-gcc.c') diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c index 897dca2..5d32167 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; } -- cgit v1.1