diff options
author | Jason Merrill <jason@redhat.com> | 2003-01-03 14:29:51 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2003-01-03 14:29:51 -0500 |
commit | 6cce57b0d073bc545a9a2855885e65a4ca43ce4d (patch) | |
tree | ed397435e12ce43cd81067953111919e1628866f /gcc/c-common.c | |
parent | 9c91c80bb7595b799dc5c653de60f9c9d5898d14 (diff) | |
download | gcc-6cce57b0d073bc545a9a2855885e65a4ca43ce4d.tar.gz |
c-common.c (finish_fname_decls): Put the DECL_STMTs inside the outermost scope.
* c-common.c (finish_fname_decls): Put the DECL_STMTs inside the
outermost scope.
* c-decl.c (c_make_fname_decl): Push the decls there, too.
cp/
* decl.c (cp_make_fname_decl): Push the decls inside the
outermost scope.
From-SVN: r60848
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 79502d2fde8..12cacab3d55 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1050,13 +1050,18 @@ finish_fname_decls () if (body) { - /* They were called into existence, so add to statement tree. */ - body = chainon (body, - TREE_CHAIN (DECL_SAVED_TREE (current_function_decl))); - body = build_stmt (COMPOUND_STMT, body); - - COMPOUND_STMT_NO_SCOPE (body) = 1; - TREE_CHAIN (DECL_SAVED_TREE (current_function_decl)) = body; + /* They were called into existence, so add to statement tree. Add + the DECL_STMTs inside the outermost scope. */ + tree *p = &DECL_SAVED_TREE (current_function_decl); + /* Skip the dummy EXPR_STMT and any EH_SPEC_BLOCK. */ + while (TREE_CODE (*p) != COMPOUND_STMT) + p = &TREE_CHAIN (*p); + p = &COMPOUND_BODY (*p); + if (TREE_CODE (*p) == SCOPE_STMT) + p = &TREE_CHAIN (*p); + + body = chainon (body, *p); + *p = body; } for (ix = 0; fname_vars[ix].decl; ix++) @@ -1079,7 +1084,7 @@ finish_fname_decls () saved_function_name_decls = stack; } -/* Return the text name of the current function, suitable prettified +/* Return the text name of the current function, suitably prettified by PRETTY_P. */ const char * @@ -1163,7 +1168,7 @@ fname_decl (rid, id) } if (!ix && !current_function_decl) pedwarn_with_decl (decl, "`%s' is not defined outside of function scope"); - + return decl; } |