From be93c386585920cf9f235075a4b7fba74c0585ca Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 16 Jul 2012 14:57:45 +0200 Subject: [PATCH] [multiple changes] 2012-07-16 Thomas Quinot * gnat_rm.texi: Minor documentation improvements. 2012-07-16 Yannick Moy * 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 --- gcc/ada/ChangeLog | 11 ++++++++++ gcc/ada/gnat_rm.texi | 18 ++++++++++------- gcc/ada/sem_ch13.adb | 22 -------------------- gcc/ada/sem_prag.adb | 57 +--------------------------------------------------- 4 files changed, 23 insertions(+), 85 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b18dbac..307206b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,16 @@ 2012-07-16 Thomas Quinot + * gnat_rm.texi: Minor documentation improvements. + +2012-07-16 Yannick Moy + + * 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 + * freeze.adb (Check_Component_Storage_Order): Do not reject a nested composite with different scalar storage order if it is byte aligned. diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 0c86091..9770f19 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -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 diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 58d6492..144d66d 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -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); diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index ecec30f..fffbe0d 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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 -- 2.7.4