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) \
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) \
s-excmac.ads<libgnat/s-excmac__gcc.ads \
s-excmac.adb<libgnat/s-excmac__gcc.adb
EXTRA_LIBGNAT_OBJS+=raise-gcc.o
- EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o
+ifeq ($(LLVM_BUILD),)
+ EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o \
+ g-cpp$(objext) g-cppstd$(objext) g-cstyin$(objext)
+else
+ EXTRA_GNATRTL_NONTASKING_OBJS+=s-excmac.o
+endif
endif
ifeq ($(EH_MECHANISM),-arm)
s-excmac.ads<libgnat/s-excmac__arm.ads \
s-excmac.adb<libgnat/s-excmac__arm.adb
EXTRA_LIBGNAT_OBJS+=raise-gcc.o
- EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o
+ifeq ($(LLVM_BUILD),)
+ EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o \
+ g-cpp$(objext) g-cppstd$(objext) g-cstyin$(objext)
+else
+ EXTRA_GNATRTL_NONTASKING_OBJS+=s-excmac.o
+endif
endif
ifeq ($(strip $(filter-out linux%,$(target_os))),)
# endif
#endif
+/* Arrange to include the Ada/G++ exceptions interoperability support only in
+ contexts where it is actually needed and supported, in particular not in
+ gnat-llvm, that doesn't support C++ imports. This interoperability hasn't
+ been certified, so leave it out of CERT runtimes as well. */
+
+#if !defined GXX_EH_INTEROP
+# if defined(__clang_major__) && defined(__clang_minor__)
+/* GNAT-LLVM does not support C++ imports. */
+# define GXX_EH_INTEROP 0
+# elif defined(CERT)
+# define GXX_EH_INTEROP 0
+# else
+# define GXX_EH_INTEROP 1
+# endif
+#endif
+
#ifdef __cplusplus
# include <cstdarg>
# include <cstddef>
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. */
}
}
+#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;
)
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))
return handler;
}
}
-#endif
+#endif /* GXX_EH_INTEROP */
return nothing;
}
= (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)
{