+2012-12-05 Ed Schonberg <schonberg@adacore.com>
+
+ * aspects.ads, aspects.adb: Add aspect Relative_Deadline.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Process aspect
+ Relative_Deadline, and introduce the corresponding pragma within
+ the task definition of the task type to which it applies.
+ (Check_Aspect_At_Freeze_Point): Expression in a Relative_Deadline
+ aspect is of type Time_Span.
+
2012-12-05 Hristian Kirtchev <kirtchev@adacore.com>
* sem_prag.adb (Check_Loop_Invariant_Variant_Placement): When pragma
Aspect_Remote_Call_Interface => Aspect_Remote_Call_Interface,
Aspect_Remote_Types => Aspect_Remote_Types,
Aspect_Read => Aspect_Read,
+ Aspect_Relative_Deadline => Aspect_Relative_Deadline,
Aspect_Scalar_Storage_Order => Aspect_Scalar_Storage_Order,
Aspect_Shared => Aspect_Atomic,
Aspect_Shared_Passive => Aspect_Shared_Passive,
Aspect_Predicate, -- GNAT
Aspect_Priority,
Aspect_Read,
+ Aspect_Relative_Deadline,
Aspect_Scalar_Storage_Order, -- GNAT
Aspect_Simple_Storage_Pool, -- GNAT
Aspect_Size,
Aspect_Predicate => Expression,
Aspect_Priority => Expression,
Aspect_Read => Name,
+ Aspect_Relative_Deadline => Expression,
Aspect_Scalar_Storage_Order => Expression,
Aspect_Simple_Storage_Pool => Name,
Aspect_Size => Expression,
Aspect_Pure_12 => Name_Pure_12,
Aspect_Pure_Function => Name_Pure_Function,
Aspect_Read => Name_Read,
+ Aspect_Relative_Deadline => Name_Relative_Deadline,
Aspect_Remote_Access_Type => Name_Remote_Access_Type,
Aspect_Remote_Call_Interface => Name_Remote_Call_Interface,
Aspect_Remote_Types => Name_Remote_Types,
Delay_Required := False;
+ -- Case 2d : Aspects that correspond to a pragma with one
+ -- argument.
+
+ when Aspect_Relative_Deadline =>
+ Aitem :=
+ Make_Pragma (Loc,
+ Pragma_Argument_Associations =>
+ New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Relocate_Node (Expr))),
+ Pragma_Identifier =>
+ Make_Identifier (Sloc (Id), Name_Relative_Deadline));
+
+ -- If the aspect applies to a task, the corresponding pragma
+ -- must appear within its declarations, not after.
+
+ if Nkind (N) = N_Task_Type_Declaration then
+ declare
+ Def : Node_Id;
+ V : List_Id;
+
+ begin
+ if No (Task_Definition (N)) then
+ Set_Task_Definition (N,
+ Make_Task_Definition (Loc,
+ Visible_Declarations => New_List,
+ End_Label => Empty));
+ end if;
+
+ Def := Task_Definition (N);
+ V := Visible_Declarations (Def);
+ if not Is_Empty_List (V) then
+ Insert_Before (First (V), Aitem);
+
+ else
+ Set_Visible_Declarations (Def, New_List (Aitem));
+ end if;
+
+ goto Continue;
+ end;
+ end if;
+
-- Case 3 : Aspects that don't correspond to pragma/attribute
-- definition clause.
end if;
Exp := New_Copy_Tree (Arg2);
- Loc := Sloc (Exp);
+
+ -- Preserve sloc of original pragma Invariant (this is required
+ -- by Par_SCO).
+
+ Loc := Sloc (Ritem);
-- We need to replace any occurrences of the name of the type
-- with references to the object, converted to type'Class in
when Aspect_Priority | Aspect_Interrupt_Priority =>
T := Standard_Integer;
+ when Aspect_Relative_Deadline =>
+ T := RTE (RE_Time_Span);
+
when Aspect_Small =>
T := Universal_Real;