From cfc839a4b23ef56b53de632a713b1e6d1f2b89d4 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 27 Oct 2010 21:15:06 +0000 Subject: [PATCH] trans.c (gigi): Fix formatting issues. * gcc-interface/trans.c (gigi): Fix formatting issues. (build_raise_check): Likewise. (gnat_to_gnu): Likewise. * gcc-interface/utils2.c (build_call_raise_range): Likewise. (build_call_raise_column): Likewise. From-SVN: r166017 --- gcc/ada/ChangeLog | 8 ++++ gcc/ada/gcc-interface/trans.c | 72 ++++++++++++++++++---------------- gcc/ada/gcc-interface/utils2.c | 8 ++-- 3 files changed, 50 insertions(+), 38 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2f3fac855fc..1d27923619d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2010-10-27 Eric Botcazou + + * gcc-interface/trans.c (gigi): Fix formatting issues. + (build_raise_check): Likewise. + (gnat_to_gnu): Likewise. + * gcc-interface/utils2.c (build_call_raise_range): Likewise. + (build_call_raise_column): Likewise. + 2010-10-26 Robert Dewar * exp_ch5.adb, exp_prag.adb, sem_ch3.adb, exp_atag.adb, layout.adb, diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index f130439d7c3..39dc0284d11 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -469,13 +469,12 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, integer_type_node, t))), NULL_TREE, false, true, true, NULL, Empty); - - for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) - gnat_raise_decls[i] = decl; TREE_THIS_VOLATILE (decl) = 1; TREE_SIDE_EFFECTS (decl) = 1; TREE_TYPE (decl) = build_qualified_type (TREE_TYPE (decl), TYPE_QUAL_VOLATILE); + for (i = 0; i < (int) ARRAY_SIZE (gnat_raise_decls); i++) + gnat_raise_decls[i] = decl; } else { @@ -647,37 +646,42 @@ build_raise_check (int check, tree void_tree, enum exception_info_kind kind) if (kind != exception_simple) { sprintf (name, "__gnat_rcheck_%.2d_ext", check); - result = create_subprog_decl - (get_identifier (name), NULL_TREE, - build_function_type + 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, NULL, Empty); + (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, NULL, Empty); } else { sprintf (name, "__gnat_rcheck_%.2d", check); - result = create_subprog_decl - (get_identifier (name), NULL_TREE, - build_function_type + 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, NULL, Empty); + (NULL_TREE, build_pointer_type (unsigned_char_type_node), + tree_cons (NULL_TREE, integer_type_node, void_tree))), + NULL_TREE, false, true, true, NULL, Empty); } + TREE_THIS_VOLATILE (result) = 1; TREE_SIDE_EFFECTS (result) = 1; TREE_TYPE (result) = build_qualified_type (TREE_TYPE (result), TYPE_QUAL_VOLATILE); + return result; } @@ -5602,8 +5606,8 @@ gnat_to_gnu (Node_Id gnat_node) case N_Raise_Program_Error: case N_Raise_Storage_Error: { - int reason = UI_To_Int (Reason (gnat_node)); - Node_Id cond = Condition (gnat_node); + const int reason = UI_To_Int (Reason (gnat_node)); + const Node_Id cond = Condition (gnat_node); bool handled = false; if (type_annotate_only) @@ -5622,8 +5626,8 @@ gnat_to_gnu (Node_Id gnat_node) { if (reason == CE_Access_Check_Failed) { - handled = true; gnu_result = build_call_raise_column (reason, gnat_node); + handled = true; } else if ((reason == CE_Index_Check_Failed || reason == CE_Range_Check_Failed @@ -5640,12 +5644,14 @@ gnat_to_gnu (Node_Id gnat_node) && Known_Esize (type) && UI_To_Int (Esize (type)) <= 32) { + Node_Id right_op = Right_Opnd (op); + gnu_result + = build_call_raise_range + (reason, gnat_node, + gnat_to_gnu (index), /* index */ + gnat_to_gnu (Low_Bound (right_op)), /* first */ + gnat_to_gnu (High_Bound (right_op))); /* last */ handled = true; - gnu_result = build_call_raise_range - (reason, gnat_node, - gnat_to_gnu (index), /* index */ - gnat_to_gnu (Low_Bound (Right_Opnd (op))), /* first */ - gnat_to_gnu (High_Bound (Right_Opnd (op)))); /* last */ } } } @@ -5654,20 +5660,18 @@ gnat_to_gnu (Node_Id gnat_node) { set_expr_location_from_node (gnu_result, gnat_node); gnu_result = build3 (COND_EXPR, void_type_node, - gnat_to_gnu (cond), + gnat_to_gnu (cond), gnu_result, alloc_stmt_list ()); } else { gnu_result = build_call_raise (reason, gnat_node, kind); - /* If the type is VOID, this is a statement, so we need to - generate the code for the call. Handle a Condition, if there - is one. */ + /* If the type is VOID, this is a statement, so we need to generate + the code for the call. Handle a Condition, if there is one. */ if (TREE_CODE (gnu_result_type) == VOID_TYPE) { set_expr_location_from_node (gnu_result, gnat_node); - if (Present (cond)) gnu_result = build3 (COND_EXPR, void_type_node, gnat_to_gnu (cond), diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 0671308369f..8088d53a1b0 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -1590,8 +1590,8 @@ build_call_raise_range (int msg, Node_Id gnat_node, build_index_type (size_int (len))); call = build_call_nary (TREE_TYPE (TREE_TYPE (fndecl)), - build_unary_op (ADDR_EXPR, NULL_TREE, fndecl), - 6, + build_unary_op (ADDR_EXPR, NULL_TREE, fndecl), + 6, build1 (ADDR_EXPR, build_pointer_type (unsigned_char_type_node), filename), @@ -1644,8 +1644,8 @@ build_call_raise_column (int msg, Node_Id gnat_node) build_index_type (size_int (len))); call = build_call_nary (TREE_TYPE (TREE_TYPE (fndecl)), - build_unary_op (ADDR_EXPR, NULL_TREE, fndecl), - 3, + build_unary_op (ADDR_EXPR, NULL_TREE, fndecl), + 3, build1 (ADDR_EXPR, build_pointer_type (unsigned_char_type_node), filename), -- 2.30.2