summaryrefslogtreecommitdiff
path: root/gcc/ada/a-strunb.ads
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-strunb.ads')
-rw-r--r--gcc/ada/a-strunb.ads20
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ada/a-strunb.ads b/gcc/ada/a-strunb.ads
index fe909009e12..996eb0e10cf 100644
--- a/gcc/ada/a-strunb.ads
+++ b/gcc/ada/a-strunb.ads
@@ -1,12 +1,12 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME COMPONENTS --
+-- GNAT RUNTIME COMPONENTS --
-- --
-- A D A . S T R I N G S . U N B O U N D E D --
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-1998 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -365,8 +365,16 @@ private
type Unbounded_String is new AF.Controlled with record
Reference : String_Access := Null_String'Access;
+ Last : Natural := 0;
end record;
+ -- The Unbounded_String is using a buffered implementation to increase
+ -- speed of the Append/Delete/Insert procedures. The Reference string
+ -- pointer above contains the current string value and extra room at the
+ -- end to be used by the next Append routine. Last is the index of the
+ -- string ending character. So the current string value is really
+ -- Reference (1 .. Last).
+
pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
pragma Finalize_Storage_Only (Unbounded_String);
@@ -375,7 +383,13 @@ private
procedure Adjust (Object : in out Unbounded_String);
procedure Finalize (Object : in out Unbounded_String);
+ -- Note: the following declaration is illegal since library level
+ -- controlled objects are not allowed in preelaborated units. See
+ -- AI-161 for a discussion of this issue and an attempt to address it.
+ -- Meanwhile, what happens in GNAT is that this check is omitted for
+ -- internal implementation units (see check in sem_cat.adb).
+
Null_Unbounded_String : constant Unbounded_String :=
- (AF.Controlled with Reference => Null_String'Access);
+ (AF.Controlled with Reference => Null_String'Access, Last => 0);
end Ada.Strings.Unbounded;