From: Alexandre Oliva Date: Mon, 9 Dec 2024 10:56:06 +0000 (-0300) Subject: ada: C++ exception hierarchies: adjust for gnat-llvm X-Git-Tag: basepoints/gcc-16~2978 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8a94b0ba884bdd36f285565dbdf095e076fd63c;p=thirdparty%2Fgcc.git ada: C++ exception hierarchies: adjust for gnat-llvm gnat-llvm doesn't support C++ imports, so arrange for the GNAT.CPP* units to be omitted from gnat-llvm builds. Drop G++ exception interoperability support from raise-gcc.c, so as to not require the GNAT.CPP* units that define some of the required symbols. Co-Authored-By: Olivier Hainque gcc/ada/ChangeLog: * Makefile.rtl (LLVM_BUILD): Define based on LLVM_CONFIG. (GNATRTL_NONTASKING_OBJS): Make g-cpp, g-cppstd, and g-cstyin conditional on -gcc or -arm EH, and on no LLVM_BUILD. * raise-gcc.c (GXX_EH_INTEROP): Define as 0 on gnat-llvm or CERT, and 1 otherwise. (__gnat_get_cxx_dependent_exception) Omit on !GXX_EH_INTEROP. (__gnat_maybe_get_cxx_dependent_exception): Likewise. (__gnat_get_cxx_exception_type_info): Likewise. (__gnat_obtain_caught_object): Likewise. (is_handled_by): Omit eid parameter and G++ interop on !GXX_EH_INTEROP. Adjust callers. --- diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index cd112d3c744b..34bc5c80431a 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -26,6 +26,12 @@ ifndef ADAC ADAC=$(CC) endif +ifeq ($(LLVM_CONFIG),) +LLVM_BUILD := $(shell $(ADAC) -v | grep ^llvm-gcc) +else +LLVM_BUILD := llvm-gcc +endif + # Objects needed only for tasking GNATRTL_TASKING_OBJS= \ a-dispat$(objext) \ @@ -419,9 +425,6 @@ GNATRTL_NONTASKING_OBJS= \ g-comlin$(objext) \ g-comver$(objext) \ g-crc32$(objext) \ - g-cpp$(objext) \ - g-cppstd$(objext) \ - g-cstyin$(objext) \ g-ctrl_c$(objext) \ g-curexc$(objext) \ g-debpoo$(objext) \ @@ -3152,7 +3155,12 @@ ifeq ($(EH_MECHANISM),-gcc) s-excmac.ads # include @@ -975,6 +991,8 @@ __gnat_exception_language_is_ada (_Unwind_Exception *except) return (exception_class_eq (except, GNAT_EXCEPTION_CLASS)); } +#if GXX_EH_INTEROP + /* Check whether *THROWN_PTR of EXCEPT_TYPEINFO is to be caught by a CHOICE_TYPEINFO handler under LANG convention. Implemented by GNAT.CPP_Exception.Convert_Caught_Object. */ @@ -1099,20 +1117,17 @@ __gnat_obtain_caught_object (int *success_p, void **thrown_ptr_p, } } +#endif /* GXX_EH_INTEROP */ + /* Return how CHOICE matches PROPAGATED_EXCEPTION. */ static enum action_kind is_handled_by (Exception_Id choice, -#ifndef CERT +#if GXX_EH_INTEROP Exception_Id *eid, -#endif +#endif /* GXX_EH_INTEROP */ _Unwind_Exception *propagated_exception) { -#ifndef CERT - char lang; - bool primary; -#endif - /* All others choice match everything. */ if (choice == GNAT_ALL_OTHERS) return handler; @@ -1144,7 +1159,10 @@ is_handled_by (Exception_Id choice, ) return handler; -#ifndef CERT +#if GXX_EH_INTEROP + char lang; + bool primary; + /* C++ exception occurrences with exact (C) or base (B) type matching. */ if (((primary = exception_class_eq (propagated_exception, CXX_EXCEPTION_CLASS)) @@ -1171,7 +1189,7 @@ is_handled_by (Exception_Id choice, return handler; } } -#endif +#endif /* GXX_EH_INTEROP */ return nothing; } @@ -1259,9 +1277,9 @@ get_action_description_for (_Unwind_Ptr ip, = (Exception_Id) get_ttype_entry_for (region, ar_filter); act = is_handled_by (choice, -#ifndef CERT +#if GXX_EH_INTEROP eid, -#endif +#endif /* GXX_EH_INTEROP */ uw_exception); if (act != nothing) {