1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2002 Free Software Foundation, Inc. --
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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
29 package body Validsw is
31 ----------------------------------
32 -- Reset_Validity_Check_Options --
33 ----------------------------------
35 procedure Reset_Validity_Check_Options is
37 Validity_Check_Copies := False;
38 Validity_Check_Default := True;
39 Validity_Check_Floating_Point := False;
40 Validity_Check_In_Out_Params := False;
41 Validity_Check_In_Params := False;
42 Validity_Check_Operands := False;
43 Validity_Check_Returns := False;
44 Validity_Check_Subscripts := False;
45 Validity_Check_Tests := False;
46 end Reset_Validity_Check_Options;
48 ---------------------------------
49 -- Save_Validity_Check_Options --
50 ---------------------------------
52 procedure Save_Validity_Check_Options
53 (Options : out Validity_Check_Options)
57 procedure Add (C : Character; S : Boolean);
58 -- Add given character C to string if switch S is true
60 procedure Add (C : Character; S : Boolean) is
68 -- Start of processing for Save_Validity_Check_Options
71 for K in Options'Range loop
75 Add ('n', not Validity_Check_Default);
77 Add ('c', Validity_Check_Copies);
78 Add ('f', Validity_Check_Floating_Point);
79 Add ('i', Validity_Check_In_Params);
80 Add ('m', Validity_Check_In_Out_Params);
81 Add ('o', Validity_Check_Operands);
82 Add ('r', Validity_Check_Returns);
83 Add ('s', Validity_Check_Subscripts);
84 Add ('t', Validity_Check_Tests);
85 end Save_Validity_Check_Options;
87 ----------------------------------------
88 -- Set_Default_Validity_Check_Options --
89 ----------------------------------------
91 procedure Set_Default_Validity_Check_Options is
93 Reset_Validity_Check_Options;
94 Set_Validity_Check_Options ("d");
95 end Set_Default_Validity_Check_Options;
97 --------------------------------
98 -- Set_Validity_Check_Options --
99 --------------------------------
101 -- Version used when no error checking is required
103 procedure Set_Validity_Check_Options (Options : String) is
108 Set_Validity_Check_Options (Options, OK, EC);
109 end Set_Validity_Check_Options;
111 -- Normal version with error checking
113 procedure Set_Validity_Check_Options
116 Err_Col : out Natural)
122 Reset_Validity_Check_Options;
125 while J <= Options'Last loop
129 -- Turn on validity checking (gets turned off by Vn)
131 Validity_Checks_On := True;
136 Validity_Check_Copies := True;
139 Validity_Check_Default := True;
142 Validity_Check_Floating_Point := True;
145 Validity_Check_In_Params := True;
148 Validity_Check_In_Out_Params := True;
151 Validity_Check_Operands := True;
154 Validity_Check_Returns := True;
157 Validity_Check_Subscripts := True;
160 Validity_Check_Tests := True;
163 Validity_Check_Copies := False;
166 Validity_Check_Default := False;
169 Validity_Check_In_Params := False;
172 Validity_Check_Floating_Point := False;
175 Validity_Check_In_Out_Params := False;
178 Validity_Check_Operands := False;
181 Validity_Check_Returns := False;
184 Validity_Check_Subscripts := False;
187 Validity_Check_Tests := False;
190 Validity_Check_Copies := True;
191 Validity_Check_Default := True;
192 Validity_Check_Floating_Point := True;
193 Validity_Check_In_Out_Params := True;
194 Validity_Check_In_Params := True;
195 Validity_Check_Operands := True;
196 Validity_Check_Returns := True;
197 Validity_Check_Subscripts := True;
198 Validity_Check_Tests := True;
201 Validity_Check_Copies := False;
202 Validity_Check_Default := False;
203 Validity_Check_Floating_Point := False;
204 Validity_Check_In_Out_Params := False;
205 Validity_Check_In_Params := False;
206 Validity_Check_Operands := False;
207 Validity_Check_Returns := False;
208 Validity_Check_Subscripts := False;
209 Validity_Check_Tests := False;
210 Validity_Checks_On := False;
223 Err_Col := Options'Last + 1;
224 end Set_Validity_Check_Options;