+2010-05-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/gigi.h (enum standard_datatypes): Add new value
+ ADT_exception_data_name_id.
+ (exception_data_name_id): New define.
+ * gcc-interface/trans.c (gigi): Initialize it.
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Use the standard
+ exception type for standard exception definitions. Do not make them
+ volatile.
+ <E_Record_Type>: Equate fields of types associated with an exception
+ definition to those of the standard exception type.
+
2010-05-13 Andreas Schwab <schwab@linux-m68k.org>
* tracebak.c (__gnat_backtrace): Mark top_stack with ATTRIBUTE_UNUSED.
/* Get the type after elaborating the renamed object. */
gnu_type = gnat_to_gnu_type (Etype (gnat_entity));
+ /* If this is a standard exception definition, then use the standard
+ exception type. This is necessary to make sure that imported and
+ exported views of exceptions are properly merged in LTO mode. */
+ if (TREE_CODE (TYPE_NAME (gnu_type)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (gnu_type)) == exception_data_name_id)
+ gnu_type = except_type_node;
+
/* For a debug renaming declaration, build a pure debug entity. */
if (Present (Debug_Renaming_Link (gnat_entity)))
{
and disallow any optimizations for such a non-constant object. */
if ((Treat_As_Volatile (gnat_entity)
|| (!const_flag
+ && gnu_type != except_type_node
&& (Is_Exported (gnat_entity)
|| imported_p
|| Present (Address_Clause (gnat_entity)))))
&& Is_Itype (Etype (gnat_temp))
&& !present_gnu_tree (gnat_temp))
gnat_to_gnu_entity (Etype (gnat_temp), NULL_TREE, 0);
+
+ /* If this is a record type associated with an exception definition,
+ equate its fields to those of the standard exception type. This
+ will make it possible to convert between them. */
+ if (gnu_entity_name == exception_data_name_id)
+ {
+ tree gnu_std_field;
+ for (gnu_field = TYPE_FIELDS (gnu_type),
+ gnu_std_field = TYPE_FIELDS (except_type_node);
+ gnu_field;
+ gnu_field = TREE_CHAIN (gnu_field),
+ gnu_std_field = TREE_CHAIN (gnu_std_field))
+ SET_DECL_ORIGINAL_FIELD_TO_FIELD (gnu_field, gnu_std_field);
+ gcc_assert (!gnu_std_field);
+ }
}
break;
/* Identifier for the name of the _Parent field in tagged record types. */
ADT_parent_name_id,
+ /* Identifier for the name of the Exception_Data type. */
+ ADT_exception_data_name_id,
+
/* Types and decls used by our temporary exception mechanism. See
init_gigi_decls for details. */
ADT_jmpbuf_type,
#define free_decl gnat_std_decls[(int) ADT_free_decl]
#define mulv64_decl gnat_std_decls[(int) ADT_mulv64_decl]
#define parent_name_id gnat_std_decls[(int) ADT_parent_name_id]
+#define exception_data_name_id gnat_std_decls[(int) ADT_exception_data_name_id]
#define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type]
#define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type]
#define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl]
/* Name of the _Parent field in tagged record types. */
parent_name_id = get_identifier (Get_Name_String (Name_uParent));
+ /* Name of the Exception_Data type defined in System.Standard_Library. */
+ exception_data_name_id
+ = get_identifier ("system__standard_library__exception_data");
+
/* Make the types and functions used for exception processing. */
jmpbuf_type
= build_array_type (gnat_type_for_mode (Pmode, 0),