* config/mips/mips.c (function_arg): Where one part of a
[official-gcc.git] / gcc / ada / validsw.ads
bloba2d0a189b38b79ff85b49feef1add1768bd329b1
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- V A L I D S W --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This unit contains the routines used to handle setting of validity
28 -- checking options.
30 package Validsw is
32 -----------------------------
33 -- Validity Check Switches --
34 -----------------------------
36 -- The following flags determine the specific set of validity checks
37 -- to be made if validity checking is active (Validity_Checks_On = True)
39 -- See GNAT users guide for an exact description of each option. The letter
40 -- given in the comment is the letter used in the -gnatV compiler switch
41 -- or in the argument of a Validity_Checks pragma to activate the option.
42 -- The corresponding upper case letter deactivates the option.
44 Validity_Check_Copies : Boolean := False;
45 -- Controls the validity checking of copies. If this switch is set to
46 -- true using -gnatVc, or a 'c' in the argument of a Validity_Checks
47 -- pragma, then the right side of assignments and also initializing
48 -- expressions in object declarations are checked for validity.
50 Validity_Check_Default : Boolean := True;
51 -- Controls default (reference manual) validity checking. If this switch is
52 -- set to True using -gnatVd or a 'd' in the argument of a Validity_ Checks
53 -- pragma (or the initial default value is used, set True), then left side
54 -- subscripts and case statement arguments are checked for validity. This
55 -- switch is also set by default if no -gnatV switch is used and no
56 -- Validity_Checks pragma is processed.
58 Validity_Check_Floating_Point : Boolean := False;
59 -- Normally validity checking applies only to discrete values (integer
60 -- and enumeration types). If this switch is set to True using -gnatVf
61 -- or an 'f' in the argument of a Validity_Checks pragma, then floating-
62 -- point values are also checked. The context in which such checks
63 -- occur depends on other flags, e.g. if Validity_Check_Copies is also
64 -- set then floating-point values on the right side of an assignment
65 -- will be validity checked.
67 Validity_Check_In_Out_Params : Boolean := False;
68 -- Controls the validity checking of IN OUT parameters. If this switch
69 -- is set to True using -gnatVm or a 'm' in the argument of a pragma
70 -- Validity_Checks, then the initial value of all IN OUT parameters
71 -- will be checked at the point of call of a procecure. Note that the
72 -- character 'm' here stands for modified (parameters).
74 Validity_Check_In_Params : Boolean := False;
75 -- Controls the validity checking of IN parameters. If this switch is
76 -- set to True using -gnatVm or an 'i' in the argument of a pragma
77 -- Validity_Checks, then the initial value of all IN parameters
78 -- will be checked at the point of call of a procecure or function.
80 Validity_Check_Operands : Boolean := False;
81 -- Controls validity checking of operands. If this switch is set to
82 -- True using -gnatVo or an 'o' in the argument of a Validity_Checks
83 -- pragma, then operands of all predefined operators and attributes
84 -- will be validity checked.
86 Validity_Check_Parameters : Boolean := False;
87 -- This controls validity treatment for parameters within a subprogram.
88 -- Normally if validity checking is enabled for parameters on a call
89 -- (Validity_Check_In[_Out]_Params) then an assumption is made that the
90 -- parameter values are valid on entry and not checked again within a
91 -- procedure. Setting Validity_Check_Parameters removes this assumption
92 -- and ensures that no assumptions are made about parameters, so that
93 -- they will always be checked.
95 Validity_Check_Returns : Boolean := False;
96 -- Controls validity checking of returned values. If this switch is set
97 -- to True using -gnatVr, or an 'r' in the argument of a Validity_Checks
98 -- pragma, then the expression in a RETURN statement is validity checked.
100 Validity_Check_Subscripts : Boolean := False;
101 -- Controls validity checking of subscripts. If this switch is set to
102 -- True using -gnatVs, or an 's' in the argument of a Validity_Checks
103 -- pragma, then all subscripts are checked for validity. Note that left
104 -- side subscript checking is controlled also by Validity_Check_Default.
105 -- If Validity_Check_Subscripts is True, then all subscripts are checked,
106 -- otherwise if Validity_Check_Default is True, then left side subscripts
107 -- are checked, otherwise no subscripts are checked.
109 Validity_Check_Tests : Boolean := False;
110 -- Controls validity checking of tests that occur in conditions (i.e. the
111 -- tests in IF, WHILE, and EXIT statements, and in entry guards). If this
112 -- switch is set to True using -gnatVt, or a 't' in the argument of a
113 -- Validity_Checks pragma, then all such conditions are validity checked.
115 Force_Validity_Checks : Boolean := False;
116 -- Normally, operands that do not come from source (i.e. cases of expander
117 -- generated code) are not checked, if this flag is set True, then checking
118 -- of such operands is forced (if Validity_Check_Operands is set).
120 -----------------
121 -- Subprograms --
122 -----------------
124 procedure Set_Default_Validity_Check_Options;
125 -- This procedure is called to set the default validity checking options
126 -- that apply if no Validity_Check switches or pragma is given.
128 procedure Set_Validity_Check_Options
129 (Options : String;
130 OK : out Boolean;
131 Err_Col : out Natural);
132 -- This procedure is called to set the validity check options that
133 -- correspond to the characters in the given Options string. If
134 -- all options are valid, then Set_Default_Validity_Check_Options
135 -- is first called to set the defaults, and then the options in the
136 -- given string are set in an additive manner. If any invalid character
137 -- is found, then OK is False on exit, and Err_Col is the index in
138 -- in options of the bad character. If all options are valid, then
139 -- OK is True on return, and Err_Col is set to options'Last + 1.
141 procedure Set_Validity_Check_Options (Options : String);
142 -- Like the above procedure, except that the call is simply ignored if
143 -- there are any error conditions, this is for example appopriate for
144 -- calls where the string is known to be valid, e.g. because it was
145 -- obtained by Save_Validity_Check_Options.
147 procedure Reset_Validity_Check_Options;
148 -- Sets all validity check options to off
150 subtype Validity_Check_Options is String (1 .. 16);
151 -- Long enough string to hold all options from Save call below
153 procedure Save_Validity_Check_Options
154 (Options : out Validity_Check_Options);
155 -- Sets Options to represent current selection of options. This
156 -- set can be restored by first calling Reset_Validity_Check_Options,
157 -- and then calling Set_Validity_Check_Options with the Options string.
159 end Validsw;