[multiple changes]
2012-07-16 Thomas Quinot <quinot@adacore.com> * gnat_rm.texi: Minor documentation improvements. 2012-07-16 Yannick Moy <moy@adacore.com> * sem_ch13.adb (Analyze_Aspect_Specifications): Allow Pre and Pre'Class aspects on the same declaration. * sem_prag.adb (Chain_PPC): Allow Pre and Pre'Class aspects on the same hierarchy of primitive operations. From-SVN: r189533
This commit is contained in:
parent
5df1266a05
commit
be93c38658
4 changed files with 23 additions and 85 deletions
|
@ -1,3 +1,14 @@
|
|||
2012-07-16 Thomas Quinot <quinot@adacore.com>
|
||||
|
||||
* gnat_rm.texi: Minor documentation improvements.
|
||||
|
||||
2012-07-16 Yannick Moy <moy@adacore.com>
|
||||
|
||||
* sem_ch13.adb (Analyze_Aspect_Specifications): Allow Pre
|
||||
and Pre'Class aspects on the same declaration.
|
||||
* sem_prag.adb (Chain_PPC): Allow Pre and Pre'Class aspects on the
|
||||
same hierarchy of primitive operations.
|
||||
|
||||
2012-07-16 Thomas Quinot <quinot@adacore.com>
|
||||
|
||||
* freeze.adb (Check_Component_Storage_Order): Do not reject a
|
||||
|
|
|
@ -6726,15 +6726,17 @@ 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.
|
||||
|
||||
No component of a type that has a @code{Scalar_Storage_Order} attribute
|
||||
definition may be aliased.
|
||||
|
||||
A confirming @code{Scalar_Storage_Order} attribute definition clause (i.e.
|
||||
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.
|
||||
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.
|
||||
|
||||
In that case, the restrictions set forth in 13.5.1(10.3/2) for scalar components
|
||||
are relaxed. Instead, the following rules apply:
|
||||
|
@ -13705,7 +13707,9 @@ ENCODING=[UTF8|8BITS]
|
|||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The use of these parameters is described later in this section.
|
||||
The use of these parameters is described later in this section. If an
|
||||
unrecognized keyword appears in a form string, it is silently ignored
|
||||
and not considered invalid.
|
||||
|
||||
@node Direct_IO
|
||||
@section Direct_IO
|
||||
|
|
|
@ -1098,29 +1098,7 @@ package body Sem_Ch13 is
|
|||
("aspect `%''Class` for & previously given#",
|
||||
Id, E);
|
||||
end if;
|
||||
|
||||
-- Case of Pre and Pre'Class both specified
|
||||
|
||||
elsif Nam = Name_Pre then
|
||||
if Class_Present (Aspect) then
|
||||
Error_Msg_NE
|
||||
("aspect `Pre''Class` for & is not allowed here",
|
||||
Id, E);
|
||||
Error_Msg_NE
|
||||
("\since aspect `Pre` previously given#",
|
||||
Id, E);
|
||||
|
||||
else
|
||||
Error_Msg_NE
|
||||
("aspect `Pre` for & is not allowed here",
|
||||
Id, E);
|
||||
Error_Msg_NE
|
||||
("\since aspect `Pre''Class` previously given#",
|
||||
Id, E);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- Allowed case of X and X'Class both specified
|
||||
end if;
|
||||
|
||||
Next (Anod);
|
||||
|
|
|
@ -2011,8 +2011,7 @@ package body Sem_Prag is
|
|||
---------------
|
||||
|
||||
procedure Chain_PPC (PO : Node_Id) is
|
||||
S : Entity_Id;
|
||||
P : Node_Id;
|
||||
S : Entity_Id;
|
||||
|
||||
begin
|
||||
if Nkind (PO) = N_Abstract_Subprogram_Declaration then
|
||||
|
@ -2060,60 +2059,6 @@ package body Sem_Prag is
|
|||
S := Defining_Unit_Name (Specification (PO));
|
||||
end if;
|
||||
|
||||
-- Make sure we do not have the case of a precondition pragma when
|
||||
-- the Pre'Class aspect is present.
|
||||
|
||||
-- We do this by looking at pragmas already chained to the entity
|
||||
-- since the aspect derived pragma will be put on this list first.
|
||||
|
||||
if Pragma_Name (N) = Name_Precondition then
|
||||
if not From_Aspect_Specification (N) then
|
||||
P := Spec_PPC_List (Contract (S));
|
||||
while Present (P) loop
|
||||
if Pragma_Name (P) = Name_Precondition
|
||||
and then From_Aspect_Specification (P)
|
||||
and then Class_Present (P)
|
||||
then
|
||||
Error_Msg_Sloc := Sloc (P);
|
||||
Error_Pragma
|
||||
("pragma% not allowed, `Pre''Class` aspect given#");
|
||||
end if;
|
||||
|
||||
P := Next_Pragma (P);
|
||||
end loop;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- Similarly check for Pre with inherited Pre'Class. Note that
|
||||
-- we cover the aspect case as well here.
|
||||
|
||||
if Pragma_Name (N) = Name_Precondition
|
||||
and then not Class_Present (N)
|
||||
then
|
||||
declare
|
||||
Inherited : constant Subprogram_List :=
|
||||
Inherited_Subprograms (S);
|
||||
P : Node_Id;
|
||||
|
||||
begin
|
||||
for J in Inherited'Range loop
|
||||
P := Spec_PPC_List (Contract (Inherited (J)));
|
||||
while Present (P) loop
|
||||
if Pragma_Name (P) = Name_Precondition
|
||||
and then Class_Present (P)
|
||||
then
|
||||
Error_Msg_Sloc := Sloc (P);
|
||||
Error_Pragma
|
||||
("pragma% not allowed, `Pre''Class` "
|
||||
& "aspect inherited from#");
|
||||
end if;
|
||||
|
||||
P := Next_Pragma (P);
|
||||
end loop;
|
||||
end loop;
|
||||
end;
|
||||
end if;
|
||||
|
||||
-- Note: we do not analyze the pragma at this point. Instead we
|
||||
-- delay this analysis until the end of the declarative part in
|
||||
-- which the pragma appears. This implements the required delay
|
||||
|
|
Loading…
Add table
Reference in a new issue