diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-07 14:45:51 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-07 14:45:51 +0000 |
commit | 44e15e2b70813ee19bee3a5c422d30f869be93bb (patch) | |
tree | 547ce03558b4baf7b4fb08c1682c061d275f1ccc /gcc/ada/a-strsup.adb | |
parent | 301d5ec3caa5836aaa51a008a6ff77cf307b3b43 (diff) | |
download | gcc-44e15e2b70813ee19bee3a5c422d30f869be93bb.tar.gz |
2012-03-07 Gary Dismukes <dismukes@adacore.com>
* exp_ch4.adb (Apply_Accessibility_Check): Call
Remove_Side_Effects in the build-in-place case, to ensure that
we capture the call and don't end up with two calls.
2012-03-07 Javier Miranda <miranda@adacore.com>
* exp_ch6.adb (Expand_Inlined_Call): Skip inlining of functions
that return unconstrained types using an extended return statement
since the support for inlining these functions has not been yet
added to the frontend.
* s-vaflop.adb, s-vaflop-vms-alpha.adb: Code reorganization.
* a-ngrear.ads: Replace all the Inline_Always pragmas by pragma
Inline.
* a-ngrear.adb (Eigenvalues, Transpose): Restructured to use
extended return statement.
* a-strsup.adb, a-stzsup.adb, a-stwisu.adb (Concat, Super_Slice,
Super_To_String): Restructured to use extended return statement.
* a-chahan.adb (To_Basic, To_Lower, To_Upper): Restructured to
use extended return statement.
* s-gearop.adb (Diagonal, Matrix_Elementwise_Operation,
Vector_Elementwise_Operation, Matrix_Elementwise_Operation,
Matrix_Matrix_Scalar_Elementwise_Operation,
Vector_Vector_Elementwise_Operation,
Vector_Vector_Scalar_Elementwise_Operation,
Matrix_Scalar_Elementwise_Operation,
Vector_Scalar_Elementwise_Operation,
Scalar_Matrix_Elementwise_Operation,
Scalar_Vector_Elementwise_Operation, Matrix_Matrix_Product,
Matrix_Vector_Product, Outer_Product, Unit_Matrix, Unit_Vector,
Vector_Matrix_Product): Restructured to use extended return
statement.
2012-03-07 Vincent Pucci <pucci@adacore.com>
* sem_ch5.adb (One_Bound): Minor reformatting.
2012-03-07 Tristan Gingold <gingold@adacore.com>
* s-osinte-vms-ia64.adb, s-osinte-vms-ia64.ads, s-osinte-vms.adb,
s-osinte-vms.ads, gcc-interface/Makefile.in: Merge s-osinte-vms and
s-osinte-vms-ia64.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185051 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-strsup.adb')
-rw-r--r-- | gcc/ada/a-strsup.adb | 167 |
1 files changed, 88 insertions, 79 deletions
diff --git a/gcc/ada/a-strsup.adb b/gcc/ada/a-strsup.adb index 707d9ec7055..ed14e58964c 100644 --- a/gcc/ada/a-strsup.adb +++ b/gcc/ada/a-strsup.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2012, 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- -- @@ -42,100 +42,107 @@ package body Ada.Strings.Superbounded is (Left : Super_String; Right : Super_String) return Super_String is - Result : Super_String (Left.Max_Length); - Llen : constant Natural := Left.Current_Length; - Rlen : constant Natural := Right.Current_Length; - Nlen : constant Natural := Llen + Rlen; - begin - if Nlen > Left.Max_Length then - raise Ada.Strings.Length_Error; - else - Result.Current_Length := Nlen; - Result.Data (1 .. Llen) := Left.Data (1 .. Llen); - Result.Data (Llen + 1 .. Nlen) := Right.Data (1 .. Rlen); - end if; + return Result : Super_String (Left.Max_Length) do + declare + Llen : constant Natural := Left.Current_Length; + Rlen : constant Natural := Right.Current_Length; + Nlen : constant Natural := Llen + Rlen; + begin + if Nlen > Left.Max_Length then + raise Ada.Strings.Length_Error; + end if; - return Result; + Result.Current_Length := Nlen; + Result.Data (1 .. Llen) := Left.Data (1 .. Llen); + Result.Data (Llen + 1 .. Nlen) := Right.Data (1 .. Rlen); + end; + end return; end Concat; function Concat (Left : Super_String; Right : String) return Super_String is - Result : Super_String (Left.Max_Length); - Llen : constant Natural := Left.Current_Length; - - Nlen : constant Natural := Llen + Right'Length; - begin - if Nlen > Left.Max_Length then - raise Ada.Strings.Length_Error; - else - Result.Current_Length := Nlen; - Result.Data (1 .. Llen) := Left.Data (1 .. Llen); - Result.Data (Llen + 1 .. Nlen) := Right; - end if; - return Result; + return Result : Super_String (Left.Max_Length) do + declare + Llen : constant Natural := Left.Current_Length; + Nlen : constant Natural := Llen + Right'Length; + begin + if Nlen > Left.Max_Length then + raise Ada.Strings.Length_Error; + end if; + + Result.Current_Length := Nlen; + Result.Data (1 .. Llen) := Left.Data (1 .. Llen); + Result.Data (Llen + 1 .. Nlen) := Right; + end; + end return; end Concat; function Concat (Left : String; Right : Super_String) return Super_String is - Result : Super_String (Right.Max_Length); - Llen : constant Natural := Left'Length; - Rlen : constant Natural := Right.Current_Length; - Nlen : constant Natural := Llen + Rlen; begin - if Nlen > Right.Max_Length then - raise Ada.Strings.Length_Error; - else - Result.Current_Length := Nlen; - Result.Data (1 .. Llen) := Left; - Result.Data (Llen + 1 .. Nlen) := Right.Data (1 .. Rlen); - end if; + return Result : Super_String (Right.Max_Length) do + declare + Llen : constant Natural := Left'Length; + Rlen : constant Natural := Right.Current_Length; + Nlen : constant Natural := Llen + Rlen; + begin + if Nlen > Right.Max_Length then + raise Ada.Strings.Length_Error; + end if; - return Result; + Result.Current_Length := Nlen; + Result.Data (1 .. Llen) := Left; + Result.Data (Llen + 1 .. Nlen) := Right.Data (1 .. Rlen); + end; + end return; end Concat; function Concat (Left : Super_String; Right : Character) return Super_String is - Result : Super_String (Left.Max_Length); - Llen : constant Natural := Left.Current_Length; - begin - if Llen = Left.Max_Length then - raise Ada.Strings.Length_Error; - else - Result.Current_Length := Llen + 1; - Result.Data (1 .. Llen) := Left.Data (1 .. Llen); - Result.Data (Result.Current_Length) := Right; - end if; + return Result : Super_String (Left.Max_Length) do + declare + Llen : constant Natural := Left.Current_Length; + begin + if Llen = Left.Max_Length then + raise Ada.Strings.Length_Error; + end if; - return Result; + Result.Current_Length := Llen + 1; + Result.Data (1 .. Llen) := Left.Data (1 .. Llen); + Result.Data (Result.Current_Length) := Right; + end; + end return; end Concat; function Concat (Left : Character; Right : Super_String) return Super_String is - Result : Super_String (Right.Max_Length); - Rlen : constant Natural := Right.Current_Length; - begin - if Rlen = Right.Max_Length then - raise Ada.Strings.Length_Error; - else - Result.Current_Length := Rlen + 1; - Result.Data (1) := Left; - Result.Data (2 .. Result.Current_Length) := Right.Data (1 .. Rlen); - end if; + return Result : Super_String (Right.Max_Length) do + declare + Rlen : constant Natural := Right.Current_Length; + begin + if Rlen = Right.Max_Length then + raise Ada.Strings.Length_Error; + end if; - return Result; + Result.Current_Length := Rlen + 1; + Result.Data (1) := Left; + Result.Data (2 .. Result.Current_Length) := + Right.Data (1 .. Rlen); + end; + end return; end Concat; ----------- @@ -1459,13 +1466,15 @@ package body Ada.Strings.Superbounded is begin -- Note: test of High > Length is in accordance with AI95-00128 - if Low > Source.Current_Length + 1 - or else High > Source.Current_Length - then - raise Index_Error; - else - return Source.Data (Low .. High); - end if; + return R : String (Low .. High) do + if Low > Source.Current_Length + 1 + or else High > Source.Current_Length + then + raise Index_Error; + end if; + + R := Source.Data (Low .. High); + end return; end Super_Slice; function Super_Slice @@ -1473,19 +1482,17 @@ package body Ada.Strings.Superbounded is Low : Positive; High : Natural) return Super_String is - Result : Super_String (Source.Max_Length); - begin - if Low > Source.Current_Length + 1 - or else High > Source.Current_Length - then - raise Index_Error; - else + return Result : Super_String (Source.Max_Length) do + if Low > Source.Current_Length + 1 + or else High > Source.Current_Length + then + raise Index_Error; + end if; + Result.Current_Length := High - Low + 1; Result.Data (1 .. Result.Current_Length) := Source.Data (Low .. High); - end if; - - return Result; + end return; end Super_Slice; procedure Super_Slice @@ -1615,7 +1622,9 @@ package body Ada.Strings.Superbounded is function Super_To_String (Source : Super_String) return String is begin - return Source.Data (1 .. Source.Current_Length); + return R : String (1 .. Source.Current_Length) do + R := Source.Data (1 .. Source.Current_Length); + end return; end Super_To_String; --------------------- |