2014-07-30 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Jul 2014 15:17:33 +0000 (15:17 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Jul 2014 15:17:33 +0000 (15:17 +0000)
* a-crdlli.ads: Place declaration of Empty_List after full type
declaration for Curosr, to prevent freezing error.

2014-07-30  Robert Dewar  <dewar@adacore.com>

* get_targ.adb: Minor code reorganization.
* prj-proc.adb, prj-proc.ads, get_targ.ads, sem_ch6.adb: Minor
reformatting.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

* a-cbhase.adb: a-cbhase.adb (Insert): Raise Constraint_Error,
not Program_Error, when attempting to remove an element not in
the set. This is the given semantics for all set containers.

2014-07-30  Ed Schonberg  <schonberg@adacore.com>

* a-rbtgbo.adb: -rbtgbo.adb (Delete_Node_Sans_Free): If
element is not present in tree return rather than violating
an assertion. Constraint_Error will be raised in the caller if
element is not in the container.

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

gcc/ada/ChangeLog
gcc/ada/a-cbhase.adb
gcc/ada/a-crdlli.ads
gcc/ada/a-rbtgbo.adb
gcc/ada/get_targ.adb
gcc/ada/get_targ.ads
gcc/ada/prj-proc.adb
gcc/ada/prj-proc.ads
gcc/ada/sem_ch6.adb

index 923f6cd..3fac029 100644 (file)
@@ -1,3 +1,27 @@
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * a-crdlli.ads: Place declaration of Empty_List after full type
+       declaration for Curosr, to prevent freezing error.
+
+2014-07-30  Robert Dewar  <dewar@adacore.com>
+
+       * get_targ.adb: Minor code reorganization.
+       * prj-proc.adb, prj-proc.ads, get_targ.ads, sem_ch6.adb: Minor
+       reformatting.
+
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * a-cbhase.adb: a-cbhase.adb (Insert): Raise Constraint_Error,
+       not Program_Error, when attempting to remove an element not in
+       the set. This is the given semantics for all set containers.
+
+2014-07-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * a-rbtgbo.adb: -rbtgbo.adb (Delete_Node_Sans_Free): If
+       element is not present in tree return rather than violating
+       an assertion. Constraint_Error will be raised in the caller if
+       element is not in the container.
+
 2014-07-30  Arnaud Charlet  <charlet@adacore.com>
 
        * set_targ.adb (Read_Target_Dependent_Values): New subprogram.
index 8d4a61e..331087b 100644 (file)
@@ -762,7 +762,8 @@ package body Ada.Containers.Bounded_Hashed_Sets is
       Insert (Container, New_Item, Position, Inserted);
 
       if not Inserted then
-         raise Program_Error with "attempt to insert element already in set";
+         raise Constraint_Error with
+           "attempt to insert element already in set";
       end if;
    end Insert;
 
index f2b5865..c18005f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2004-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -321,8 +321,6 @@ private
       Length : Count_Type := 0;
    end record;
 
-   Empty_List : constant List := (0, others => <>);
-
    type List_Access is access all List;
    for List_Access'Storage_Size use 0;
 
@@ -332,6 +330,8 @@ private
          Node      : Count_Type := 0;
       end record;
 
+   Empty_List : constant List := (0, others => <>);
+
    No_Element : constant Cursor := (null, 0);
 
 end Ada.Containers.Restricted_Doubly_Linked_Lists;
index ddf3fe2..d3b54d6 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2004-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -196,7 +196,6 @@ package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is
       X, Y : Count_Type;
 
       Z : constant Count_Type := Node;
-      pragma Assert (Z /= 0);
 
       N : Nodes_Type renames Tree.Nodes;
 
@@ -206,6 +205,12 @@ package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is
            "attempt to tamper with cursors (container is busy)";
       end if;
 
+      --  If node is not present, return. Exception will be raised in caller.
+
+      if Z = 0 then
+         return;
+      end if;
+
       pragma Assert (Tree.Length > 0);
       pragma Assert (Tree.Root  /= 0);
       pragma Assert (Tree.First /= 0);
index fa0c8b9..9dde22b 100644 (file)
@@ -308,19 +308,14 @@ package body Get_Targ is
 
    function Digits_From_Size (Size : Pos) return Pos is
    begin
-      if    Size =  32 then
-         return  6;
-      elsif Size =  48 then
-         return  9;
-      elsif Size =  64 then
-         return 15;
-      elsif Size =  96 then
-         return 18;
-      elsif Size = 128 then
-         return 18;
-      else
-         raise Program_Error;
-      end if;
+      case Size is
+         when  32    => return  6;
+         when  48    => return  9;
+         when  64    => return 15;
+         when  96    => return 18;
+         when 128    => return 18;
+         when others => raise Program_Error;
+      end case;
    end Digits_From_Size;
 
    -----------------------------
@@ -349,17 +344,13 @@ package body Get_Targ is
 
    function Width_From_Size  (Size : Pos) return Pos is
    begin
-      if    Size =  8 then
-         return  4;
-      elsif Size = 16 then
-         return  6;
-      elsif Size = 32 then
-         return 11;
-      elsif Size = 64 then
-         return 21;
-      else
-         raise Program_Error;
-      end if;
+      case Size is
+         when  8     => return  4;
+         when 16     => return  6;
+         when 32     => return 11;
+         when 64     => return 21;
+         when others => raise Program_Error;
+      end case;
    end Width_From_Size;
 
 end Get_Targ;
index 6d484a3..457575e 100644 (file)
@@ -146,8 +146,8 @@ package Get_Targ is
    --  Calls the Call_Back function with information for each supported type
 
    function Get_Back_End_Config_File return String_Ptr;
-   --  Return the back end configuration file, or null if none.
-   --  If non null, this file should be used instead of calling the various
-   --  Get_xxx functions in this package.
+   --  Return the back end configuration file, or null if none. If non-null,
+   --  this file should be used instead of calling the various Get_xxx
+   --  functions in this package.
 
 end Get_Targ;
index 561f4ec..08232cd 100644 (file)
@@ -2,7 +2,7 @@
 --                                                                          --
 --                         GNAT COMPILER COMPONENTS                         --
 --                                                                          --
---                              P R J . P R O C                             --
+--                             P R J . P R O C                              --
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
@@ -2848,6 +2848,7 @@ package body Prj.Proc is
             --  Check if the project is already in the tree
 
             Project := No_Project;
+
             declare
                List : Project_List := In_Tree.Projects;
                Path : constant Path_Name_Type :=
index 97d7310..2b0680e 100644 (file)
@@ -2,11 +2,11 @@
 --                                                                          --
 --                         GNAT COMPILER COMPONENTS                         --
 --                                                                          --
---                              P R J . P R O C                             --
+--                             P R J . P R O C                              --
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2001-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
index 05359a9..77c3294 100644 (file)
@@ -9891,6 +9891,7 @@ package body Sem_Ch6 is
                   --  in bodies. Limited views of either kind are not allowed
                   --  if there is no place at which the non-limited view can
                   --  become available.
+
                   --  Incomplete formal untagged types are not allowed in
                   --  subprogram bodies (but are legal in their declarations).