]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 10 Oct 2013 10:55:36 +0000 (12:55 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 10 Oct 2013 10:55:36 +0000 (12:55 +0200)
2013-10-10  Yannick Moy  <moy@adacore.com>

* gnat_rm.texi, a-cfdlli.ads, a-cfhase.ads, a-cforma.ads, a-cfhama.ads,
a-cforse.ads, a-cofove.ads: Update comment and doc of formal containers

2013-10-10  Ed Schonberg  <schonberg@adacore.com>

* sem_ch13.adb (Analyze_Aspect_Specifications): For Pre/Post
conditions that apply to a subprogram body, preserve the placement
and order of the generated pragmas, which must appear before
other declarations in the body.

From-SVN: r203347

gcc/ada/ChangeLog
gcc/ada/a-cfdlli.ads
gcc/ada/a-cfhama.ads
gcc/ada/a-cfhase.ads
gcc/ada/a-cforma.ads
gcc/ada/a-cforse.ads
gcc/ada/a-cofove.ads
gcc/ada/gnat_rm.texi
gcc/ada/sem_ch13.adb

index b0b865443deba21e93daf54ca1c9e29926418839..7438dabe57eca39f5b3e2b9c81b827d95cd7c78a 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-10  Yannick Moy  <moy@adacore.com>
+
+       * gnat_rm.texi, a-cfdlli.ads, a-cfhase.ads, a-cforma.ads, a-cfhama.ads,
+       a-cforse.ads, a-cofove.ads: Update comment and doc of formal containers
+
+2013-10-10  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch13.adb (Analyze_Aspect_Specifications): For Pre/Post
+       conditions that apply to a subprogram body, preserve the placement
+       and order of the generated pragmas, which must appear before
+       other declarations in the body.
+
 2013-10-10  Bob Duff  <duff@adacore.com>
 
        * gnat_ugn.texi: Add gnat2xml doc.
index bfa8ffbcb90ab57dbd8076a535004dcb4daae89a..0442fe60aaf5d9dc7e7c5afee06634a2f46f19dd 100644 (file)
 ------------------------------------------------------------------------------
 
 --  This spec is derived from Ada.Containers.Bounded_Doubly_Linked_Lists in the
---  Ada 2012 RM. The modifications are to facilitate formal proofs by making it
---  easier to express properties.
+--  Ada 2012 RM. The modifications are meant to facilitate formal proofs by
+--  making it easier to express properties, and by making the specification of
+--  this unit compatible with SPARK 2014. Note that the API of this unit may be
+--  subject to incompatible changes as SPARK 2014 evolves.
 
 --  The modifications are:
 
@@ -49,7 +51,7 @@
 --      function Left  (Container : List; Position : Cursor) return List;
 --      function Right (Container : List; Position : Cursor) return List;
 
---    See subprogram specifications that follow for details
+--    See subprogram specifications that follow for details.
 
 generic
    type Element_Type is private;
index 93a47c56817d42141e0304c63f8a0265aae3da87..2f1e7bbdaf079a570975114d6cdee5ca7772fca1 100644 (file)
 ------------------------------------------------------------------------------
 
 --  This spec is derived from package Ada.Containers.Bounded_Hashed_Maps in the
---  Ada 2012 RM. The modifications are to facilitate formal proofs by making it
---  easier to express properties.
+--  Ada 2012 RM. The modifications are meant to facilitate formal proofs by
+--  making it easier to express properties, and by making the specification of
+--  this unit compatible with SPARK 2014. Note that the API of this unit may be
+--  subject to incompatible changes as SPARK 2014 evolves.
 
 --  The modifications are:
 
@@ -49,7 +51,7 @@
 --      function Left  (Container : Map; Position : Cursor) return Map;
 --      function Right (Container : Map; Position : Cursor) return Map;
 
---    See detailed specifications for these subprograms
+--    See detailed specifications for these subprograms.
 
 private with Ada.Containers.Hash_Tables;
 
index 22bfda97e892fe89de451851f9620a786c34f5cb..147a332ed5287ffcb0d7d9da4805256c999a1bcc 100644 (file)
 ------------------------------------------------------------------------------
 
 --  This spec is derived from package Ada.Containers.Bounded_Hashed_Sets in the
---  Ada 2012 RM. The modifications are to facilitate formal proofs by making it
---  easier to express properties.
+--  Ada 2012 RM. The modifications are meant to facilitate formal proofs by
+--  making it easier to express properties, and by making the specification of
+--  this unit compatible with SPARK 2014. Note that the API of this unit may be
+--  subject to incompatible changes as SPARK 2014 evolves.
 
 --  The modifications are:
 
@@ -49,7 +51,7 @@
 --      function Left  (Container : Set; Position : Cursor) return Set;
 --      function Right (Container : Set; Position : Cursor) return Set;
 
---    See detailed specifications for these subprograms
+--    See detailed specifications for these subprograms.
 
 private with Ada.Containers.Hash_Tables;
 
index 8e323e19dfb39e8d23eed461f77d46e296b6a22f..ca6db020013e3037e7f8847403fab8a7643065dd 100644 (file)
 ------------------------------------------------------------------------------
 
 --  This spec is derived from package Ada.Containers.Bounded_Ordered_Maps in
---  the Ada 2012 RM. The modifications are to facilitate formal proofs by
---  making it easier to express properties.
+--  the Ada 2012 RM. The modifications are meant to facilitate formal proofs by
+--  making it easier to express properties, and by making the specification of
+--  this unit compatible with SPARK 2014. Note that the API of this unit may be
+--  subject to incompatible changes as SPARK 2014 evolves.
 
 --  The modifications are:
 
@@ -51,7 +53,7 @@
 --      function Left  (Container : Map; Position : Cursor) return Map;
 --      function Right (Container : Map; Position : Cursor) return Map;
 
---    See detailed specifications for these subprograms
+--    See detailed specifications for these subprograms.
 
 private with Ada.Containers.Red_Black_Trees;
 
index 35e4613b9a881de7434568e8812a40ec9ca4ebea..7f9316186e6812b46a2c6ca38580c5c5dfc0c287 100644 (file)
 ------------------------------------------------------------------------------
 
 --  This spec is derived from package Ada.Containers.Bounded_Ordered_Sets in
---  the Ada 2012 RM. The modifications are to facilitate formal proofs by
---  making it easier to express properties.
+--  the Ada 2012 RM. The modifications are meant to facilitate formal proofs by
+--  making it easier to express properties, and by making the specification of
+--  this unit compatible with SPARK 2014. Note that the API of this unit may be
+--  subject to incompatible changes as SPARK 2014 evolves.
 
 --  The modifications are:
 
@@ -50,7 +52,7 @@
 --      function Left  (Container : Set; Position : Cursor) return Set;
 --      function Right (Container : Set; Position : Cursor) return Set;
 
---    See detailed specifications for these subprograms
+--    See detailed specifications for these subprograms.
 
 private with Ada.Containers.Red_Black_Trees;
 
index 9ca84da460fc0d795d46a833cac8615b2b57dc89..58e7b8b2c7b52669046f4e6fa6407584783ec935 100644 (file)
 ------------------------------------------------------------------------------
 
 --  This spec is derived from package Ada.Containers.Bounded_Vectors in the Ada
---  2012 RM. The modifications are to facilitate formal proofs by making it
---  easier to express properties.
+--  2012 RM. The modifications are meant to facilitate formal proofs by making
+--  it easier to express properties, and by making the specification of this
+--  unit compatible with SPARK 2014. Note that the API of this unit may be
+--  subject to incompatible changes as SPARK 2014 evolves.
 
 --  The modifications are:
 
 --      function Left  (Container : Vector; Position : Cursor) return Vector;
 --      function Right (Container : Vector; Position : Cursor) return Vector;
 
---      Left returns a container containing all elements preceding Position
---      (excluded) in Container. Right returns a container containing all
---      elements following Position (included) in Container. These two new
---      functions are useful to express invariant properties in loops which
---      iterate over containers. Left returns the part of the container already
---      scanned and Right the part not scanned yet.
+--    See detailed specifications for these subprograms.
 
 with Ada.Containers;
 use Ada.Containers;
@@ -350,9 +347,14 @@ package Ada.Containers.Formal_Vectors is
 
    function Left (Container : Vector; Position : Cursor) return Vector with
      Pre => Has_Element (Container, Position) or else Position = No_Element;
-
    function Right (Container : Vector; Position : Cursor) return Vector with
      Pre => Has_Element (Container, Position) or else Position = No_Element;
+   --  Left returns a container containing all elements preceding Position
+   --  (excluded) in Container. Right returns a container containing all
+   --  elements following Position (included) in Container. These two new
+   --  functions can be used to express invariant properties in loops which
+   --  iterate over containers. Left returns the part of the container already
+   --  scanned and Right the part not scanned yet.
 
 private
 
index e301c7fc3ef72c95faee3add2891375c6e1eddf1..6dfda7554d3176e1bb02df7eb89059ac25a12747 100644 (file)
@@ -16995,9 +16995,11 @@ is specifically authorized by the Ada Reference Manual
 @cindex Formal container for doubly linked lists
 
 @noindent
-This child of @code{Ada.Containers} defines a modified version of the Ada 2005
-container for doubly linked lists, meant to facilitate formal verification of
-code using such containers.
+This child of @code{Ada.Containers} defines a modified version of the
+Ada 2005 container for doubly linked lists, meant to facilitate formal
+verification of code using such containers. The specification of this
+unit is compatible with SPARK 2014. Note that the API of this unit may
+be subject to incompatible changes as SPARK 2014 evolves.
 
 @node Ada.Containers.Formal_Hashed_Maps (a-cfhama.ads)
 @section @code{Ada.Containers.Formal_Hashed_Maps} (@file{a-cfhama.ads})
@@ -17005,9 +17007,11 @@ code using such containers.
 @cindex Formal container for hashed maps
 
 @noindent
-This child of @code{Ada.Containers} defines a modified version of the Ada 2005
-container for hashed maps, meant to facilitate formal verification of
-code using such containers.
+This child of @code{Ada.Containers} defines a modified version of the
+Ada 2005 container for hashed maps, meant to facilitate formal
+verification of code using such containers. The specification of this
+unit is compatible with SPARK 2014. Note that the API of this unit may
+be subject to incompatible changes as SPARK 2014 evolves.
 
 @node Ada.Containers.Formal_Hashed_Sets (a-cfhase.ads)
 @section @code{Ada.Containers.Formal_Hashed_Sets} (@file{a-cfhase.ads})
@@ -17015,9 +17019,11 @@ code using such containers.
 @cindex Formal container for hashed sets
 
 @noindent
-This child of @code{Ada.Containers} defines a modified version of the Ada 2005
-container for hashed sets, meant to facilitate formal verification of
-code using such containers.
+This child of @code{Ada.Containers} defines a modified version of the
+Ada 2005 container for hashed sets, meant to facilitate formal
+verification of code using such containers. The specification of this
+unit is compatible with SPARK 2014. Note that the API of this unit may
+be subject to incompatible changes as SPARK 2014 evolves.
 
 @node Ada.Containers.Formal_Ordered_Maps (a-cforma.ads)
 @section @code{Ada.Containers.Formal_Ordered_Maps} (@file{a-cforma.ads})
@@ -17025,9 +17031,11 @@ code using such containers.
 @cindex Formal container for ordered maps
 
 @noindent
-This child of @code{Ada.Containers} defines a modified version of the Ada 2005
-container for ordered maps, meant to facilitate formal verification of
-code using such containers.
+This child of @code{Ada.Containers} defines a modified version of the
+Ada 2005 container for ordered maps, meant to facilitate formal
+verification of code using such containers. The specification of this
+unit is compatible with SPARK 2014. Note that the API of this unit may
+be subject to incompatible changes as SPARK 2014 evolves.
 
 @node Ada.Containers.Formal_Ordered_Sets (a-cforse.ads)
 @section @code{Ada.Containers.Formal_Ordered_Sets} (@file{a-cforse.ads})
@@ -17035,9 +17043,11 @@ code using such containers.
 @cindex Formal container for ordered sets
 
 @noindent
-This child of @code{Ada.Containers} defines a modified version of the Ada 2005
-container for ordered sets, meant to facilitate formal verification of
-code using such containers.
+This child of @code{Ada.Containers} defines a modified version of the
+Ada 2005 container for ordered sets, meant to facilitate formal
+verification of code using such containers. The specification of this
+unit is compatible with SPARK 2014. Note that the API of this unit may
+be subject to incompatible changes as SPARK 2014 evolves.
 
 @node Ada.Containers.Formal_Vectors (a-cofove.ads)
 @section @code{Ada.Containers.Formal_Vectors} (@file{a-cofove.ads})
@@ -17045,9 +17055,11 @@ code using such containers.
 @cindex Formal container for vectors
 
 @noindent
-This child of @code{Ada.Containers} defines a modified version of the Ada 2005
-container for vectors, meant to facilitate formal verification of
-code using such containers.
+This child of @code{Ada.Containers} defines a modified version of the
+Ada 2005 container for vectors, meant to facilitate formal
+verification of code using such containers. The specification of this
+unit is compatible with SPARK 2014. Note that the API of this unit may
+be subject to incompatible changes as SPARK 2014 evolves.
 
 @node Ada.Command_Line.Environment (a-colien.ads)
 @section @code{Ada.Command_Line.Environment} (@file{a-colien.ads})
index 0063a8689ce542fe3129c7b443332c7e1d85e58a..dbae075519799b1cfb3d73c6cec0aafefe2682c7 100644 (file)
@@ -1189,10 +1189,29 @@ package body Sem_Ch13 is
 
          elsif Nkind (N) = N_Subprogram_Body then
             if No (Declarations (N)) then
-               Set_Declarations (N, New_List);
-            end if;
+               Set_Declarations (N, New_List (Prag));
+            else
+               declare
+                  D : Node_Id;
+               begin
+
+                  --  There may be several aspects associated with the body;
+                  --  preserve the ordering of the corresponding pragmas.
+
+                  D := First (Declarations (N));
+                  while Present (D) loop
+                     exit when Nkind (D) /= N_Pragma
+                       or else not From_Aspect_Specification (D);
+                     Next (D);
+                  end loop;
 
-            Append (Prag, Declarations (N));
+                  if No (D) then
+                     Append (Prag, Declarations (N));
+                  else
+                     Insert_Before (D, Prag);
+                  end if;
+               end;
+            end if;
 
          --  Default
 
@@ -2231,6 +2250,8 @@ package body Sem_Ch13 is
                               end;
                            end if;
 
+                           --  Otherwise, Convention must be specified
+
                            Error_Msg_N
                              ("missing Convention aspect for Export/Import",
                               Aspect);