[Ada] Update the documentation in checks.ads about range checks

2020-06-04  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* checks.ads: Update documentation about range checks and fix
	minor other things.
This commit is contained in:
Eric Botcazou 2020-01-23 16:40:14 +01:00 committed by Pierre-Marie de Rodat
parent d46b330ddc
commit 51bc44b84a

View File

@ -23,10 +23,10 @@
-- --
------------------------------------------------------------------------------
-- Package containing routines used to deal with runtime checks. These
-- Package containing routines used to deal with run-time checks. These
-- routines are used both by the semantics and by the expander. In some
-- cases, checks are enabled simply by setting flags for gigi, and in
-- other cases the code for the check is expanded.
-- cases, checks are enabled simply by setting a flag for the back end,
-- and in other cases the code for the check is expanded.
-- The approach used for range and length checks, in regards to suppressed
-- checks, is to attempt to detect at compilation time that a constraint
@ -179,7 +179,7 @@ package Checks is
-- operate anyway since they may generate useful compile time warnings.
procedure Apply_Access_Check (N : Node_Id);
-- Determines whether an expression node requires a runtime access
-- Determines whether an expression node requires a run-time access
-- check and if so inserts the appropriate run-time check.
procedure Apply_Accessibility_Check
@ -200,7 +200,7 @@ package Checks is
-- generated) is prepended to the Actions list of N_Freeze_Entity node N.
-- Note that the check references E'Alignment, so it cannot be emitted
-- before N (its freeze node), otherwise this would cause an illegal
-- access before elaboration error in GIGI. For the case of a clear overlay
-- access before elaboration error in gigi. For the case of a clear overlay
-- situation, we also check that the size of the overlaying object is not
-- larger than the overlaid object.
@ -339,7 +339,7 @@ package Checks is
-- value should be taken into account, which is not the case currently.
procedure Install_Null_Excluding_Check (N : Node_Id);
-- Determines whether an access node requires a runtime access check and
-- Determines whether an access node requires a run-time access check and
-- if so inserts the appropriate run-time check.
procedure Install_Primitive_Elaboration_Check (Subp_Body : Node_Id);
@ -445,13 +445,10 @@ package Checks is
-------------------------------------------------------
-- Range checks are controlled by the Do_Range_Check flag. The front end
-- is responsible for setting this flag in relevant nodes. Originally
-- the back end generated all corresponding range checks. But later on
-- we decided to generate many range checks in the front end. We are now
-- in the transitional phase where some of these checks are still done
-- by the back end, but many are done by the front end. It is possible
-- that in the future we might move all the checks to the front end. The
-- main remaining back end checks are for subscript checking.
-- is responsible for setting this flag in relevant nodes. Originally the
-- back end generated all the corresponding range checks, but later on we
-- decided to generate all the range checks in the front end and this is
-- the current situation.
-- Overflow checks are similarly controlled by the Do_Overflow_Check flag.
-- The difference here is that if back end overflow checks are inactive
@ -621,7 +618,7 @@ package Checks is
Source_Typ : Entity_Id := Empty;
Fixed_Int : Boolean := False);
-- For scalar types, determines whether an expression node should be
-- flagged as needing a runtime range check. If the node requires such a
-- flagged as needing a run-time range check. If the node requires such a
-- check, the Do_Range_Check flag is turned on. The Fixed_Int flag if set
-- causes any fixed-point values to be treated as though they were discrete
-- values (i.e. the underlying integer value is used).
@ -678,17 +675,12 @@ package Checks is
-----------------------
-- Some of the earlier processing for checks results in temporarily setting
-- the Do_Range_Check flag rather than actually generating checks. Now we
-- are moving the generation of such checks into the front end for reasons
-- of efficiency and simplicity (there were difficulties in handling this
-- in the back end when side effects were present in the expressions being
-- checked).
-- Probably we could eliminate the Do_Range_Check flag entirely and
-- generate the checks earlier, but this is a delicate area and it
-- seemed safer to implement the following routines, which are called
-- late on in the expansion process. They check the Do_Range_Check flag
-- and if it is set, generate the actual checks and reset the flag.
-- the Do_Range_Check flag rather than actually generating checks. Probably
-- we could eliminate the Do_Range_Check flag entirely and generate checks
-- earlier, but this is a delicate area and it seems safer to implement the
-- following routines, which are called later on in the expansion process.
-- They check the Do_Range_Check flag and if it is set, generate the actual
-- checks and reset the flag.
procedure Generate_Range_Check
(N : Node_Id;