[Ada] Minor reuse Is_Protected_Component
[gcc.git] / gcc / ada / aspects.ads
index 1c7d3c49871efa4bddbc7d8e7537ca56754ce71e..e16ceb006eee9e50319d9e9dd85092247c54d9a2 100644 (file)
 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
---                                                                          --
--- As a special exception under Section 7 of GPL version 3, you are granted --
--- additional permissions described in the GCC Runtime Library Exception,   --
--- version 3.1, as published by the Free Software Foundation.               --
---                                                                          --
--- You should have received a copy of the GNU General Public License and    --
--- a copy of the GCC Runtime Library Exception along with this program;     --
--- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
--- <http://www.gnu.org/licenses/>.                                          --
+-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
+-- for  more details.  You should have  received  a copy of the GNU General --
+-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license.          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -76,6 +70,7 @@ package Aspects is
      (No_Aspect,                            -- Dummy entry for no aspect
       Aspect_Abstract_State,                -- GNAT
       Aspect_Address,
+      Aspect_Aggregate,
       Aspect_Alignment,
       Aspect_Annotate,                      -- GNAT
       Aspect_Async_Readers,                 -- GNAT
@@ -109,6 +104,7 @@ package Aspects is
       Aspect_Initial_Condition,             -- GNAT
       Aspect_Initializes,                   -- GNAT
       Aspect_Input,
+      Aspect_Integer_Literal,
       Aspect_Interrupt_Priority,
       Aspect_Invariant,                     -- GNAT
       Aspect_Iterator_Element,
@@ -133,6 +129,7 @@ package Aspects is
       Aspect_Priority,
       Aspect_Put_Image,
       Aspect_Read,
+      Aspect_Real_Literal,
       Aspect_Refined_Depends,               -- GNAT
       Aspect_Refined_Global,                -- GNAT
       Aspect_Refined_Post,                  -- GNAT
@@ -145,10 +142,13 @@ package Aspects is
       Aspect_Size,
       Aspect_Small,
       Aspect_SPARK_Mode,                    -- GNAT
+      Aspect_Stable_Properties,
       Aspect_Static_Predicate,
       Aspect_Storage_Pool,
       Aspect_Storage_Size,
       Aspect_Stream_Size,
+      Aspect_String_Literal,
+      Aspect_Subprogram_Variant,            -- GNAT
       Aspect_Suppress,
       Aspect_Synchronization,
       Aspect_Test_Case,                     -- GNAT
@@ -185,8 +185,11 @@ package Aspects is
       Aspect_Atomic_Components,
       Aspect_Disable_Controlled,            -- GNAT
       Aspect_Discard_Names,
+      Aspect_CUDA_Global,                   -- GNAT
+      Aspect_Exclusive_Functions,
       Aspect_Export,
       Aspect_Favor_Top_Level,               -- GNAT
+      Aspect_Full_Access_Only,
       Aspect_Independent,
       Aspect_Independent_Components,
       Aspect_Import,
@@ -204,6 +207,7 @@ package Aspects is
       Aspect_Remote_Access_Type,            -- GNAT
       Aspect_Shared,                        -- GNAT (equivalent to Atomic)
       Aspect_Simple_Storage_Pool_Type,      -- GNAT
+      Aspect_Static,
       Aspect_Suppress_Debug_Info,           -- GNAT
       Aspect_Suppress_Initialization,       -- GNAT
       Aspect_Thread_Local_Storage,          -- GNAT
@@ -214,25 +218,37 @@ package Aspects is
       Aspect_Unreferenced_Objects,          -- GNAT
       Aspect_Volatile,
       Aspect_Volatile_Components,
-      Aspect_Volatile_Full_Access);         -- GNAT
+      Aspect_Volatile_Full_Access,          -- GNAT
+      Aspect_Yield);
 
    subtype Aspect_Id_Exclude_No_Aspect is
      Aspect_Id range Aspect_Id'Succ (No_Aspect) .. Aspect_Id'Last;
    --  Aspect_Id's excluding No_Aspect
 
+   subtype Nonoverridable_Aspect_Id is Aspect_Id with
+     Static_Predicate => Nonoverridable_Aspect_Id in
+       Aspect_Default_Iterator | Aspect_Iterator_Element |
+       Aspect_Implicit_Dereference | Aspect_Constant_Indexing |
+       Aspect_Variable_Indexing | Aspect_Aggregate |
+       Aspect_Max_Entry_Queue_Length
+       --  | Aspect_No_Controlled_Parts
+       --  ??? No_Controlled_Parts not yet in Aspect_Id enumeration
+       ;  --  see RM 13.1.1(18.7)
+
    --  The following array indicates aspects that accept 'Class
 
    Class_Aspect_OK : constant array (Aspect_Id) of Boolean :=
-     (Aspect_Input          => True,
-      Aspect_Invariant      => True,
-      Aspect_Output         => True,
-      Aspect_Pre            => True,
-      Aspect_Predicate      => True,
-      Aspect_Post           => True,
-      Aspect_Read           => True,
-      Aspect_Write          => True,
-      Aspect_Type_Invariant => True,
-      others                => False);
+     (Aspect_Input             => True,
+      Aspect_Invariant         => True,
+      Aspect_Output            => True,
+      Aspect_Pre               => True,
+      Aspect_Predicate         => True,
+      Aspect_Post              => True,
+      Aspect_Read              => True,
+      Aspect_Write             => True,
+      Aspect_Stable_Properties => True,
+      Aspect_Type_Invariant    => True,
+      others                   => False);
 
    --  The following array identifies all implementation defined aspects
 
@@ -295,6 +311,7 @@ package Aspects is
       Aspect_Iterator_Element           => True,
       Aspect_Iterable                   => True,
       Aspect_Variable_Indexing          => True,
+      Aspect_Aggregate                  => True,
       others                            => False);
 
    --  The following array indicates aspects for which multiple occurrences of
@@ -340,6 +357,7 @@ package Aspects is
      (No_Aspect                         => Optional_Expression,
       Aspect_Abstract_State             => Expression,
       Aspect_Address                    => Expression,
+      Aspect_Aggregate                  => Expression,
       Aspect_Alignment                  => Expression,
       Aspect_Annotate                   => Expression,
       Aspect_Async_Readers              => Optional_Expression,
@@ -373,6 +391,7 @@ package Aspects is
       Aspect_Initial_Condition          => Expression,
       Aspect_Initializes                => Expression,
       Aspect_Input                      => Name,
+      Aspect_Integer_Literal            => Name,
       Aspect_Interrupt_Priority         => Expression,
       Aspect_Invariant                  => Expression,
       Aspect_Iterable                   => Expression,
@@ -397,6 +416,7 @@ package Aspects is
       Aspect_Priority                   => Expression,
       Aspect_Put_Image                  => Name,
       Aspect_Read                       => Name,
+      Aspect_Real_Literal               => Name,
       Aspect_Refined_Depends            => Expression,
       Aspect_Refined_Global             => Expression,
       Aspect_Refined_Post               => Expression,
@@ -409,10 +429,13 @@ package Aspects is
       Aspect_Size                       => Expression,
       Aspect_Small                      => Expression,
       Aspect_SPARK_Mode                 => Optional_Name,
+      Aspect_Stable_Properties          => Expression,
       Aspect_Static_Predicate           => Expression,
       Aspect_Storage_Pool               => Name,
       Aspect_Storage_Size               => Expression,
       Aspect_Stream_Size                => Expression,
+      Aspect_String_Literal             => Name,
+      Aspect_Subprogram_Variant         => Expression,
       Aspect_Suppress                   => Name,
       Aspect_Synchronization            => Name,
       Aspect_Test_Case                  => Expression,
@@ -434,6 +457,7 @@ package Aspects is
      (No_Aspect                           => False,
       Aspect_Abstract_State               => False,
       Aspect_Address                      => True,
+      Aspect_Aggregate                    => False,
       Aspect_Alignment                    => True,
       Aspect_Annotate                     => False,
       Aspect_Async_Readers                => False,
@@ -446,7 +470,8 @@ package Aspects is
       Aspect_Contract_Cases               => False,
       Aspect_Convention                   => True,
       Aspect_CPU                          => False,
-      Aspect_Default_Component_Value      => False,
+      Aspect_CUDA_Global                  => False,
+      Aspect_Default_Component_Value      => True,
       Aspect_Default_Initial_Condition    => False,
       Aspect_Default_Iterator             => False,
       Aspect_Default_Storage_Pool         => True,
@@ -458,6 +483,7 @@ package Aspects is
       Aspect_Dynamic_Predicate            => False,
       Aspect_Effective_Reads              => False,
       Aspect_Effective_Writes             => False,
+      Aspect_Exclusive_Functions          => False,
       Aspect_Extensions_Visible           => False,
       Aspect_External_Name                => False,
       Aspect_External_Tag                 => False,
@@ -467,6 +493,7 @@ package Aspects is
       Aspect_Initial_Condition            => False,
       Aspect_Initializes                  => False,
       Aspect_Input                        => False,
+      Aspect_Integer_Literal              => False,
       Aspect_Interrupt_Priority           => False,
       Aspect_Invariant                    => False,
       Aspect_Iterable                     => False,
@@ -491,6 +518,7 @@ package Aspects is
       Aspect_Priority                     => False,
       Aspect_Put_Image                    => False,
       Aspect_Read                         => False,
+      Aspect_Real_Literal                 => False,
       Aspect_Refined_Depends              => False,
       Aspect_Refined_Global               => False,
       Aspect_Refined_Post                 => False,
@@ -503,10 +531,13 @@ package Aspects is
       Aspect_Size                         => True,
       Aspect_Small                        => True,
       Aspect_SPARK_Mode                   => False,
+      Aspect_Stable_Properties            => False,
       Aspect_Static_Predicate             => False,
       Aspect_Storage_Pool                 => True,
       Aspect_Storage_Size                 => True,
       Aspect_Stream_Size                  => True,
+      Aspect_String_Literal               => False,
+      Aspect_Subprogram_Variant           => False,
       Aspect_Suppress                     => False,
       Aspect_Synchronization              => False,
       Aspect_Test_Case                    => False,
@@ -528,6 +559,7 @@ package Aspects is
       Aspect_Discard_Names                => True,
       Aspect_Export                       => True,
       Aspect_Favor_Top_Level              => False,
+      Aspect_Full_Access_Only             => True,
       Aspect_Independent                  => True,
       Aspect_Independent_Components       => True,
       Aspect_Import                       => True,
@@ -545,6 +577,7 @@ package Aspects is
       Aspect_Remote_Access_Type           => False,
       Aspect_Shared                       => True,
       Aspect_Simple_Storage_Pool_Type     => True,
+      Aspect_Static                       => False,
       Aspect_Suppress_Debug_Info          => False,
       Aspect_Suppress_Initialization      => False,
       Aspect_Thread_Local_Storage         => True,
@@ -555,7 +588,8 @@ package Aspects is
       Aspect_Unreferenced_Objects         => False,
       Aspect_Volatile                     => True,
       Aspect_Volatile_Components          => True,
-      Aspect_Volatile_Full_Access         => True);
+      Aspect_Volatile_Full_Access         => True,
+      Aspect_Yield                        => False);
 
    -----------------------------------------
    -- Table Linking Names and Aspect_Id's --
@@ -567,6 +601,7 @@ package Aspects is
      (No_Aspect                           => No_Name,
       Aspect_Abstract_State               => Name_Abstract_State,
       Aspect_Address                      => Name_Address,
+      Aspect_Aggregate                    => Name_Aggregate,
       Aspect_Alignment                    => Name_Alignment,
       Aspect_All_Calls_Remote             => Name_All_Calls_Remote,
       Aspect_Annotate                     => Name_Annotate,
@@ -583,6 +618,7 @@ package Aspects is
       Aspect_Contract_Cases               => Name_Contract_Cases,
       Aspect_Convention                   => Name_Convention,
       Aspect_CPU                          => Name_CPU,
+      Aspect_CUDA_Global                  => Name_CUDA_Global,
       Aspect_Default_Component_Value      => Name_Default_Component_Value,
       Aspect_Default_Initial_Condition    => Name_Default_Initial_Condition,
       Aspect_Default_Iterator             => Name_Default_Iterator,
@@ -598,11 +634,13 @@ package Aspects is
       Aspect_Effective_Reads              => Name_Effective_Reads,
       Aspect_Effective_Writes             => Name_Effective_Writes,
       Aspect_Elaborate_Body               => Name_Elaborate_Body,
+      Aspect_Exclusive_Functions          => Name_Exclusive_Functions,
       Aspect_Export                       => Name_Export,
       Aspect_Extensions_Visible           => Name_Extensions_Visible,
       Aspect_External_Name                => Name_External_Name,
       Aspect_External_Tag                 => Name_External_Tag,
       Aspect_Favor_Top_Level              => Name_Favor_Top_Level,
+      Aspect_Full_Access_Only             => Name_Full_Access_Only,
       Aspect_Ghost                        => Name_Ghost,
       Aspect_Global                       => Name_Global,
       Aspect_Implicit_Dereference         => Name_Implicit_Dereference,
@@ -614,6 +652,7 @@ package Aspects is
       Aspect_Initial_Condition            => Name_Initial_Condition,
       Aspect_Initializes                  => Name_Initializes,
       Aspect_Input                        => Name_Input,
+      Aspect_Integer_Literal              => Name_Integer_Literal,
       Aspect_Interrupt_Handler            => Name_Interrupt_Handler,
       Aspect_Interrupt_Priority           => Name_Interrupt_Priority,
       Aspect_Invariant                    => Name_Invariant,
@@ -650,6 +689,7 @@ package Aspects is
       Aspect_Pure_Function                => Name_Pure_Function,
       Aspect_Put_Image                    => Name_Put_Image,
       Aspect_Read                         => Name_Read,
+      Aspect_Real_Literal                 => Name_Real_Literal,
       Aspect_Refined_Depends              => Name_Refined_Depends,
       Aspect_Refined_Global               => Name_Refined_Global,
       Aspect_Refined_Post                 => Name_Refined_Post,
@@ -668,10 +708,14 @@ package Aspects is
       Aspect_Size                         => Name_Size,
       Aspect_Small                        => Name_Small,
       Aspect_SPARK_Mode                   => Name_SPARK_Mode,
+      Aspect_Stable_Properties            => Name_Stable_Properties,
+      Aspect_Static                       => Name_Static,
       Aspect_Static_Predicate             => Name_Static_Predicate,
       Aspect_Storage_Pool                 => Name_Storage_Pool,
       Aspect_Storage_Size                 => Name_Storage_Size,
       Aspect_Stream_Size                  => Name_Stream_Size,
+      Aspect_String_Literal               => Name_String_Literal,
+      Aspect_Subprogram_Variant           => Name_Subprogram_Variant,
       Aspect_Suppress                     => Name_Suppress,
       Aspect_Suppress_Debug_Info          => Name_Suppress_Debug_Info,
       Aspect_Suppress_Initialization      => Name_Suppress_Initialization,
@@ -694,7 +738,8 @@ package Aspects is
       Aspect_Volatile_Full_Access         => Name_Volatile_Full_Access,
       Aspect_Volatile_Function            => Name_Volatile_Function,
       Aspect_Warnings                     => Name_Warnings,
-      Aspect_Write                        => Name_Write);
+      Aspect_Write                        => Name_Write,
+      Aspect_Yield                        => Name_Yield);
 
    function Get_Aspect_Id (Name : Name_Id) return Aspect_Id;
    pragma Inline (Get_Aspect_Id);
@@ -810,11 +855,13 @@ package Aspects is
    Aspect_Delay : constant array (Aspect_Id) of Delay_Type :=
      (No_Aspect                           => Always_Delay,
       Aspect_Address                      => Always_Delay,
+      Aspect_Aggregate                    => Always_Delay,
       Aspect_All_Calls_Remote             => Always_Delay,
       Aspect_Asynchronous                 => Always_Delay,
       Aspect_Attach_Handler               => Always_Delay,
       Aspect_Constant_Indexing            => Always_Delay,
       Aspect_CPU                          => Always_Delay,
+      Aspect_CUDA_Global                  => Always_Delay,
       Aspect_Default_Iterator             => Always_Delay,
       Aspect_Default_Storage_Pool         => Always_Delay,
       Aspect_Default_Value                => Always_Delay,
@@ -823,6 +870,7 @@ package Aspects is
       Aspect_Dispatching_Domain           => Always_Delay,
       Aspect_Dynamic_Predicate            => Always_Delay,
       Aspect_Elaborate_Body               => Always_Delay,
+      Aspect_Exclusive_Functions          => Always_Delay,
       Aspect_External_Name                => Always_Delay,
       Aspect_External_Tag                 => Always_Delay,
       Aspect_Favor_Top_Level              => Always_Delay,
@@ -832,6 +880,7 @@ package Aspects is
       Aspect_Inline                       => Always_Delay,
       Aspect_Inline_Always                => Always_Delay,
       Aspect_Input                        => Always_Delay,
+      Aspect_Integer_Literal              => Always_Delay,
       Aspect_Interrupt_Handler            => Always_Delay,
       Aspect_Interrupt_Priority           => Always_Delay,
       Aspect_Invariant                    => Always_Delay,
@@ -857,6 +906,7 @@ package Aspects is
       Aspect_Pure_Function                => Always_Delay,
       Aspect_Put_Image                    => Always_Delay,
       Aspect_Read                         => Always_Delay,
+      Aspect_Real_Literal                 => Always_Delay,
       Aspect_Relative_Deadline            => Always_Delay,
       Aspect_Remote_Access_Type           => Always_Delay,
       Aspect_Remote_Call_Interface        => Always_Delay,
@@ -869,6 +919,7 @@ package Aspects is
       Aspect_Static_Predicate             => Always_Delay,
       Aspect_Storage_Pool                 => Always_Delay,
       Aspect_Stream_Size                  => Always_Delay,
+      Aspect_String_Literal               => Always_Delay,
       Aspect_Suppress                     => Always_Delay,
       Aspect_Suppress_Debug_Info          => Always_Delay,
       Aspect_Suppress_Initialization      => Always_Delay,
@@ -919,17 +970,22 @@ package Aspects is
       Aspect_Refined_State                => Never_Delay,
       Aspect_Relaxed_Initialization       => Never_Delay,
       Aspect_SPARK_Mode                   => Never_Delay,
+      Aspect_Stable_Properties            => Always_Delay,
+      Aspect_Static                       => Never_Delay,
+      Aspect_Subprogram_Variant           => Never_Delay,
       Aspect_Synchronization              => Never_Delay,
       Aspect_Test_Case                    => Never_Delay,
       Aspect_Unimplemented                => Never_Delay,
       Aspect_Volatile_Function            => Never_Delay,
       Aspect_Warnings                     => Never_Delay,
+      Aspect_Yield                        => Never_Delay,
 
       Aspect_Alignment                    => Rep_Aspect,
       Aspect_Atomic                       => Rep_Aspect,
       Aspect_Atomic_Components            => Rep_Aspect,
       Aspect_Bit_Order                    => Rep_Aspect,
       Aspect_Component_Size               => Rep_Aspect,
+      Aspect_Full_Access_Only             => Rep_Aspect,
       Aspect_Machine_Radix                => Rep_Aspect,
       Aspect_Object_Size                  => Rep_Aspect,
       Aspect_Pack                         => Rep_Aspect,
@@ -1044,18 +1100,24 @@ package Aspects is
    --  aspect specification list, the routine has no effect. It is assumed that
    --  both nodes can support aspects.
 
-   function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id;
-   --  Find the aspect specification of aspect A associated with entity I.
+   function Find_Aspect (Id            : Entity_Id;
+                         A             : Aspect_Id;
+                         Class_Present : Boolean := False) return Node_Id;
+   --  Find the aspect specification of aspect A (or A'Class if Class_Present)
+   --  associated with entity I.
    --  Return Empty if Id does not have the requested aspect.
 
    function Find_Value_Of_Aspect
-     (Id : Entity_Id;
-      A  : Aspect_Id) return Node_Id;
-   --  Find the value of aspect A associated with entity Id. Return Empty if
-   --  Id does not have the requested aspect.
-
-   function Has_Aspect (Id : Entity_Id; A : Aspect_Id) return Boolean;
-   --  Determine whether entity Id has aspect A
+     (Id            : Entity_Id;
+      A             : Aspect_Id;
+      Class_Present : Boolean := False) return Node_Id;
+   --  Find the value of aspect A (or A'Class, if Class_Present) associated
+   --  with entity Id. Return Empty if Id does not have the requested aspect.
+
+   function Has_Aspect (Id            : Entity_Id;
+                        A             : Aspect_Id;
+                        Class_Present : Boolean := False) return Boolean;
+   --  Determine whether entity Id has aspect A (or A'Class, if Class_Present)
 
    procedure Move_Aspects (From : Node_Id; To : Node_Id);
    --  Relocate the aspect specifications of node From to node To. On entry it