summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-01 09:22:08 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-01 09:22:08 +0000
commit69b6b231df3bd6836ed8734b1a52b975aa1eb7c8 (patch)
treee2b94e114b55709602a6d89ccd45950da66fca16 /gcc/ada
parenteeffeeaaf49c95490f8688c45d4f7423d349b478 (diff)
downloadgcc-69b6b231df3bd6836ed8734b1a52b975aa1eb7c8.tar.gz
2011-08-01 Pascal Obry <obry@adacore.com>
* a-stzunb-shared.adb, a-strunb-shared.adb, a-stwiun-shared.adb: Fix Replace_Slice when High is above current string size. (Replace_Slice): Fix DL computation when High is above current string length. 2011-08-01 Gary Dismukes <dismukes@adacore.com> * gnat_rm.texi: Add documentation for pragma Static_Elaboration_Desired. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177004 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/a-strunb-shared.adb8
-rw-r--r--gcc/ada/a-stwiun-shared.adb8
-rw-r--r--gcc/ada/a-stzunb-shared.adb8
-rw-r--r--gcc/ada/gnat_rm.texi27
5 files changed, 56 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 68e005c5296..12ba03bd771 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2011-08-01 Pascal Obry <obry@adacore.com>
+
+ * a-stzunb-shared.adb, a-strunb-shared.adb, a-stwiun-shared.adb:
+ Fix Replace_Slice when High is above current string size.
+ (Replace_Slice): Fix DL computation when High is above current
+ string length.
+
+2011-08-01 Gary Dismukes <dismukes@adacore.com>
+
+ * gnat_rm.texi: Add documentation for pragma Static_Elaboration_Desired.
+
2011-08-01 Matthew Heaney <heaney@adacore.com>
* a-rbtgbo.adb (Delete_Node_Sans_Free): Fixed assignment to left child
diff --git a/gcc/ada/a-strunb-shared.adb b/gcc/ada/a-strunb-shared.adb
index bfa4875f588..b0e413dde8b 100644
--- a/gcc/ada/a-strunb-shared.adb
+++ b/gcc/ada/a-strunb-shared.adb
@@ -1347,7 +1347,9 @@ package body Ada.Strings.Unbounded is
-- Do replace operation when removed slice is not empty
if High >= Low then
- DL := By'Length + SR.Last + Low - High - 1;
+ DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1;
+ -- This is the number of characters remaining in the string after
+ -- replacing the slice.
-- Result is empty string, reuse empty shared string
@@ -1394,7 +1396,9 @@ package body Ada.Strings.Unbounded is
-- Do replace operation only when replaced slice is not empty
if High >= Low then
- DL := By'Length + SR.Last + Low - High - 1;
+ DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1;
+ -- This is the number of characters remaining in the string after
+ -- replacing the slice.
-- Result is empty string, reuse empty shared string
diff --git a/gcc/ada/a-stwiun-shared.adb b/gcc/ada/a-stwiun-shared.adb
index b06a9d0ec8f..95b17eff5f8 100644
--- a/gcc/ada/a-stwiun-shared.adb
+++ b/gcc/ada/a-stwiun-shared.adb
@@ -1359,7 +1359,9 @@ package body Ada.Strings.Wide_Unbounded is
-- Do replace operation when removed slice is not empty
if High >= Low then
- DL := By'Length + SR.Last + Low - High - 1;
+ DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1;
+ -- This is the number of characters remaining in the string after
+ -- replacing the slice.
-- Result is empty string, reuse empty shared string
@@ -1406,7 +1408,9 @@ package body Ada.Strings.Wide_Unbounded is
-- Do replace operation only when replaced slice is not empty
if High >= Low then
- DL := By'Length + SR.Last + Low - High - 1;
+ DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1;
+ -- This is the number of characters remaining in the string after
+ -- replacing the slice.
-- Result is empty string, reuse empty shared string
diff --git a/gcc/ada/a-stzunb-shared.adb b/gcc/ada/a-stzunb-shared.adb
index 08c20a0fa3f..965d856e182 100644
--- a/gcc/ada/a-stzunb-shared.adb
+++ b/gcc/ada/a-stzunb-shared.adb
@@ -1369,7 +1369,9 @@ package body Ada.Strings.Wide_Wide_Unbounded is
-- Do replace operation when removed slice is not empty
if High >= Low then
- DL := By'Length + SR.Last + Low - High - 1;
+ DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1;
+ -- This is the number of characters remaining in the string after
+ -- replacing the slice.
-- Result is empty string, reuse empty shared string
@@ -1416,7 +1418,9 @@ package body Ada.Strings.Wide_Wide_Unbounded is
-- Do replace operation only when replaced slice is not empty
if High >= Low then
- DL := By'Length + SR.Last + Low - High - 1;
+ DL := By'Length + SR.Last + Low - Integer'Min (High, SR.Last) - 1;
+ -- This is the number of characters remaining in the string after
+ -- replacing the slice.
-- Result is empty string, reuse empty shared string
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 40e3c9142ef..ead41e6c638 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -192,6 +192,7 @@ Implementation Defined Pragmas
* Pragma Source_File_Name::
* Pragma Source_File_Name_Project::
* Pragma Source_Reference::
+* Pragma Static_Elaboration_Desired::
* Pragma Stream_Convert::
* Pragma Style_Checks::
* Pragma Subtitle::
@@ -817,6 +818,7 @@ consideration, the use of these pragmas should be minimized.
* Pragma Source_File_Name::
* Pragma Source_File_Name_Project::
* Pragma Source_Reference::
+* Pragma Static_Elaboration_Desired::
* Pragma Stream_Convert::
* Pragma Style_Checks::
* Pragma Subtitle::
@@ -4597,6 +4599,31 @@ The second argument must be a string literal, it cannot be a static
string expression other than a string literal. This is because its value
is needed for error messages issued by all phases of the compiler.
+@node Pragma Static_Elaboration_Desired
+@unnumberedsec Pragma Static_Elaboration_Desired
+@findex Static_Elaboration_Desired
+@noindent
+Syntax:
+
+@smallexample @c ada
+pragma Static_Elaboration_Desired;
+@end smallexample
+
+@noindent
+This pragma is used to indicate the desire for objects declared in the library
+unit to which the pragma applies to be initialized statically. This means that
+if an object is initialized (either explicitly or by default initialization),
+then the object's value can be determined at compile time and it requires no
+code to initialize it. This generally allows the object to be allocated in
+read-only data space. A warning is issued if an object or aggregate declared
+at the top level of the package cannot be initialized statically. Additionally,
+use of this pragma will suppress the generation of loops to initialize named
+aggregates whose only choice is an others choice that specifies a component
+value known at compile time, so that it can be allocated as static data. This
+is limited to aggregates with a maximum of 100 components. (See also the
+restriction No_Implicit_Loops, which supports static allocation for larger
+aggregates.)
+
@node Pragma Stream_Convert
@unnumberedsec Pragma Stream_Convert
@findex Stream_Convert