summaryrefslogtreecommitdiff
path: root/gcc/ada/utils2.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-29 10:26:16 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-29 10:26:16 +0000
commit05e5286dd5f42ecfa912ad91c5a7561829f47134 (patch)
treebfeb47fbaa83d3e8b0332c1ec93ed78b01e52cf8 /gcc/ada/utils2.c
parentdbdb7b34da95d912b34192e51e2b5b6a872961f0 (diff)
downloadgcc-05e5286dd5f42ecfa912ad91c5a7561829f47134.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73032 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r--gcc/ada/utils2.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index c2ffdfbc153..3e90487d711 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -50,7 +50,7 @@ static tree contains_null_expr PARAMS ((tree));
static tree compare_arrays PARAMS ((tree, tree, tree));
static tree nonbinary_modular_operation PARAMS ((enum tree_code, tree,
tree, tree));
-static tree build_simple_component_ref PARAMS ((tree, tree, tree));
+static tree build_simple_component_ref PARAMS ((tree, tree, tree, int));
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical
operation.
@@ -955,7 +955,8 @@ build_binary_op (op_code, result_type, left_operand, right_operand)
&& integer_zerop (TREE_VALUE (CONSTRUCTOR_ELTS (right_operand))))
{
right_operand = build_component_ref (left_operand, NULL_TREE,
- TYPE_FIELDS (left_base_type));
+ TYPE_FIELDS (left_base_type),
+ 0);
left_operand = convert (TREE_TYPE (right_operand),
integer_zero_node);
}
@@ -1609,16 +1610,17 @@ gnat_build_constructor (type, list)
/* Return a COMPONENT_REF to access a field that is given by COMPONENT,
an IDENTIFIER_NODE giving the name of the field, or FIELD, a FIELD_DECL,
- for the field.
+ for the field. Don't fold the result if NO_FOLD_P is nonzero.
We also handle the fact that we might have been passed a pointer to the
actual record and know how to look for fields in variant parts. */
static tree
-build_simple_component_ref (record_variable, component, field)
+build_simple_component_ref (record_variable, component, field, no_fold_p)
tree record_variable;
tree component;
tree field;
+ int no_fold_p;
{
tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable));
tree ref;
@@ -1674,8 +1676,9 @@ build_simple_component_ref (record_variable, component, field)
{
tree field_ref
= build_simple_component_ref (record_variable,
- NULL_TREE, new_field);
- ref = build_simple_component_ref (field_ref, NULL_TREE, field);
+ NULL_TREE, new_field, no_fold_p);
+ ref = build_simple_component_ref (field_ref, NULL_TREE, field,
+ no_fold_p);
if (ref != 0)
return ref;
@@ -1697,19 +1700,21 @@ build_simple_component_ref (record_variable, component, field)
|| TYPE_VOLATILE (record_type))
TREE_THIS_VOLATILE (ref) = 1;
- return fold (ref);
+ return no_fold_p ? ref : fold (ref);
}
/* Like build_simple_component_ref, except that we give an error if the
reference could not be found. */
tree
-build_component_ref (record_variable, component, field)
+build_component_ref (record_variable, component, field, no_fold_p)
tree record_variable;
tree component;
tree field;
+ int no_fold_p;
{
- tree ref = build_simple_component_ref (record_variable, component, field);
+ tree ref = build_simple_component_ref (record_variable, component, field,
+ no_fold_p);
if (ref != 0)
return ref;
@@ -1945,7 +1950,7 @@ build_allocator (type, init, result_type, gnat_proc, gnat_pool, gnat_node)
build_component_ref
(build_unary_op (INDIRECT_REF, NULL_TREE,
convert (storage_ptr_type, storage)),
- NULL_TREE, TYPE_FIELDS (storage_type)),
+ NULL_TREE, TYPE_FIELDS (storage_type), 0),
build_template (template_type, type, NULL_TREE)),
convert (result_type, convert (storage_ptr_type, storage)));
}
@@ -1990,7 +1995,7 @@ build_allocator (type, init, result_type, gnat_proc, gnat_pool, gnat_node)
result = convert (build_pointer_type (new_type), result);
result = build_unary_op (INDIRECT_REF, NULL_TREE, result);
result = build_component_ref (result, NULL_TREE,
- TYPE_FIELDS (new_type));
+ TYPE_FIELDS (new_type), 0);
result = convert (result_type,
build_unary_op (ADDR_EXPR, NULL_TREE, result));
}