procedure Decorate (Asp : Node_Id; Prag : Node_Id);
-- Establish linkages between an aspect and its corresponding pragma
- procedure Insert_Pragma
- (Prag : in out Node_Id;
+ procedure Insert_Aitem
+ (Aitem : in out Node_Id;
Is_Instance : Boolean := False);
- -- Prag is a pragma or attribute definition clause generated from an
+ -- Aitem is a pragma or attribute definition clause generated from an
-- aspect specification. Insert it in the appropriate place.
-- Is_Instance indicates that the context denotes a generic instance.
- -- ????We will rename this to be Insert_Aitem, because it now
- -- works for N_Attribute_Definition_Clause. And rename the formal.
+ -- When done, this sets Aitem to Empty.
function Relocate_Expression (Source : Node_Id) return Node_Id;
-- Outside of a generic this function is equivalent to Relocate_Node.
Set_Parent (Prag, Asp);
end Decorate;
- -------------------
- -- Insert_Pragma --
- -------------------
+ ------------------
+ -- Insert_Aitem --
+ ------------------
Ins_Node : Node_Id := N;
-- Used to (sometimes) preserve order of pragmas relative to the aspects
-- whence they came.
- procedure Insert_Pragma
- (Prag : in out Node_Id;
+ procedure Insert_Aitem
+ (Aitem : in out Node_Id;
Is_Instance : Boolean := False)
is
pragma Assert
- (Nkind (Prag) in N_Pragma | N_Attribute_Definition_Clause);
+ (Nkind (Aitem) in N_Pragma | N_Attribute_Definition_Clause);
Decl : Node_Id;
Def : Node_Id;
- Decls : List_Id; -- List on which to prepend Prag, if any
+ Decls : List_Id; -- List on which to prepend Aitem, if any
begin
-- ???Preelaborate in a package body is illegal, but older compilers
-- Same for Pure.
if Nkind (N) in N_Package_Body
- and then Nkind (Prag) = N_Pragma
- and then Get_Pragma_Id (Prag) in Pragma_Preelaborate | Pragma_Pure
+ and then Nkind (Aitem) = N_Pragma
+ and then Get_Pragma_Id (Aitem) in Pragma_Preelaborate | Pragma_Pure
then
goto After;
end if;
- -- In some cases, Prag must be inserted INSIDE N, for example at the
+ -- In some cases, Aitem must be inserted INSIDE N, for example at the
-- beginning of the visible part of a package or protected type. In
- -- other cases, Prag goes AFTER N. The following inserts Prag at the
- -- appropriate place INSIDE N and jumps to <<Done>>, or else jumps to
- -- <<After>>, where we insert Prag AFTER N.
+ -- other cases, Aitem goes AFTER N. The following inserts Aitem at
+ -- the appropriate place INSIDE N and jumps to <<Done>>, or else
+ -- jumps to <<After>>, where we insert Aitem AFTER N.
- case Nkind (Prag) is
+ case Nkind (Aitem) is
when N_Attribute_Definition_Clause =>
goto After;
when N_Pragma =>
- if Get_Pragma_Id (Prag) in Pragma_First_Controlling_Parameter
+ if Get_Pragma_Id (Aitem) in Pragma_First_Controlling_Parameter
| Pragma_Invariant | Pragma_Volatile
then
goto After;
Decl := First (Decls);
while Present (Decl) loop
if Comes_From_Source (Decl) then
- Insert_Before (Decl, Prag);
+ Insert_Before (Decl, Aitem);
goto Done;
end if;
Next (Decl);
end loop;
- Append_To (Decls, Prag); -- no source decls found
+ Append_To (Decls, Aitem); -- no source decls found
goto Done;
end if;
when others => goto After;
end case;
- Prepend_To (Decls, Prag);
+ Prepend_To (Decls, Aitem);
goto Done;
<<After>>
- -- Here we insert Prag AFTER N. For a compilation unit, that means in
- -- the Pragmas_After field. For anything else, after N in some list.
+ -- Here we insert Aitem AFTER N. For a compilation unit, that means
+ -- in the Pragmas_After field. For anything else, after N in some
+ -- list.
if Nkind (Parent (N)) = N_Compilation_Unit then
if No (Pragmas_After (Aux_Decls_Node (Parent (N)))) then
Set_Pragmas_After (Aux_Decls_Node (Parent (N)), New_List);
end if;
- Prepend_To (Pragmas_After (Aux_Decls_Node (Parent (N))), Prag);
+ Prepend_To (Pragmas_After (Aux_Decls_Node (Parent (N))), Aitem);
-- ???Should this be Append_To?
else
- Insert_After (Ins_Node, Prag);
+ Insert_After (Ins_Node, Aitem);
-- The order shouldn't matter, but for Annotate, some tests fail
-- in minor ways if we don't use Ins_Node to make the order of
-- pragmas match the order of aspects. For some other aspects,
-- such as Pre, some tests fail if we DO use Ins_Node.
-- ???Consider getting rid of Ins_Node, and just doing
- -- "Insert_After (N, Prag);" above. Or consider always
+ -- "Insert_After (N, Aitem);" above. Or consider always
-- updating Ins_Node below.
- if Nkind (Prag) = N_Pragma
- and then Get_Pragma_Id (Prag) = Pragma_Annotate
+ if Nkind (Aitem) = N_Pragma
+ and then Get_Pragma_Id (Aitem) = Pragma_Annotate
then
- Ins_Node := Prag;
+ Ins_Node := Aitem;
end if;
end if;
<<Done>>
- Prag := Empty;
- end Insert_Pragma;
+ Aitem := Empty;
+ end Insert_Aitem;
-------------------------
-- Relocate_Expression --
Expression => Ent)));
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
end if;
end Analyze_Aspect_Convention;
-- We need to insert this pragma into the tree to get proper
-- processing and to look valid from a placement viewpoint.
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Dynamic_Predicate, Predicate, Static_Predicate
Pragma_Name => Name_Warnings);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Case 2c: Aspects corresponding to pragmas with three
Pragma_Name => Name_Abstract_State);
Decorate (Aspect, Aitem);
- Insert_Pragma
- (Prag => Aitem,
+ Insert_Aitem
+ (Aitem,
Is_Instance =>
Is_Generic_Instance (Defining_Entity (Context)));
Name_Default_Initial_Condition);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Default_Storage_Pool
Name_Default_Storage_Pool);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Depends
Pragma_Name => Name_Depends);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Global
Pragma_Name => Name_Global);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Initial_Condition
Name_Initial_Condition);
Decorate (Aspect, Aitem);
- Insert_Pragma
- (Prag => Aitem,
+ Insert_Aitem
+ (Aitem,
Is_Instance =>
Is_Generic_Instance (Defining_Entity (Context)));
Pragma_Name => Name_Initializes);
Decorate (Aspect, Aitem);
- Insert_Pragma
- (Prag => Aitem,
+ Insert_Aitem
+ (Aitem,
Is_Instance =>
Is_Generic_Instance (Defining_Entity (Context)));
Pragma_Name => Name_Max_Entry_Queue_Length);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Max_Queue_Length
Pragma_Name => Name_Max_Queue_Length);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Obsolescent
Pragma_Name => Name_Part_Of);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
else
Error_Msg_NE
Pragma_Name => Name_SPARK_Mode);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Refined_Depends
Pragma_Name => Name_Refined_Depends);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Refined_Global
Pragma_Name => Name_Refined_Global);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Refined_Post
Pragma_Name => Name_Refined_Post);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Refined_State
Pragma_Name => Name_Refined_State);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
-- Otherwise the context is illegal
Name_Secondary_Stack_Size);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- User_Aspect
-- about delay issues, since the pragmas themselves deal
-- with delay of visibility for the expression analysis.
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
end Pre_Post;
Pragma_Name => Name_Contract_Cases);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Exceptional_Cases
Pragma_Name => Name_Exceptional_Cases);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Exit_Cases
Pragma_Name => Name_Exit_Cases);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Program_Exit
Pragma_Name => Name_Program_Exit);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Subprogram_Variant
Pragma_Name => Name_Subprogram_Variant);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
-- Case 5: Special handling for aspects with an optional
Expression => Relocate_Node (Expr))),
Pragma_Name => Nam);
Decorate (Aspect, Aitem);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
end if;
(Make_Pragma_Argument_Association
(Loc, Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Storage_Size);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
end if;
if Nkind (Parent (N)) = N_Compilation_Unit and then Present (Aitem)
then
pragma Assert (Nkind (Aitem) in N_Pragma);
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
end if;
Aitem := Empty;
elsif Present (Aitem) then
- Insert_Pragma (Aitem);
+ Insert_Aitem (Aitem);
goto Continue;
end if;