aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-08-30 16:30:41 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-08-30 16:30:41 +0000
commitbd9c7fb90927f0f22e6bbbb5f809bb8e5f6eaa95 (patch)
treea018492c11bb2be41decae08c806fe626ac616f2 /gcc/ada/gcc-interface/utils.c
parentfc26dab30fffbe34609fd3fef56134fc07598b8d (diff)
downloadgcc-bd9c7fb90927f0f22e6bbbb5f809bb8e5f6eaa95.zip
gcc-bd9c7fb90927f0f22e6bbbb5f809bb8e5f6eaa95.tar.gz
gcc-bd9c7fb90927f0f22e6bbbb5f809bb8e5f6eaa95.tar.bz2
utils.c (gnat_pushdecl): Remove test for PARM_DECLs.
* gcc-interface/utils.c (gnat_pushdecl): Remove test for PARM_DECLs. Attach fake PARM_DECLs to the topmost block of the function. From-SVN: r163651
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index cef7232..c3a39d4 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -418,11 +418,8 @@ gnat_poplevel (void)
void
gnat_pushdecl (tree decl, Node_Id gnat_node)
{
- /* If this decl is public external or at toplevel, there is no context.
- But PARM_DECLs always go in the level of its function. */
- if (TREE_CODE (decl) != PARM_DECL
- && ((DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
- || global_bindings_p ()))
+ /* If this decl is public external or at toplevel, there is no context. */
+ if ((TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) || global_bindings_p ())
DECL_CONTEXT (decl) = 0;
else
{
@@ -461,8 +458,14 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
}
else
{
- DECL_CHAIN (decl) = BLOCK_VARS (current_binding_level->block);
- BLOCK_VARS (current_binding_level->block) = decl;
+ tree block;
+ /* Fake PARM_DECLs go into the topmost block of the function. */
+ if (TREE_CODE (decl) == PARM_DECL)
+ block = BLOCK_SUPERCONTEXT (current_binding_level->block);
+ else
+ block = current_binding_level->block;
+ DECL_CHAIN (decl) = BLOCK_VARS (block);
+ BLOCK_VARS (block) = decl;
}
}
@@ -1878,9 +1881,7 @@ end_subprog_body (tree body)
{
tree fndecl = current_function_decl;
- /* Mark the BLOCK for this level as being for this function and pop the
- level. Since the vars in it are the parameters, clear them. */
- BLOCK_VARS (current_binding_level->block) = NULL_TREE;
+ /* Attach the BLOCK for this level to the function and pop the level. */
BLOCK_SUPERCONTEXT (current_binding_level->block) = fndecl;
DECL_INITIAL (fndecl) = current_binding_level->block;
gnat_poplevel ();