aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/trans.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2003-10-29 11:26:16 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2003-10-29 11:26:16 +0100
commit657a9dd94da7d0ea2a6488a1a1f404f86a82132c (patch)
treebfeb47fbaa83d3e8b0332c1ec93ed78b01e52cf8 /gcc/ada/trans.c
parente9da8a5af764758dab39da8afb53009bbd01e795 (diff)
downloadgcc-657a9dd94da7d0ea2a6488a1a1f404f86a82132c.zip
gcc-657a9dd94da7d0ea2a6488a1a1f404f86a82132c.tar.gz
gcc-657a9dd94da7d0ea2a6488a1a1f404f86a82132c.tar.bz2
3vtrasym.adb, [...]: Minor reformatting
* 3vtrasym.adb, 5vtraent.ads, sprint.adb, sem_ch10.adb: Minor reformatting * exp_ch5.adb (Expand_Assign_Array): Test for bit unaligned operands (Expand_Assign_Record): Test right hand side for bit unaligned as well * 3vtrasym.adb: * 5vtraent.adb: * 5vtraent.ads: * tb-alvms.c: Support for TBK$SYMBOLIZE-based symbolic traceback. * exp_disp.adb: Revert previous change, that did not work well when pragma No_Run_Time was used in conjunction with a run-time other than ZFP. * make.adb: (Gnatmake): When there are no Ada mains in attribute Main, disable the bind and link steps only is switch -z is not used. * Makefile.generic: Remove duplicated setting of CC. * Makefile.prolog: Set CC to gcc by default, to override make's default (cc). * einfo.h: Regenerated. * sem_ch10.adb (Analyze_Subunit): Restore state of suppress flags for current body, after compiling subunit. * itypes.adb (Create_Itype): In ASIS_Mode, do not freeze the itype when in deleted code, because gigi needs properly ordered freeze actions to annotate types. * freeze.adb (Is_Fully_Defined): Predicate must be recursive, to prevent the premature freezing of record type that contains subcomponents with a private type that does not yet have a completion. * sem_ch12.adb: (Analyze_Package_Instantiation): Check that instances can not be used in limited with_clauses. * sem_ch8.adb: (Analyze_Package_Renaming): Check that limited withed packages cannot be renamed. Improve text on error messages related to limited with_clauses. * einfo.adb, einfo.ads: Remove Non_Limited_Views attribute. * sprint.adb: (Sprint_Node_Actual): Print limited with_clauses. Update copyright notice. * sem_ch10.adb: (Build_Limited_Views): Complete its documentation. (Install_Limited_Context_Clauses): New subprogram that isolates all the checks required for limited context_clauses and installs the limited view. (Install_Limited_Withed_Unit): Complete its documentation. (Analyze_Context): Check that limited with_clauses are only allowed in package specs. (Install_Context): Call Install_Limited_Context_Clauses after the parents have been installed. (Install_Limited_Withed_Unit): Add documentation. Mark the installed package as 'From_With_Type'; this mark indicates that the limited view is installed. Used to check bad usages of limited with_clauses. (Build_Limited_Views): Do not add shadow entities to the scope's list of entities. Do not add real entities to the Non_Limited_Views chain. Improve error notification. (Remove_Context_Clauses): Remove context clauses in two phases: limited views first and regular views later (to maintain the stack model). (Remove_Limited_With_Clause): If the package is analyzed then reinstall its visible entities. * sem_type.adb (Specific_Type): Type Universal_Fixed is compatible with any type that Is_Fixed_Point_Type. * sinfo.ads: Fix documentation for Associated_Node attribute. * switch-c.adb (Scan_Front_End_Switches): ASIS_Mode is set now when both '-gnatc' and '-gnatt' are specified. * atree.adb (Initialize): Add initialization for Node_Count (set to zero). * decl.c (gnat_to_gnu_entity, case E_Subprogram): If no return value, do not consider as Pure. Part of implementation of function-at-a-time: * trans.c (gnat_to_gnu_code): If IS_STMT, call expand_expr_stmt. (tree_transform): Add new argument to build_component_ref. (tree_transform, case N_Assignment_Statement): Make and return an EXPR_STMT. (tree_transform): If result IS_STMT, set flags and return it. (gnat_expand_stmt, set_lineno_from_sloc): New functions. * utils2.c (build_simple_component_ref, build_component_ref): Add new arg, NO_FOLD_P. (build_binary_op, case EQ_EXPR): Pass additional arg to it. (build_allocator): Likewise. * utils.c (convert_to_fat_pointer, convert_to_thin_pointer, convert): Add new arg to build_component_ref. (maybe_unconstrained_array, unchecked_convert): Likewise. * ada-tree.def (EXPR_STMT): New code. * ada-tree.h (IS_STMT, TREE_SLOC, EXPR_STMT_EXPR): New macros. * decl.c (gnat_to_gnu_entity, case object): Add extra arg to build_component_ref calls. * misc.c (gnat_expand_expr): If IS_STMT, call gnat_expand_stmt. * gigi.h (gnat_expand_stmt, set_lineno_from_sloc): New functions. (build_component_ref): Add new argument, NO_FOLD_P. From-SVN: r73032
Diffstat (limited to 'gcc/ada/trans.c')
-rw-r--r--gcc/ada/trans.c69
1 files changed, 57 insertions, 12 deletions
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c
index d28ded8..0d4539f 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/trans.c
@@ -243,9 +243,13 @@ gnat_to_code (gnat_node)
gnu_root = tree_transform (gnat_node);
+ /* If we return a statement, generate code for it. */
+ if (IS_STMT (gnu_root))
+ expand_expr_stmt (gnu_root);
+
/* This should just generate code, not return a value. If it returns
a value, something is wrong. */
- if (gnu_root != error_mark_node)
+ else if (gnu_root != error_mark_node)
gigi_abort (302);
}
@@ -997,7 +1001,9 @@ tree_transform (gnat_node)
gnu_prefix = gnat_stabilize_reference (gnu_prefix, 0);
gnu_result
- = build_component_ref (gnu_prefix, NULL_TREE, gnu_field);
+ = build_component_ref (gnu_prefix, NULL_TREE, gnu_field,
+ (Nkind (Parent (gnat_node))
+ == N_Attribute_Reference));
}
if (gnu_result == 0)
@@ -2058,8 +2064,6 @@ tree_transform (gnat_node)
gnu_rhs
= maybe_unconstrained_array (gnat_to_gnu (Expression (gnat_node)));
- set_lineno (gnat_node, 1);
-
/* If range check is needed, emit code to generate it */
if (Do_Range_Check (Expression (gnat_node)))
gnu_rhs = emit_range_check (gnu_rhs, Etype (Name (gnat_node)));
@@ -2071,10 +2075,12 @@ tree_transform (gnat_node)
&& TREE_OVERFLOW (TYPE_SIZE (TREE_TYPE (gnu_lhs))))
|| (TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_rhs))) == INTEGER_CST
&& TREE_OVERFLOW (TYPE_SIZE (TREE_TYPE (gnu_rhs)))))
- expand_expr_stmt (build_call_raise (SE_Object_Too_Large));
+ gnu_result = build_call_raise (SE_Object_Too_Large);
else
- expand_expr_stmt (build_binary_op (MODIFY_EXPR, NULL_TREE,
- gnu_lhs, gnu_rhs));
+ gnu_result
+ = build_binary_op (MODIFY_EXPR, NULL_TREE, gnu_lhs, gnu_rhs);
+
+ gnu_result = build_nt (EXPR_STMT, gnu_result);
break;
case N_If_Statement:
@@ -3168,7 +3174,7 @@ tree_transform (gnat_node)
= length == 1 ? gnu_subprog_call
: build_component_ref
(gnu_subprog_call, NULL_TREE,
- TREE_PURPOSE (scalar_return_list));
+ TREE_PURPOSE (scalar_return_list), 0);
int unchecked_conversion
= Nkind (gnat_actual) == N_Unchecked_Type_Conversion;
/* If the actual is a conversion, get the inner expression,
@@ -3614,7 +3620,8 @@ tree_transform (gnat_node)
(build_unary_op
(INDIRECT_REF, NULL_TREE,
TREE_VALUE (gnu_except_ptr_stack)),
- get_identifier ("not_handled_by_others"), NULL_TREE)),
+ get_identifier ("not_handled_by_others"), NULL_TREE,
+ 0)),
integer_zero_node);
}
@@ -3643,7 +3650,7 @@ tree_transform (gnat_node)
(build_unary_op
(INDIRECT_REF, NULL_TREE,
TREE_VALUE (gnu_except_ptr_stack)),
- get_identifier ("import_code"), NULL_TREE),
+ get_identifier ("import_code"), NULL_TREE, 0),
gnu_expr);
else
this_choice
@@ -3664,7 +3671,7 @@ tree_transform (gnat_node)
(build_unary_op
(INDIRECT_REF, NULL_TREE,
TREE_VALUE (gnu_except_ptr_stack)),
- get_identifier ("lang"), NULL_TREE);
+ get_identifier ("lang"), NULL_TREE, 0);
this_choice
= build_binary_op
@@ -4024,8 +4031,17 @@ tree_transform (gnat_node)
gigi_abort (321);
}
+ /* If the result is a statement, set needed flags and return it. */
+ if (IS_STMT (gnu_result))
+ {
+ TREE_TYPE (gnu_result) = void_type_node;
+ TREE_THIS_VOLATILE (gnu_result) = TREE_SIDE_EFFECTS (gnu_result) = 1;
+ TREE_SLOC (gnu_result) = Sloc (gnat_node);
+ return gnu_result;
+ }
+
/* If the result is a constant that overflows, raise constraint error. */
- if (TREE_CODE (gnu_result) == INTEGER_CST
+ else if (TREE_CODE (gnu_result) == INTEGER_CST
&& TREE_CONSTANT_OVERFLOW (gnu_result))
{
post_error ("Constraint_Error will be raised at run-time?", gnat_node);
@@ -4137,6 +4153,25 @@ tree_transform (gnat_node)
return gnu_result;
}
+/* GNU_STMT is a statement. We generate code for that statement. */
+
+void
+gnat_expand_stmt (gnu_stmt)
+ tree gnu_stmt;
+{
+ set_lineno_from_sloc (TREE_SLOC (gnu_stmt), 1);
+
+ switch (TREE_CODE (gnu_stmt))
+ {
+ case EXPR_STMT:
+ expand_expr_stmt (EXPR_STMT_EXPR (gnu_stmt));
+ break;
+
+ default:
+ abort ();
+ }
+}
+
/* Force references to each of the entities in packages GNAT_NODE with's
so that the debugging information for all of them are identical
in all clients. Operate recursively on anything it with's, but check
@@ -5407,6 +5442,16 @@ set_lineno (gnat_node, write_note_p)
{
Source_Ptr source_location = Sloc (gnat_node);
+ set_lineno_from_sloc (source_location, write_note_p);
+}
+
+/* Likewise, but passed a Sloc. */
+
+void
+set_lineno_from_sloc (source_location, write_note_p)
+ Source_Ptr source_location;
+ int write_note_p;
+{
/* If node not from source code, ignore. */
if (source_location < 0)
return;