as for standard representation attribute @code{Bit_Order}, as defined by
Ada RM 13.5.3(4). The default is @code{System.Default_Bit_Order}.
-If @code{@var{S}'Scalar_Storage_Order} is specified explicitly, it shall be
-equal to @code{@var{S}'Bit_Order}. Note: This means that if a
-@code{Scalar_Storage_Order} attribute definition clause is not confirming,
-then the type's @code{Bit_Order} shall be specified explicitly and set to
-the same value.
+For a record type @var{S}, if @code{@var{S}'Scalar_Storage_Order} is
+specified explicitly, it shall be equal to @code{@var{S}'Bit_Order}. Note:
+This means that if a @code{Scalar_Storage_Order} attribute definition
+clause is not confirming, then the type's @code{Bit_Order} shall be
+specified explicitly and set to the same value.
-If a component of S has itself a record or array type, then it shall also
+If a component of @var{S} has itself a record or array type, then it shall also
have a @code{Scalar_Storage_Order} attribute definition clause. In addition,
if the component does not start on a byte boundary, then the scalar storage
order specified for S and for the nested component type shall be identical.
with a value equal to @code{System.Default_Bit_Order}) has no effect.
If the opposite storage order is specified, then whenever the value of
-a scalar component of S is read, the storage elements of the enclosing
-machine scalar are first reversed (before retrieving the component value,
-possibly applying some shift and mask operatings on the enclosing machine
-scalar), and the opposite operation is done for writes.
+a scalar component of an object of type @var{S} is read, the storage
+elements of the enclosing machine scalar are first reversed (before
+retrieving the component value, possibly applying some shift and mask
+operatings on the enclosing machine scalar), and the opposite operation
+is done for writes.
In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
are relaxed. Instead, the following rules apply:
-- Process L, a list of statements or declarations dominated by D.
-- If P is present, it is processed as though it had been prepended to L.
+ function Traverse_Declarations_Or_Statements
+ (L : List_Id;
+ D : Dominant_Info := No_Dominant;
+ P : Node_Id := Empty) return Dominant_Info;
+ -- Same as above, and returns dominant information corresponding to the
+ -- last node with SCO in L.
+
-- The following Traverse_* routines perform appropriate calls to
-- Traverse_Declarations_Or_Statements to traverse specific node kinds
-- original source occurrence of the pragma.
if not (Generate_SCO
- and then
- In_Extended_Main_Source_Unit (Cunit_Entity (Current_Sem_Unit))
+ and then In_Extended_Main_Source_Unit (Loc)
and then not (In_Instance or In_Inlined_Body))
then
return;
(L : List_Id;
D : Dominant_Info := No_Dominant;
P : Node_Id := Empty)
+ is
+ Discard_Dom : Dominant_Info;
+ pragma Warnings (Off, Discard_Dom);
+ begin
+ Discard_Dom := Traverse_Declarations_Or_Statements (L, D, P);
+ end Traverse_Declarations_Or_Statements;
+
+ function Traverse_Declarations_Or_Statements
+ (L : List_Id;
+ D : Dominant_Info := No_Dominant;
+ P : Node_Id := Empty) return Dominant_Info
is
Current_Dominant : Dominant_Info := D;
-- Dominance information for the current basic block
-- entry since Set_SCO_Pragma_Enabled will be called when
-- analyzing actual checks, possibly in other units).
+ -- Pre/post can have checks in client units too because of
+ -- inheritance, so should they be moved here???
+
when Aspect_Predicate |
Aspect_Static_Predicate |
Aspect_Dynamic_Predicate |
when N_Block_Statement =>
Set_Statement_Entry;
- Traverse_Declarations_Or_Statements
- (L => Declarations (N),
- D => Current_Dominant);
+
+ -- The first statement in the handled sequence of statements
+ -- is dominated by the elaboration of the last declaration.
+
+ Current_Dominant := Traverse_Declarations_Or_Statements
+ (L => Declarations (N),
+ D => Current_Dominant);
+
Traverse_Handled_Statement_Sequence
(N => Handled_Statement_Sequence (N),
D => Current_Dominant);
Process_Decisions_Defer (Expression (Arg), 'P');
Typ := 'p';
+ -- Pre/postconditions can be inherited so SCO should
+ -- never be deactivated???
+
when Name_Debug =>
if Present (Arg) and then Present (Next (Arg)) then
-- for any embedded expressions, and the pragma is
-- never disabled.
+ -- Should generate P decisions (not X) for assertion
+ -- related pragmas: [Type_]Invariant,
+ -- [{Static,Dynamic}_]Predicate???
+
when others =>
Process_Decisions_Defer (N, 'X');
Typ := 'P';
if Present (P) or else Is_Non_Empty_List (L) then
Set_Statement_Entry;
end if;
+
+ return Current_Dominant;
end Traverse_Declarations_Or_Statements;
------------------------------------------
---------------------------
procedure Traverse_Package_Body (N : Node_Id) is
+ Dom : Dominant_Info;
begin
- Traverse_Declarations_Or_Statements (Declarations (N));
- Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N));
+ -- The first statement in the handled sequence of statements is
+ -- dominated by the elaboration of the last declaration.
+
+ Dom := Traverse_Declarations_Or_Statements (Declarations (N));
+
+ Traverse_Handled_Statement_Sequence
+ (Handled_Statement_Sequence (N), Dom);
end Traverse_Package_Body;
----------------------------------
procedure Traverse_Package_Declaration (N : Node_Id) is
Spec : constant Node_Id := Specification (N);
+ Dom : Dominant_Info;
begin
- Traverse_Declarations_Or_Statements (Visible_Declarations (Spec));
- Traverse_Declarations_Or_Statements (Private_Declarations (Spec));
+ -- The first private declaration is dominated by the last visible
+ -- declaration.
+
+ Dom := Traverse_Declarations_Or_Statements (Visible_Declarations (Spec));
+ Traverse_Declarations_Or_Statements (Private_Declarations (Spec), Dom);
end Traverse_Package_Declaration;
------------------------------
Vis_Decl := Visible_Declarations (Sync_Def);
- Traverse_Declarations_Or_Statements
- (L => Vis_Decl,
- D => Dom_Info);
+ Dom_Info := Traverse_Declarations_Or_Statements
+ (L => Vis_Decl,
+ D => Dom_Info);
-- If visible declarations are present, the first private declaration
-- is dominated by the last visible declaration.
- -- This is incorrect if Last (Vis_Decl) does not generate a SCO???
-
- if not Is_Empty_List (Vis_Decl) then
- Dom_Info.N := Last (Vis_Decl);
- end if;
-
Traverse_Declarations_Or_Statements
(L => Private_Declarations (Sync_Def),
D => Dom_Info);
(N : Node_Id;
D : Dominant_Info := No_Dominant)
is
+ Decls : constant List_Id := Declarations (N);
+ Dom_Info : Dominant_Info := D;
begin
- Traverse_Declarations_Or_Statements (Declarations (N), D);
- Traverse_Handled_Statement_Sequence (Handled_Statement_Sequence (N), D);
+ -- If declarations are present, the first statement is dominated by the
+ -- last declaration.
+
+ Dom_Info := Traverse_Declarations_Or_Statements
+ (L => Decls, D => Dom_Info);
+
+ Traverse_Handled_Statement_Sequence
+ (N => Handled_Statement_Sequence (N),
+ D => Dom_Info);
end Traverse_Subprogram_Or_Task_Body;
end Par_SCO;