diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-06-29 13:03:22 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-06-29 13:03:22 +0000 |
commit | 9182f7184019a076898de5f2429ea5822e5ff324 (patch) | |
tree | 3e323522044ad364a4f5045ce965e3e6397562fb /gcc/ada/gcc-interface/trans.c | |
parent | 1af21224e417d96b363e2b7dec0cbb0e3ed78f99 (diff) | |
download | gcc-9182f7184019a076898de5f2429ea5822e5ff324.zip gcc-9182f7184019a076898de5f2429ea5822e5ff324.tar.gz gcc-9182f7184019a076898de5f2429ea5822e5ff324.tar.bz2 |
re PR ada/48835 (porting GNAT to m68k-linux)
PR ada/48835
PR ada/61954
* gcc-interface/gigi.h (enum standard_datatypes): Add ADT_realloc_decl
(realloc_decl): New macro.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Use local
variable for the entity type and translate it as void pointer if the
entity has convention C.
(gnat_to_gnu_entity) <E_Function>: If this is not a definition and the
external name matches that of malloc_decl or realloc_decl, return the
correspoding node directly.
(gnat_to_gnu_subprog_type): Likewise for parameter and return types.
* gcc-interface/trans.c (gigi): Initialize void_list_node here, not...
Initialize realloc_decl.
* gcc-interface/utils.c (install_builtin_elementary_types): ...here.
(build_void_list_node): Delete.
* gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Return the
alignment of the system allocator for malloc_decl and realloc_decl.
Do not take alignment from void pointer types either.
From-SVN: r237850
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index f110e92..e237243 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -387,14 +387,13 @@ gigi (Node_Id gnat_root, true, false, NULL, gnat_literal); save_gnu_tree (gnat_literal, t, false); + /* Declare the building blocks of function nodes. */ + void_list_node = build_tree_list (NULL_TREE, void_type_node); void_ftype = build_function_type_list (void_type_node, NULL_TREE); ptr_void_ftype = build_pointer_type (void_ftype); /* Now declare run-time functions. */ ftype = build_function_type_list (ptr_type_node, sizetype, NULL_TREE); - - /* malloc is a function declaration tree for a function to allocate - memory. */ malloc_decl = create_subprog_decl (get_identifier ("__gnat_malloc"), NULL_TREE, ftype, @@ -402,12 +401,18 @@ gigi (Node_Id gnat_root, NULL, Empty); DECL_IS_MALLOC (malloc_decl) = 1; - /* free is a function declaration tree for a function to free memory. */ + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); free_decl = create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE, - build_function_type_list (void_type_node, - ptr_type_node, - NULL_TREE), + ftype, + NULL_TREE, is_disabled, true, true, true, false, + NULL, Empty); + + ftype = build_function_type_list (ptr_type_node, ptr_type_node, sizetype, + NULL_TREE); + realloc_decl + = create_subprog_decl (get_identifier ("__gnat_realloc"), NULL_TREE, + ftype, NULL_TREE, is_disabled, true, true, true, false, NULL, Empty); |