2012-07-16 Thomas Quinot <quinot@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jul 2012 12:57:45 +0000 (12:57 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jul 2012 12:57:45 +0000 (12:57 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189533 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gnat_rm.texi
gcc/ada/sem_ch13.adb
gcc/ada/sem_prag.adb

index b18dbac..307206b 100644 (file)
@@ -1,5 +1,16 @@
 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
        nested composite with different scalar storage order if it is
        byte aligned.
index 0c86091..9770f19 100644 (file)
@@ -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
index 58d6492..144d66d 100644 (file)
@@ -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);
index ecec30f..fffbe0d 100644 (file)
@@ -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