]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (gnat_to_gnu_entity): Remove obsolete code for type_annotate_only mode...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 20 Jan 2014 10:29:09 +0000 (10:29 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 20 Jan 2014 10:29:09 +0000 (10:29 +0000)
* 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

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index a0570a59da9de10aef4ad1acbdcb8e87d7a7fa4d..357f1c4be97381afb28da5b0662f9e9d11002160 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * 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.
+
 2014-01-12  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/59772
index ad129c6803c19f129efbbefbd18eadc00609e8d8..9e1ecb0a23746b09ef4ee79b897f8f7e6af5bbf0 100644 (file)
@@ -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 ();
       }