diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2009-01-11 12:24:02 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2009-01-11 12:24:02 +0000 |
commit | 13318d2fc8116f04aba7e025d0a06be5bec73262 (patch) | |
tree | 96e350ff0f72e66e9dfa84861b600a114ce233e2 /gcc/ada/gcc-interface/decl.c | |
parent | 53a7ff9a9a3cd7c53a80e560d42fed25af8752b5 (diff) | |
download | gcc-13318d2fc8116f04aba7e025d0a06be5bec73262.zip gcc-13318d2fc8116f04aba7e025d0a06be5bec73262.tar.gz gcc-13318d2fc8116f04aba7e025d0a06be5bec73262.tar.bz2 |
decl.c (gnat_to_gnu_entity): Put the _Tag field before any discriminants in the field list.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Put
the _Tag field before any discriminants in the field list.
(components_to_record): Remove obsolete comment.
From-SVN: r143267
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 20c5fb4..0c7321d 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -3139,8 +3139,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = DECL_DISCRIMINANT_NUMBER (gnu_old_field); TREE_THIS_VOLATILE (gnu_field) = TREE_THIS_VOLATILE (gnu_old_field); - TREE_CHAIN (gnu_field) = gnu_field_list; - gnu_field_list = gnu_field; + + /* To match the layout crafted in components_to_record, if + this is the _Tag field, put it before any discriminants + instead of after them as for all other fields. */ + if (Chars (gnat_field) == Name_uTag) + gnu_field_list = chainon (gnu_field_list, gnu_field); + else + { + TREE_CHAIN (gnu_field) = gnu_field_list; + gnu_field_list = gnu_field; + } + save_gnu_tree (gnat_field, gnu_field, false); } @@ -6436,8 +6446,7 @@ components_to_record (tree gnu_record_type, Node_Id component_list, packed, definition); /* If this is the _Tag field, put it before any discriminants, - instead of after them as is the case for all other fields. - Ignore field of void type if only annotating. */ + instead of after them as is the case for all other fields. */ if (Chars (gnat_field) == Name_uTag) gnu_field_list = chainon (gnu_field_list, gnu_field); else |