aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gnat_rm.texi
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2009-04-07 14:18:13 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-07 16:18:13 +0200
commitc27f2f15fde7c742e7b6fa996a7b35cf5e8c9f66 (patch)
treed65b03473be892ceb27cc44836f2954c06de5996 /gcc/ada/gnat_rm.texi
parentafb90d93a4a9a67c2ba19d6e7e571309cf743968 (diff)
downloadgcc-c27f2f15fde7c742e7b6fa996a7b35cf5e8c9f66.zip
gcc-c27f2f15fde7c742e7b6fa996a7b35cf5e8c9f66.tar.gz
gcc-c27f2f15fde7c742e7b6fa996a7b35cf5e8c9f66.tar.bz2
checks.adb: Remove Assume_Valid parameter from In_Subrange_Of calls
2009-04-07 Robert Dewar <dewar@adacore.com> * checks.adb: Remove Assume_Valid parameter from In_Subrange_Of calls * sem_eval.adb: (Is_Subrange_Of): Remove Assume_Valid parameter, not needed (Is_In_Range): Remove incorrect use of Assume_Valid (Is_Out_Of_Range): Remove incorrect use of Assume_Valid * sem_eval.ads: (Is_Subrange_Of): Remove Assume_Valid parameter, not needed (Is_In_Range): Documentation cleanup (Is_Out_Of_Range): Documentation cleanup * gnat_rm.texi: Add documentation for Assume_No_Invalid_Values pragma * sem_ch12.adb: Minor reformatting * sem_ch6.adb: (Check_Conformance): Avoid cascaded errors * sem_prag.adb: Improve error message. * gnatchop.adb, osint.ads, sinput.adb, sinput.ads, styleg.adb: LF/CR no longer recognized as line terminator * switch.ads: Minor documentation improvement * vms_data.ads: Minor reformatting From-SVN: r145675
Diffstat (limited to 'gcc/ada/gnat_rm.texi')
-rw-r--r--gcc/ada/gnat_rm.texi45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index a768528..b2aa662 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -102,6 +102,7 @@ Implementation Defined Pragmas
* Pragma Ada_2005::
* Pragma Annotate::
* Pragma Assert::
+* Pragma Assume_No_Invalid_Values::
* Pragma Ast_Entry::
* Pragma C_Pass_By_Copy::
* Pragma Check::
@@ -703,6 +704,7 @@ consideration, the use of these pragmas should be minimized.
* Pragma Ada_2005::
* Pragma Annotate::
* Pragma Assert::
+* Pragma Assume_No_Invalid_Values::
* Pragma Ast_Entry::
* Pragma C_Pass_By_Copy::
* Pragma Check::
@@ -996,6 +998,49 @@ effect on the program. However, the expressions are analyzed for
semantic correctness whether or not assertions are enabled, so turning
assertions on and off cannot affect the legality of a program.
+@node Pragma Assume_No_Invalid_Values
+@unnumberedsec Pragma Assume_No_Invalid_Values
+@findex Assume_No_Invalid_Values
+@cindex Invalid representations
+@cindex Invalid values
+@noindent
+Syntax:
+@smallexample @c ada
+pragma Assume_No_Invalid_Values (On | Off);
+@end smallexample
+
+@noindent
+This is a configuration pragma that controls the assumptions made by the
+compiler about the occurrence of invalid representations (invalid values)
+in the code.
+
+The default behavior (corresponding to an Off argument for this pragma), is
+to assume that values may in general be invalid unless the compiler can
+prove they are valid. Consider the following example:
+
+@smallexample @c ada
+V1 : Integer range 1 .. 10;
+V2 : Integer range 11 .. 20;
+...
+for J in V2 .. V1 loop
+ ...
+end loop;
+@end smallexample
+
+@noindent
+if V1 and V2 have valid values, then the loop is known at compile
+time not to execute since the lower bound must be greater than the
+upper bound. However in default mode, no such assumption is made,
+and the loop may execute. If @code{Assume_No_Invalid_Values (On)}
+is given, the compiler will assume that any occurrence of a variable
+other than in an explicit @code{'Valid} test always has a valid
+value, and the loop above will be optimized away.
+
+The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
+you know your code is free of uninitialized variables and other
+possible sources of invalid representations, and may result in
+more efficient code.
+
@node Pragma Ast_Entry
@unnumberedsec Pragma Ast_Entry
@cindex OpenVMS