procedure Analyze_Aspect_Static;
-- Ada 202x (AI12-0075): Perform analysis of aspect Static
- procedure Make_Aitem_Pragma
+ function Make_Aitem_Pragma
(Pragma_Argument_Associations : List_Id;
- Pragma_Name : Name_Id);
+ Pragma_Name : Name_Id) return Node_Id;
-- This is a wrapper for Make_Pragma used for converting aspects
-- to pragmas. It takes care of Sloc (set from Loc) and building
-- the pragma identifier from the given name. In addition the
-- Generate:
-- pragma Convention (<Conv>, <E>);
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Name => Name_Convention,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
-- Make_Aitem_Pragma --
-----------------------
- procedure Make_Aitem_Pragma
+ function Make_Aitem_Pragma
(Pragma_Argument_Associations : List_Id;
- Pragma_Name : Name_Id)
+ Pragma_Name : Name_Id) return Node_Id
is
- Args : List_Id := Pragma_Argument_Associations;
-
+ Args : List_Id := Pragma_Argument_Associations;
+ Aitem : Node_Id;
begin
-- We should never get here if aspect was disabled
Set_Corresponding_Aspect (Aitem, Aspect);
Set_From_Aspect_Specification (Aitem);
+
+ return Aitem;
end Make_Aitem_Pragma;
-- Start of processing for Analyze_One_Aspect
-- referring to the entity, and the second argument is the
-- aspect definition expression.
- -- Linker_Section/Suppress/Unsuppress
+ -- Linker_Section
- when Aspect_Linker_Section
- | Aspect_Suppress
- | Aspect_Unsuppress
- =>
- Make_Aitem_Pragma
+ when Aspect_Linker_Section =>
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc)),
-- code. (This is already done for types with implicit
-- initialization, such as protected types.)
- if A_Id = Aspect_Linker_Section
- and then Nkind (N) = N_Object_Declaration
+ if Nkind (N) = N_Object_Declaration
and then Has_Init_Expression (N)
then
Delay_Required := False;
-- Corresponds to pragma Implemented, construct the pragma
when Aspect_Synchronization =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc)),
-- Attach_Handler
when Aspect_Attach_Handler =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
-- flags recording whether it is static/dynamic). We also
-- set flags recording this in the type itself.
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
-- Construct the pragma
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
Expression => Relocate_Node (Expr));
end if;
+ -- Suppress/Unsuppress
+
+ when Aspect_Suppress
+ | Aspect_Unsuppress
+ =>
+ Aitem := Make_Aitem_Pragma
+ (Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Relocate_Node (Expr)),
+ Make_Pragma_Argument_Association (Sloc (Expr),
+ Expression => New_Occurrence_Of (E, Loc))),
+ Pragma_Name => Chars (Id));
+
+ Delay_Required := False;
+
-- Warnings
when Aspect_Warnings =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr)),
-- an invariant must apply to a private type, or appear in
-- the private part of a spec and apply to a completion.
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
if Nkind (Context) in N_Generic_Package_Declaration
| N_Package_Declaration
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related object declaration.
when Aspect_Async_Readers =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related object declaration.
when Aspect_Async_Writers =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related object declaration.
when Aspect_Constant_After_Elaboration =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- private type's full view.
when Aspect_Default_Initial_Condition =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Default_Storage_Pool
when Aspect_Default_Storage_Pool =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Analyze_Depends_In_Decl_Part for details.
when Aspect_Depends =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related object declaration.
when Aspect_Effective_Reads =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related object declaration.
when Aspect_Effective_Writes =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related subprogram.
when Aspect_Extensions_Visible =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- a type declaration.
when Aspect_Ghost =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Analyze_Global_In_Decl_Part for details.
when Aspect_Global =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
if Nkind (Context) in N_Generic_Package_Declaration
| N_Package_Declaration
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
if Nkind (Context) in N_Generic_Package_Declaration
| N_Package_Declaration
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Max_Entry_Queue_Depth
when Aspect_Max_Entry_Queue_Depth =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Max_Entry_Queue_Length
when Aspect_Max_Entry_Queue_Length =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Max_Queue_Length
when Aspect_Max_Queue_Length =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- declaration.
when Aspect_No_Caching =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Expression => Relocate_Node (Expr)));
end if;
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Chars (Id));
end;
| N_Package_Instantiation
or else Is_Single_Concurrent_Type_Declaration (N)
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- SPARK_Mode
when Aspect_SPARK_Mode =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- routine Analyze_Refined_Depends_In_Decl_Part.
when Aspect_Refined_Depends =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- routine Analyze_Refined_Global_In_Decl_Part.
when Aspect_Refined_Global =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Refined_Post
when Aspect_Refined_Post =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- the pragma.
if Nkind (N) = N_Package_Body then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Relative_Deadline
when Aspect_Relative_Deadline =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- attribute does not have visibility on the discriminant.
when Aspect_Secondary_Stack_Size =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- related subprogram.
when Aspect_Volatile_Function =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Chars => Name_Entity,
Expression => Ent));
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => Pargs,
Pragma_Name => Name_Annotate);
end;
New_Expr := Relocate_Node (Expr);
end if;
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Check,
-- Build the test-case pragma
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Nam);
end Test_Case;
-- Contract_Cases
when Aspect_Contract_Cases =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
-- Subprogram_Variant
when Aspect_Subprogram_Variant =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
if A_Id /= Aspect_Export
and then A_Id /= Aspect_Import
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
-- Create a pragma and put it at the start of the task
-- definition for the task type declaration.
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
if Is_Boolean_Aspect (Aspect) and then No (Aitem) then
if Is_True (Static_Boolean (Expr)) then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
| Aspect_Output
| Aspect_Put_Image
| Aspect_Read
- | Aspect_Suppress
- | Aspect_Unsuppress
| Aspect_Warnings
| Aspect_Write
=>
| Aspect_Relaxed_Initialization
| Aspect_SPARK_Mode
| Aspect_Subprogram_Variant
+ | Aspect_Suppress
| Aspect_Test_Case
| Aspect_Unimplemented
+ | Aspect_Unsuppress
| Aspect_Volatile_Function
=>
raise Program_Error;