OSDN Git Service

2008-03-26 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Mar 2008 07:37:12 +0000 (07:37 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Mar 2008 07:37:12 +0000 (07:37 +0000)
* stand.ads: Deal with reordering of package standard declarations

* cstand.adb: Put package Standard declarations in proper order

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133554 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/cstand.adb
gcc/ada/stand.ads

index 5d16e53..7a036cd 100644 (file)
@@ -379,13 +379,26 @@ package body CStand is
       Set_Is_Pure (Standard_Standard);
       Set_Is_Compilation_Unit (Standard_Standard);
 
-      --  Create type declaration nodes for standard types
+      --  Create type/subtype declaration nodes for standard types
 
       for S in S_Types loop
-         Decl := New_Node (N_Full_Type_Declaration, Stloc);
-         Set_Defining_Identifier (Decl, Standard_Entity (S));
+
+         --  Subtype declaration case
+
+         if S = S_Natural or else S = S_Positive then
+            Decl := New_Node (N_Subtype_Declaration, Stloc);
+            Set_Subtype_Indication (Decl,
+              New_Occurrence_Of (Standard_Integer, Stloc));
+
+         --  Full type declaration case
+
+         else
+            Decl := New_Node (N_Full_Type_Declaration, Stloc);
+         end if;
+
          Set_Is_Frozen (Standard_Entity (S));
          Set_Is_Public (Standard_Entity (S));
+         Set_Defining_Identifier (Decl, Standard_Entity (S));
          Append (Decl, Decl_S);
       end loop;
 
@@ -768,13 +781,7 @@ package body CStand is
       Set_Entity (E_Id, Standard_Positive);
       Set_Etype (E_Id, Standard_Positive);
 
-      --  Create subtype declaration for Natural
-
-      Decl := New_Node (N_Subtype_Declaration, Stloc);
-      Set_Defining_Identifier (Decl, Standard_Natural);
-      Set_Subtype_Indication (Decl,
-        New_Occurrence_Of (Standard_Integer, Stloc));
-      Append (Decl, Decl_S);
+      --  Setup entity for Naturalend Create_Standard;
 
       Set_Ekind          (Standard_Natural, E_Signed_Integer_Subtype);
       Set_Etype          (Standard_Natural, Base_Type (Standard_Integer));
@@ -788,16 +795,8 @@ package body CStand is
         Lb  => Uint_0,
         Hb  => Intval (High_Bound (Scalar_Range (Standard_Integer))));
       Set_Is_Constrained (Standard_Natural);
-      Set_Is_Frozen      (Standard_Natural);
-      Set_Is_Public      (Standard_Natural);
-
-      --  Create subtype declaration for Positive
 
-      Decl := New_Node (N_Subtype_Declaration, Stloc);
-      Set_Defining_Identifier (Decl, Standard_Positive);
-      Set_Subtype_Indication (Decl,
-        New_Occurrence_Of (Standard_Integer, Stloc));
-      Append (Decl, Decl_S);
+      --  Setup entity for Positive
 
       Set_Ekind          (Standard_Positive, E_Signed_Integer_Subtype);
       Set_Etype          (Standard_Positive, Base_Type (Standard_Integer));
@@ -812,8 +811,6 @@ package body CStand is
          Lb  => Uint_1,
          Hb  => Intval (High_Bound (Scalar_Range (Standard_Integer))));
       Set_Is_Constrained   (Standard_Positive);
-      Set_Is_Frozen        (Standard_Positive);
-      Set_Is_Public        (Standard_Positive);
 
       --  Create declaration for package ASCII
 
index 32b769f..964ff19 100644 (file)
@@ -54,16 +54,11 @@ package Stand is
       S_Standard,
       S_ASCII,
 
-      --  Types defined in package Standard
+      --  Types and subtypes defined in package Standard (in the order in which
+      --  they appear in the RM, so that the declarations are in the right
+      --  order for the purposes of ASIS traversals
 
       S_Boolean,
-      S_Character,
-      S_Wide_Character,
-      S_Wide_Wide_Character,
-      S_String,
-      S_Wide_String,
-      S_Wide_Wide_String,
-      S_Duration,
 
       S_Short_Short_Integer,
       S_Short_Integer,
@@ -71,21 +66,29 @@ package Stand is
       S_Long_Integer,
       S_Long_Long_Integer,
 
+      S_Natural,
+      S_Positive,
+
       S_Short_Float,
       S_Float,
       S_Long_Float,
       S_Long_Long_Float,
 
+      S_Character,
+      S_Wide_Character,
+      S_Wide_Wide_Character,
+
+      S_String,
+      S_Wide_String,
+      S_Wide_Wide_String,
+
+      S_Duration,
+
       --  Enumeration literals for type Boolean
 
       S_False,
       S_True,
 
-      --  Subtypes declared in package Standard
-
-      S_Natural,
-      S_Positive,
-
       --  Exceptions declared in package Standard
 
       S_Constraint_Error,
@@ -218,7 +221,7 @@ package Stand is
       S_DEL);           -- 16#7F#
 
    subtype S_Types is
-     Standard_Entity_Type range S_Boolean .. S_Long_Long_Float;
+     Standard_Entity_Type range S_Boolean .. S_Duration;
 
    subtype S_Exceptions is
      Standard_Entity_Type range S_Constraint_Error .. S_Tasking_Error;