home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
gnat-2.06-src.tgz
/
tar.out
/
fsf
/
gnat
/
ada
/
checks.ads
< prev
next >
Wrap
Text File
|
1996-09-28
|
6KB
|
119 lines
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- C H E C K S --
-- --
-- S p e c --
-- --
-- $Revision: 1.2 $ --
-- --
-- Copyright (c) 1992,1993,1994,1995 NYU, All Rights Reserved --
-- --
-- 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- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
-- Package containing routines used to deal with runtime 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.
with Types; use Types;
package Checks is
function Access_Checks_Suppressed (E : Entity_Id) return Boolean;
function Accessibility_Checks_Suppressed (E : Entity_Id) return Boolean;
function Discriminant_Checks_Suppressed (E : Entity_Id) return Boolean;
function Division_Checks_Suppressed (E : Entity_Id) return Boolean;
function Elaboration_Checks_Suppressed (E : Entity_Id) return Boolean;
function Index_Checks_Suppressed (E : Entity_Id) return Boolean;
function Length_Checks_Suppressed (E : Entity_Id) return Boolean;
function Overflow_Checks_Suppressed (E : Entity_Id) return Boolean;
function Range_Checks_Suppressed (E : Entity_Id) return Boolean;
function Storage_Checks_Suppressed (E : Entity_Id) return Boolean;
function Tag_Checks_Suppressed (E : Entity_Id) return Boolean;
-- These functions check to see if the named check is suppressed,
-- either by an active scope suppress setting, or because the check
-- has been specifically suppressed for the given entity. If no entity
-- is relevant for the current check, then Empty is used as an argument.
-- Note: the reason we insist on specifying Empty is to force the
-- caller to think about whether there is any relevant entity that
-- should be checked.
procedure Apply_Access_Check (N : Node_Id; Typ : Entity_Id);
-- Determines whether an expression node should be flagged as needing
-- a runtime access check. If the node requires such a check, the
-- Do_Access_Check flag is turned on.
procedure Apply_Arithmetic_Overflow_Check (N : Node_Id);
-- Given a binary arithmetic operator (+ - * /) expand a software integer
-- overflow check using range checks on a larger checking type or a call
-- to an appropriate runtime routine.
procedure Apply_Discriminant_Check (N : Node_Id; Typ : Entity_Id);
-- Determines whether an expression node should be flagged as needing
-- a runtime discriminant check. If the node requires such a check,
-- the Do_Discriminant_Check flag is turned on.
procedure Apply_Length_Check (Expr : Node_Id; Typ : Entity_Id);
-- Expr is an expression of array type, and Typ is a constrained array
-- type. This procedure builds a sequence of declarations and statements
-- which can be executed to perform a length check on the expression.
-- The resulting actions are inserted at Expr tree using Insert_Actions.
procedure Apply_Range_Check
(N : Node_Id;
Source_Type : Entity_Id;
Target_Type : Entity_Id);
-- Determines whether an expression node should be flagged as needing
-- a runtime range check. If the node requires such a check, the
-- Do_Range_Check flag is turned on.
procedure Apply_Slice_Range_Check
(N : Node_Id;
Source_Type : Entity_Id;
Target_Type : Entity_Id);
-- Determines whether an range node should be flagged as needing
-- a runtime range check. If the node requires such a check, the
-- Do_Range_Check flag is turned on. This requires special handling
-- because of null slices.
procedure Apply_Static_Length_Check
(N : Node_Id;
Source_Type : Entity_Id;
Target_Type : Entity_Id);
-- Tries to determine statically whether array types Source_Type and
-- Target_Type have the same length. If it can be determined at compile
-- time that they do not, then an N_Raise_Constraint_Error node replaces
-- N and a warning message is emitted.
procedure Apply_Subscript_Conversion_Checks (N : Node_Id);
-- Add necessary type conversions to the subscripts of formal parameters
-- that are unconstrained arrays or access to them and also for subscripts
-- of packed arrays to enforce index checks.
private
pragma Inline (Access_Checks_Suppressed);
pragma Inline (Accessibility_Checks_Suppressed);
pragma Inline (Discriminant_Checks_Suppressed);
pragma Inline (Division_Checks_Suppressed);
pragma Inline (Elaboration_Checks_Suppressed);
pragma Inline (Index_Checks_Suppressed);
pragma Inline (Length_Checks_Suppressed);
pragma Inline (Overflow_Checks_Suppressed);
pragma Inline (Range_Checks_Suppressed);
pragma Inline (Storage_Checks_Suppressed);
pragma Inline (Tag_Checks_Suppressed);
end Checks;