From 1dceb63e5940445ceb877e01145ff4b1f5d5dc83 Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 29 Aug 2011 14:32:43 +0000 Subject: 2011-08-29 Robert Dewar * impunit.adb, exp_ch4.adb, s-finmas.adb: Minor reformatting. 2011-08-29 Thomas Quinot * exp_dist.adb (TC_Rec_Add_Process_Element): For a choice with multiple values, we generate multiple triples of parameters in the TypeCode. Bump Choice_Index for each such triple so that a subsequent default choice is associated with the correct index in the typecode. 2011-08-29 Ed Schonberg * a-cdlili.adb (Iterate): Initialize properly an iterator over a null container. (First, Last): Handle properly an iterator over a null container. 2011-08-29 Bob Duff * sem_ch10.adb (Analyze_With_Clause,Install_Withed_Unit): Abandon processing if we run across a node with no Scope. This can happen if we're with-ing an library-level instance, and that instance got errors that caused "instantiation abandoned". * sem_util.adb (Unit_Declaration_Node): Make it more robust, by raising an exception instead of using Assert, so it won't go into an infinite loop, even when assertions are turned off. 2011-08-29 Ed Schonberg * a-coorse.adb: Proper handling of empty ordered sets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178249 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/a-coorse.adb | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'gcc/ada/a-coorse.adb') diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb index b7d9d45dc03..668bd739e84 100644 --- a/gcc/ada/a-coorse.adb +++ b/gcc/ada/a-coorse.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, 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- -- @@ -532,8 +532,13 @@ package body Ada.Containers.Ordered_Sets is function First (Object : Iterator) return Cursor is begin - return Cursor'( - Object.Container.all'Unrestricted_Access, Object.Container.Tree.First); + if Object.Container = null then + return No_Element; + else + return Cursor'( + Object.Container.all'Unrestricted_Access, + Object.Container.Tree.First); + end if; end First; ------------------- @@ -1142,10 +1147,12 @@ package body Ada.Containers.Ordered_Sets is function Iterate (Container : Set) return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class is - It : constant Iterator := - (Container'Unchecked_Access, Container.Tree.First); begin - return It; + if Container.Length = 0 then + return Iterator'(null, null); + else + return Iterator'(Container'Unchecked_Access, Container.Tree.First); + end if; end Iterate; function Iterate (Container : Set; Start : Cursor) @@ -1171,7 +1178,7 @@ package body Ada.Containers.Ordered_Sets is function Last (Object : Iterator) return Cursor is begin - if Object.Container.Tree.Last = null then + if Object.Container = null then return No_Element; end if; -- cgit v1.2.1