[Ada] Ada2020: AI12-0003 Specifying the standard storage pool
authorJavier Miranda <miranda@adacore.com>
Wed, 24 Jun 2020 19:05:14 +0000 (15:05 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 15 Oct 2020 09:39:13 +0000 (05:39 -0400)
gcc/ada/

* sem_prag.adb (Analyze_Pragma): Adding semantic support of
Standard to Default_Storage_Pool.
* freeze.adb (Freeze_Entity): If pragma Default_Storage_Pool
applies and it is set to Standard then use the global pool as
the associated storage pool of the access type.

gcc/ada/freeze.adb
gcc/ada/sem_prag.adb

index 5032724045096eb092394ee2dc7fad33cbb548ab..b3aa13156df97fb6c25e62e4cace6c2ca37702fc 100644 (file)
@@ -6387,7 +6387,7 @@ package body Freeze is
             end if;
 
          --  The pool applies to named and anonymous access types, but not
-         --  to subprogram and to  internal types generated for 'Access
+         --  to subprogram and to internal types generated for 'Access
          --  references.
 
          elsif Is_Access_Type (E)
@@ -6412,6 +6412,11 @@ package body Freeze is
                if Nkind (Default_Pool) = N_Null then
                   Set_No_Pool_Assigned (E);
 
+               --  Case of pragma Default_Storage_Pool (Standard)
+
+               elsif Entity (Default_Pool) = Standard_Standard then
+                  Set_Associated_Storage_Pool (E, RTE (RE_Global_Pool_Object));
+
                --  Case of pragma Default_Storage_Pool (storage_pool_NAME)
 
                else
index d10d00de38e39dfeaad3293d0cbc8abaedbde64b..b3fa7344dacfaf2af8529e91a77316833cb68989 100644 (file)
@@ -15314,7 +15314,7 @@ package body Sem_Prag is
          -- Default_Storage_Pool --
          --------------------------
 
-         --  pragma Default_Storage_Pool (storage_pool_NAME | null);
+         --  pragma Default_Storage_Pool (storage_pool_NAME | null | Standard);
 
          when Pragma_Default_Storage_Pool => Default_Storage_Pool : declare
             Pool : Node_Id;
@@ -15355,6 +15355,18 @@ package body Sem_Prag is
 
                   Set_Etype (Pool, Empty);
 
+               --  Case of Default_Storage_Pool (Standard);
+
+               elsif Nkind (Pool) = N_Identifier
+                 and then Chars (Pool) = Name_Standard
+               then
+                  Analyze (Pool);
+
+                  if Entity (Pool) /= Standard_Standard then
+                     Error_Pragma_Arg
+                       ("package Standard is not directly visible", Arg1);
+                  end if;
+
                --  Case of Default_Storage_Pool (storage_pool_NAME);
 
                else
@@ -15362,7 +15374,7 @@ package body Sem_Prag is
                   --  argument is "null".
 
                   if Is_Configuration_Pragma then
-                     Error_Pragma_Arg ("NULL expected", Arg1);
+                     Error_Pragma_Arg ("NULL or Standard expected", Arg1);
                   end if;
 
                   --  The expected type for a non-"null" argument is