diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2010-05-16 09:11:39 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-05-16 09:11:39 +0000 |
commit | 871fda0ab0dcf2732eaeb89f4db0bb3c64eaf8f7 (patch) | |
tree | 902ad77b5c5de1e8d3786003564c4495f2968739 /gcc | |
parent | 1d4c5fe99b7f0551b3cafe72c63f465f5b59f215 (diff) | |
download | gcc-871fda0ab0dcf2732eaeb89f4db0bb3c64eaf8f7.zip gcc-871fda0ab0dcf2732eaeb89f4db0bb3c64eaf8f7.tar.gz gcc-871fda0ab0dcf2732eaeb89f4db0bb3c64eaf8f7.tar.bz2 |
gigi.h (enum standard_datatypes): Add new value ADT_exception_data_name_id.
* 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.
From-SVN: r159452
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 23 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/gigi.h | 4 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 4 |
4 files changed, 43 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index aa2e462..b70056b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +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. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 49a06fb..137d523 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -582,6 +582,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* 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))) { @@ -1000,6 +1007,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) 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))))) @@ -2922,6 +2930,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) && 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; diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index f3a0bdd..ce8fc8a 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -342,6 +342,9 @@ enum standard_datatypes /* 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, @@ -376,6 +379,7 @@ extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1]; #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] diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index c6bad43..68b496e 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -401,6 +401,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, /* 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), |