aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-01-20 10:29:09 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-01-20 10:29:09 +0000
commit59f5c969a5c5ac08e450ae74c260d57db574a5d0 (patch)
treedcc064d96f4f7e1da1b454bb6466873d8b32b50f /gcc/ada/gcc-interface/decl.c
parent621955cb7cc891dc7504523d7cac10e0ec8c17e7 (diff)
downloadgcc-59f5c969a5c5ac08e450ae74c260d57db574a5d0.zip
gcc-59f5c969a5c5ac08e450ae74c260d57db574a5d0.tar.gz
gcc-59f5c969a5c5ac08e450ae74c260d57db574a5d0.tar.bz2
decl.c (gnat_to_gnu_entity): Remove obsolete code for type_annotate_only mode...
* gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Component>: Remove obsolete code for type_annotate_only mode, simplify code and slightly improve wording of comments. From-SVN: r206794
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c56
1 files changed, 16 insertions, 40 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index ad129c6..9e1ecb0 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -491,19 +491,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
run-time library. */
goto object;
- case E_Discriminant:
case E_Component:
+ case E_Discriminant:
{
/* The GNAT record where the component was defined. */
Entity_Id gnat_record = Underlying_Type (Scope (gnat_entity));
- /* If the variable is an inherited record component (in the case of
- extended record types), just return the inherited entity, which
- must be a FIELD_DECL. Likewise for discriminants.
- For discriminants of untagged records which have explicit
- stored discriminants, return the entity for the corresponding
- stored discriminant. Also use Original_Record_Component
- if the record has a private extension. */
+ /* If the entity is an inherited component (in the case of extended
+ tagged record types), just return the original entity, which must
+ be a FIELD_DECL. Likewise for discriminants. If the entity is a
+ non-girder discriminant (in the case of derived untagged record
+ types), return the stored discriminant it renames. */
if (Present (Original_Record_Component (gnat_entity))
&& Original_Record_Component (gnat_entity) != gnat_entity)
{
@@ -514,18 +512,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
break;
}
- /* If the enclosing record has explicit stored discriminants,
- then it is an untagged record. If the Corresponding_Discriminant
- is not empty then this must be a renamed discriminant and its
- Original_Record_Component must point to the corresponding explicit
- stored discriminant (i.e. we should have taken the previous
- branch). */
- else if (Present (Corresponding_Discriminant (gnat_entity))
- && Is_Tagged_Type (gnat_record))
+ /* If this is a discriminant of an extended tagged type used to rename
+ a discriminant of the parent type, return the latter. */
+ else if (Present (Corresponding_Discriminant (gnat_entity)))
{
- /* A tagged record has no explicit stored discriminants. */
- gcc_assert (First_Discriminant (gnat_record)
- == First_Stored_Discriminant (gnat_record));
+ /* If the derived type is untagged, then this is a non-girder
+ discriminant and its Original_Record_Component must point to
+ the stored discriminant it renames (i.e. we should have taken
+ the previous branch). */
+ gcc_assert (Is_Tagged_Type (gnat_record));
+
gnu_decl
= gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity),
gnu_expr, definition);
@@ -533,26 +529,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
break;
}
- else if (Present (CR_Discriminant (gnat_entity))
- && type_annotate_only)
- {
- gnu_decl = gnat_to_gnu_entity (CR_Discriminant (gnat_entity),
- gnu_expr, definition);
- saved = true;
- break;
- }
-
- /* If the enclosing record has explicit stored discriminants, then
- it is an untagged record. If the Corresponding_Discriminant
- is not empty then this must be a renamed discriminant and its
- Original_Record_Component must point to the corresponding explicit
- stored discriminant (i.e. we should have taken the first
- branch). */
- else if (Present (Corresponding_Discriminant (gnat_entity))
- && (First_Discriminant (gnat_record)
- != First_Stored_Discriminant (gnat_record)))
- gcc_unreachable ();
-
/* Otherwise, if we are not defining this and we have no GCC type
for the containing record, make one for it. Then we should
have made our own equivalent. */
@@ -586,7 +562,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
else
/* Here we have no GCC type and this is a reference rather than a
definition. This should never happen. Most likely the cause is
- reference before declaration in the gnat tree for gnat_entity. */
+ reference before declaration in the GNAT tree for gnat_entity. */
gcc_unreachable ();
}