diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2008-08-01 12:39:57 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-08-01 12:39:57 +0000 |
commit | 8df2e9022925c06ab369d74a301bcf081ddc417e (patch) | |
tree | f4efd12be81b0704af9d6a64d314a9b55e716b01 /gcc/ada/gcc-interface/trans.c | |
parent | 5c3554b7ad2c8041a923228037141f83c9e70fc6 (diff) | |
download | gcc-8df2e9022925c06ab369d74a301bcf081ddc417e.zip gcc-8df2e9022925c06ab369d74a301bcf081ddc417e.tar.gz gcc-8df2e9022925c06ab369d74a301bcf081ddc417e.tar.bz2 |
decl.c (gnat_to_gnu_entity): Remove dead code.
2008-08-01 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Remove dead
code. Do not get full definition of deferred constants with address
clause for a use. Do not ignore deferred constant definitions with
address clause. Ignore constant definitions already marked with the
error node.
<object>: Remove obsolete comment. For a deferred constant with
address clause, get the initializer from the full view.
* gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Definition_Clause>:
Rework and remove obsolete comment.
<N_Object_Declaration>: For a deferred constant with address clause,
mark the full view with the error node.
* gcc-interface/utils.c (convert_to_fat_pointer): Rework and fix
formatting nits.
From-SVN: r138513
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 677ec01..43e6afb 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -3397,6 +3397,15 @@ gnat_to_gnu (Node_Id gnat_node) if (type_annotate_only && gnu_expr && TREE_CODE (gnu_expr) == ERROR_MARK) gnu_expr = NULL_TREE; + /* If this is a deferred constant with an address clause, we ignore the + full view since the clause is on the partial view and we cannot have + 2 different GCC trees for the object. The only bits of the full view + we will use is the initializer, but it will be directly fetched. */ + if (Ekind(gnat_temp) == E_Constant + && Present (Address_Clause (gnat_temp)) + && Present (Full_View (gnat_temp))) + save_gnu_tree (Full_View (gnat_temp), error_mark_node, true); + if (No (Freeze_Node (gnat_temp))) gnat_to_gnu_entity (gnat_temp, gnu_expr, 1); break; @@ -4541,21 +4550,22 @@ gnat_to_gnu (Node_Id gnat_node) /***************************************************/ case N_Attribute_Definition_Clause: - gnu_result = alloc_stmt_list (); - /* The only one we need deal with is for 'Address. For the others, SEM - puts the information elsewhere. We need only deal with 'Address - if the object has a Freeze_Node (which it never will currently). */ - if (Get_Attribute_Id (Chars (gnat_node)) != Attr_Address - || No (Freeze_Node (Entity (Name (gnat_node))))) + /* The only one we need to deal with is 'Address since, for the others, + the front-end puts the information elsewhere. */ + if (Get_Attribute_Id (Chars (gnat_node)) != Attr_Address) + break; + + /* And we only deal with 'Address if the object has a Freeze node. */ + gnat_temp = Entity (Name (gnat_node)); + if (No (Freeze_Node (gnat_temp))) break; - /* Get the value to use as the address and save it as the - equivalent for GNAT_TEMP. When the object is frozen, - gnat_to_gnu_entity will do the right thing. */ - save_gnu_tree (Entity (Name (gnat_node)), - gnat_to_gnu (Expression (gnat_node)), true); + /* Get the value to use as the address and save it as the equivalent + for the object. When it is frozen, gnat_to_gnu_entity will do the + right thing. */ + save_gnu_tree (gnat_temp, gnat_to_gnu (Expression (gnat_node)), true); break; case N_Enumeration_Representation_Clause: |