aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2011-05-03 16:34:20 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-05-03 16:34:20 +0000
commitc1fd8753c5ebe34277fa7e75e4e92c1e8bc08277 (patch)
tree6964f59c886278b30b9d8b82290cdfa0e10e5b1a /gcc/ada
parentf0b568f3c4108c65eeb0123e2d64988b172f9e75 (diff)
downloadgcc-c1fd8753c5ebe34277fa7e75e4e92c1e8bc08277.zip
gcc-c1fd8753c5ebe34277fa7e75e4e92c1e8bc08277.tar.gz
gcc-c1fd8753c5ebe34277fa7e75e4e92c1e8bc08277.tar.bz2
trans.c (gigi): Call build_function_type_list instead of build_function_type.
* gcc-interface/trans.c (gigi): Call build_function_type_list instead of build_function_type. Adjust calls to... (build_raise_check): ...this. Do not take a void_tree parameter. Call build_function_type_list instead of build_function_type. Fix head comment and swap couple of conditional blocks. Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com> From-SVN: r173325
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/gcc-interface/trans.c151
2 files changed, 73 insertions, 87 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 22461b6..b78355d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-03 Nathan Froyd <froydnj@codesourcery.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (gigi): Call build_function_type_list instead
+ of build_function_type. Adjust calls to...
+ (build_raise_check): ...this. Do not take a void_tree parameter.
+ Call build_function_type_list instead of build_function_type.
+ Fix head comment and swap couple of conditional blocks.
+
2011-04-30 Eric Botcazou <ebotcazou@adacore.com>
* gnatvsn.ads (Library_Version): Bump to 4.7.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index b4094ca0..9e3d2e2 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -214,7 +214,7 @@ static void set_expr_location_from_node (tree, Node_Id);
static bool set_end_locus_from_node (tree, Node_Id);
static void set_gnu_expr_location_from_node (tree, Node_Id);
static int lvalue_required_p (Node_Id, tree, bool, bool, bool);
-static tree build_raise_check (int, tree, enum exception_info_kind);
+static tree build_raise_check (int, enum exception_info_kind);
/* Hooks for debug info back-ends, only supported and used in a restricted set
of configurations. */
@@ -236,7 +236,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
Entity_Id standard_exception_type, Int gigi_operating_mode)
{
Entity_Id gnat_literal;
- tree long_long_float_type, exception_type, t;
+ tree long_long_float_type, exception_type, t, ftype;
tree int64_type = gnat_type_for_size (64, 0);
struct elab_info *info;
int i;
@@ -344,39 +344,34 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
DECL_IGNORED_P (t) = 1;
save_gnu_tree (gnat_literal, t, false);
- void_ftype = build_function_type (void_type_node, NULL_TREE);
+ void_ftype = build_function_type_list (void_type_node, NULL_TREE);
ptr_void_ftype = build_pointer_type (void_ftype);
/* Now declare run-time functions. */
- t = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
+ ftype = build_function_type_list (ptr_void_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,
- build_function_type (ptr_void_type_node,
- tree_cons (NULL_TREE,
- sizetype, t)),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ ftype, NULL_TREE, false, true, true, true, NULL,
+ Empty);
DECL_IS_MALLOC (malloc_decl) = 1;
/* malloc32 is a function declaration tree for a function to allocate
32-bit memory on a 64-bit system. Needed only on 64-bit VMS. */
malloc32_decl
= create_subprog_decl (get_identifier ("__gnat_malloc32"), NULL_TREE,
- build_function_type (ptr_void_type_node,
- tree_cons (NULL_TREE,
- sizetype, t)),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ ftype, NULL_TREE, false, true, true, true, NULL,
+ Empty);
DECL_IS_MALLOC (malloc32_decl) = 1;
/* free is a function declaration tree for a function to free memory. */
free_decl
= create_subprog_decl (get_identifier ("__gnat_free"), NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- ptr_void_type_node,
- t)),
+ build_function_type_list (void_type_node,
+ ptr_void_type_node,
+ NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty);
/* This is used for 64-bit multiplication with overflow checking. */
@@ -403,18 +398,17 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
/* Functions to get and set the jumpbuf pointer for the current thread. */
get_jmpbuf_decl
= create_subprog_decl
- (get_identifier ("system__soft_links__get_jmpbuf_address_soft"),
- NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ (get_identifier ("system__soft_links__get_jmpbuf_address_soft"),
+ NULL_TREE, build_function_type_list (jmpbuf_ptr_type, NULL_TREE),
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (get_jmpbuf_decl) = 1;
set_jmpbuf_decl
= create_subprog_decl
- (get_identifier ("system__soft_links__set_jmpbuf_address_soft"),
- NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ (get_identifier ("system__soft_links__set_jmpbuf_address_soft"),
+ NULL_TREE, build_function_type_list (void_type_node, jmpbuf_ptr_type,
+ NULL_TREE),
+ NULL_TREE, false, true, true, true, NULL, Empty);
DECL_IGNORED_P (set_jmpbuf_decl) = 1;
/* setjmp returns an integer and has one operand, which is a pointer to
@@ -422,8 +416,8 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
setjmp_decl
= create_subprog_decl
(get_identifier ("__builtin_setjmp"), NULL_TREE,
- build_function_type (integer_type_node,
- tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
+ build_function_type_list (integer_type_node, jmpbuf_ptr_type,
+ NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
@@ -433,29 +427,25 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
update_setjmp_buf_decl
= create_subprog_decl
(get_identifier ("__builtin_update_setjmp_buf"), NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE, jmpbuf_ptr_type, t)),
+ build_function_type_list (void_type_node, jmpbuf_ptr_type, NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty);
DECL_BUILT_IN_CLASS (update_setjmp_buf_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (update_setjmp_buf_decl) = BUILT_IN_UPDATE_SETJMP_BUF;
/* Hooks to call when entering/leaving an exception handler. */
+ ftype
+ = build_function_type_list (void_type_node, ptr_void_type_node, NULL_TREE);
+
begin_handler_decl
= create_subprog_decl (get_identifier ("__gnat_begin_handler"), NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- ptr_void_type_node,
- t)),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ ftype, NULL_TREE, false, true, true, true, NULL,
+ Empty);
DECL_IGNORED_P (begin_handler_decl) = 1;
end_handler_decl
= create_subprog_decl (get_identifier ("__gnat_end_handler"), NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- ptr_void_type_node,
- t)),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ ftype, NULL_TREE, false, true, true, true, NULL,
+ Empty);
DECL_IGNORED_P (end_handler_decl) = 1;
/* If in no exception handlers mode, all raise statements are redirected to
@@ -466,13 +456,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree decl
= create_subprog_decl
(get_identifier ("__gnat_last_chance_handler"), NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- build_pointer_type
- (unsigned_char_type_node),
- tree_cons (NULL_TREE,
- integer_type_node,
- t))),
+ build_function_type_list (void_type_node,
+ build_pointer_type
+ (unsigned_char_type_node),
+ integer_type_node, NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty);
TREE_THIS_VOLATILE (decl) = 1;
TREE_SIDE_EFFECTS (decl) = 1;
@@ -485,10 +472,10 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
{
/* Otherwise, make one decl for each exception reason. */
for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++)
- gnat_raise_decls[i] = build_raise_check (i, t, exception_simple);
+ gnat_raise_decls[i] = build_raise_check (i, exception_simple);
for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls_ext); i++)
gnat_raise_decls_ext[i]
- = build_raise_check (i, t,
+ = build_raise_check (i,
i == CE_Index_Check_Failed
|| i == CE_Range_Check_Failed
|| i == CE_Invalid_Data
@@ -503,21 +490,20 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
/* Make other functions used for exception processing. */
get_excptr_decl
= create_subprog_decl
- (get_identifier ("system__soft_links__get_gnat_exception"),
- NULL_TREE,
- build_function_type (build_pointer_type (except_type_node), NULL_TREE),
+ (get_identifier ("system__soft_links__get_gnat_exception"), NULL_TREE,
+ build_function_type_list (build_pointer_type (except_type_node),
+ NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty);
raise_nodefer_decl
= create_subprog_decl
(get_identifier ("__gnat_raise_nodefer_with_msg"), NULL_TREE,
- build_function_type (void_type_node,
- tree_cons (NULL_TREE,
- build_pointer_type (except_type_node),
- t)),
+ build_function_type_list (void_type_node,
+ build_pointer_type (except_type_node),
+ NULL_TREE),
NULL_TREE, false, true, true, true, NULL, Empty);
- /* Indicate that these never return. */
+ /* Indicate that it never returns. */
TREE_THIS_VOLATILE (raise_nodefer_decl) = 1;
TREE_SIDE_EFFECTS (raise_nodefer_decl) = 1;
TREE_TYPE (raise_nodefer_decl)
@@ -638,49 +624,40 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
}
/* Return a subprogram decl corresponding to __gnat_rcheck_xx for the given
- CHECK (if EXTENDED is false), or __gnat_rcheck_xx_ext (if EXTENDED is
- true). */
+ CHECK if KIND is EXCEPTION_SIMPLE, or else to __gnat_rcheck_xx_ext. */
static tree
-build_raise_check (int check, tree void_tree, enum exception_info_kind kind)
+build_raise_check (int check, enum exception_info_kind kind)
{
char name[21];
- tree result;
+ tree result, ftype;
- if (kind != exception_simple)
+ if (kind == exception_simple)
{
- sprintf (name, "__gnat_rcheck_%.2d_ext", check);
- result
- = create_subprog_decl
- (get_identifier (name), NULL_TREE,
- build_function_type
- (void_type_node,
- tree_cons
- (NULL_TREE, build_pointer_type (unsigned_char_type_node),
- tree_cons (NULL_TREE, integer_type_node,
- tree_cons (NULL_TREE, integer_type_node,
- kind == exception_column
- ? void_tree
- : tree_cons (NULL_TREE, integer_type_node,
- tree_cons (NULL_TREE,
- integer_type_node,
- void_tree)))))),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ sprintf (name, "__gnat_rcheck_%.2d", check);
+ ftype
+ = build_function_type_list (void_type_node,
+ build_pointer_type
+ (unsigned_char_type_node),
+ integer_type_node, NULL_TREE);
}
else
{
- sprintf (name, "__gnat_rcheck_%.2d", check);
- result
- = create_subprog_decl
- (get_identifier (name), NULL_TREE,
- build_function_type
- (void_type_node,
- tree_cons
- (NULL_TREE, build_pointer_type (unsigned_char_type_node),
- tree_cons (NULL_TREE, integer_type_node, void_tree))),
- NULL_TREE, false, true, true, true, NULL, Empty);
+ tree t = (kind == exception_column ? NULL_TREE : integer_type_node);
+ sprintf (name, "__gnat_rcheck_%.2d_ext", check);
+ ftype
+ = build_function_type_list (void_type_node,
+ build_pointer_type
+ (unsigned_char_type_node),
+ integer_type_node, integer_type_node,
+ t, t, NULL_TREE);
}
+ result
+ = create_subprog_decl (get_identifier (name), NULL_TREE, ftype, NULL_TREE,
+ false, true, true, true, NULL, Empty);
+
+ /* Indicate that it never returns. */
TREE_THIS_VOLATILE (result) = 1;
TREE_SIDE_EFFECTS (result) = 1;
TREE_TYPE (result)