+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
-- 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
-- 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
-- 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
-- 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
-- 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
-- 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
* Pragma Source_File_Name::
* Pragma Source_File_Name_Project::
* Pragma Source_Reference::
+* Pragma Static_Elaboration_Desired::
* Pragma Stream_Convert::
* Pragma Style_Checks::
* Pragma Subtitle::
* Pragma Source_File_Name::
* Pragma Source_File_Name_Project::
* Pragma Source_Reference::
+* Pragma Static_Elaboration_Desired::
* Pragma Stream_Convert::
* Pragma Style_Checks::
* Pragma Subtitle::
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