diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2011-11-20 10:16:48 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-11-20 10:16:48 +0000 |
commit | 0d24bf7601974f373cce377a50132c485d488e18 (patch) | |
tree | c93f46a1239be5714ccdf17ed39e4a4756828819 /gcc/ada/gcc-interface/trans.c | |
parent | b1a785fb5e5ada5ffb07640bb8fe0d15f3bddb68 (diff) | |
download | gcc-0d24bf7601974f373cce377a50132c485d488e18.zip gcc-0d24bf7601974f373cce377a50132c485d488e18.tar.gz gcc-0d24bf7601974f373cce377a50132c485d488e18.tar.bz2 |
trans.c (Subprogram_Body_to_gnu): Add comment.
* gcc-interface/trans.c (Subprogram_Body_to_gnu): Add comment.
(gnat_to_gnu) <N_Return_Statement>: Add 'else' to avoid doing a useless
test. Tweak default case.
<N_Goto_Statement>: Use better formatting.
* gcc-interface/utils2.c (maybe_wrap_malloc): Use INIT_EXPR instead of
MODIFY_EXPR to initialize the storage.
(build_allocator): Likewise.
From-SVN: r181527
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 8a74e6c..bc6172a 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -3278,6 +3278,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) save_gnu_tree (gnat_param, NULL_TREE, false); } + /* Disconnect the variable created for the return value. */ if (gnu_return_var_elmt) TREE_VALUE (gnu_return_var_elmt) = void_type_node; @@ -5889,12 +5890,12 @@ gnat_to_gnu (Node_Id gnat_node) gnat_node, false); } - /* If the function returns by invisible reference, dereference + /* Otherwise, if it returns by invisible reference, dereference the pointer it is passed using the type of the return value and build the copy operation manually. This ensures that we don't copy too much data, for example if the return type is unconstrained with a maximum size. */ - if (TREE_ADDRESSABLE (gnu_subprog_type)) + else if (TREE_ADDRESSABLE (gnu_subprog_type)) { tree gnu_ret_deref = build_unary_op (INDIRECT_REF, TREE_TYPE (gnu_ret_val), @@ -5905,11 +5906,9 @@ gnat_to_gnu (Node_Id gnat_node) gnu_ret_val = NULL_TREE; } } + else - { - gnu_ret_obj = NULL_TREE; - gnu_ret_val = NULL_TREE; - } + gnu_ret_obj = gnu_ret_val = NULL_TREE; /* If we have a return label defined, convert this into a branch to that label. The return proper will be handled elsewhere. */ @@ -5934,8 +5933,8 @@ gnat_to_gnu (Node_Id gnat_node) break; case N_Goto_Statement: - gnu_result = build1 (GOTO_EXPR, void_type_node, - gnat_to_gnu (Name (gnat_node))); + gnu_result + = build1 (GOTO_EXPR, void_type_node, gnat_to_gnu (Name (gnat_node))); break; /***************************/ |