diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2011-09-26 08:45:36 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-09-26 08:45:36 +0000 |
commit | 42acad07c083eb1a0de24a8050febac46e3ae0fa (patch) | |
tree | b4120916df165fb7f745fbf1b345a23d67443257 /gcc/ada/gcc-interface/trans.c | |
parent | a1d7228158d344b16ef9baf8c8ed7a27649fc410 (diff) | |
download | gcc-42acad07c083eb1a0de24a8050febac46e3ae0fa.zip gcc-42acad07c083eb1a0de24a8050febac46e3ae0fa.tar.gz gcc-42acad07c083eb1a0de24a8050febac46e3ae0fa.tar.bz2 |
trans.c (assoc_to_constructor): Minor tweaks.
* gcc-interface/trans.c (assoc_to_constructor): Minor tweaks.
* gcc-interface/utils2.c (build_simple_component_ref): Fix formatting
issues. Use COMPLETE_TYPE_P in assertion. Also set TREE_READONLY if
the type of the record is TYPE_READONLY.
From-SVN: r179184
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 92ba778..de26f97 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -7728,24 +7728,21 @@ process_type (Entity_Id gnat_entity) } } -/* GNAT_ENTITY is the type of the resulting constructors, - GNAT_ASSOC is the front of the Component_Associations of an N_Aggregate, - and GNU_TYPE is the GCC type of the corresponding record. - - Return a CONSTRUCTOR to build the record. */ +/* GNAT_ENTITY is the type of the resulting constructor, GNAT_ASSOC is the + front of the Component_Associations of an N_Aggregate and GNU_TYPE is the + GCC type of the corresponding record type. Return the CONSTRUCTOR. */ static tree assoc_to_constructor (Entity_Id gnat_entity, Node_Id gnat_assoc, tree gnu_type) { - tree gnu_list, gnu_result; + tree gnu_list = NULL_TREE, gnu_result; /* We test for GNU_FIELD being empty in the case where a variant was the last thing since we don't take things off GNAT_ASSOC in that case. We check GNAT_ASSOC in case we have a variant, but it has no fields. */ - for (gnu_list = NULL_TREE; Present (gnat_assoc); - gnat_assoc = Next (gnat_assoc)) + for (; Present (gnat_assoc); gnat_assoc = Next (gnat_assoc)) { Node_Id gnat_field = First (Choices (gnat_assoc)); tree gnu_field = gnat_to_gnu_field_decl (Entity (gnat_field)); @@ -7762,8 +7759,8 @@ assoc_to_constructor (Entity_Id gnat_entity, Node_Id gnat_assoc, tree gnu_type) continue; /* Also ignore discriminants of Unchecked_Unions. */ - else if (Is_Unchecked_Union (gnat_entity) - && Ekind (Entity (gnat_field)) == E_Discriminant) + if (Is_Unchecked_Union (gnat_entity) + && Ekind (Entity (gnat_field)) == E_Discriminant) continue; /* Before assigning a value in an aggregate make sure range checks @@ -7780,13 +7777,9 @@ assoc_to_constructor (Entity_Id gnat_entity, Node_Id gnat_assoc, tree gnu_type) gnu_result = extract_values (gnu_list, gnu_type); #ifdef ENABLE_CHECKING - { - tree gnu_field; - - /* Verify every entry in GNU_LIST was used. */ - for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field)) - gcc_assert (TREE_ADDRESSABLE (gnu_field)); - } + /* Verify that every entry in GNU_LIST was used. */ + for (; gnu_list; gnu_list = TREE_CHAIN (gnu_list)) + gcc_assert (TREE_ADDRESSABLE (gnu_list)); #endif return gnu_result; |