From a18e3d62790873a98c07b098647a7002a24a1690 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 30 Jul 2014 17:17:33 +0200 Subject: [PATCH] [multiple changes] 2014-07-30 Ed Schonberg * a-crdlli.ads: Place declaration of Empty_List after full type declaration for Curosr, to prevent freezing error. 2014-07-30 Robert Dewar * 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 * 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 * 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. From-SVN: r213300 --- gcc/ada/ChangeLog | 24 ++++++++++++++++++++++++ gcc/ada/a-cbhase.adb | 3 ++- gcc/ada/a-crdlli.ads | 6 +++--- gcc/ada/a-rbtgbo.adb | 9 +++++++-- gcc/ada/get_targ.adb | 39 +++++++++++++++------------------------ gcc/ada/get_targ.ads | 6 +++--- gcc/ada/prj-proc.adb | 3 ++- gcc/ada/prj-proc.ads | 4 ++-- gcc/ada/sem_ch6.adb | 1 + 9 files changed, 59 insertions(+), 36 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 923f6cd..3fac029 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,27 @@ +2014-07-30 Ed Schonberg + + * a-crdlli.ads: Place declaration of Empty_List after full type + declaration for Curosr, to prevent freezing error. + +2014-07-30 Robert Dewar + + * 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 + + * 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 + + * 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 * set_targ.adb (Read_Target_Dependent_Values): New subprogram. diff --git a/gcc/ada/a-cbhase.adb b/gcc/ada/a-cbhase.adb index 8d4a61e..331087b 100644 --- a/gcc/ada/a-cbhase.adb +++ b/gcc/ada/a-cbhase.adb @@ -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; diff --git a/gcc/ada/a-crdlli.ads b/gcc/ada/a-crdlli.ads index f2b5865..c18005f 100644 --- a/gcc/ada/a-crdlli.ads +++ b/gcc/ada/a-crdlli.ads @@ -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; diff --git a/gcc/ada/a-rbtgbo.adb b/gcc/ada/a-rbtgbo.adb index ddf3fe2..d3b54d6 100644 --- a/gcc/ada/a-rbtgbo.adb +++ b/gcc/ada/a-rbtgbo.adb @@ -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); diff --git a/gcc/ada/get_targ.adb b/gcc/ada/get_targ.adb index fa0c8b9..9dde22b 100644 --- a/gcc/ada/get_targ.adb +++ b/gcc/ada/get_targ.adb @@ -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; diff --git a/gcc/ada/get_targ.ads b/gcc/ada/get_targ.ads index 6d484a3..457575e 100644 --- a/gcc/ada/get_targ.ads +++ b/gcc/ada/get_targ.ads @@ -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; diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index 561f4ec..08232cd 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -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 := diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads index 97d7310..2b0680e 100644 --- a/gcc/ada/prj-proc.ads +++ b/gcc/ada/prj-proc.ads @@ -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- -- diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 05359a9..77c3294 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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). -- 2.7.4