1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
31 package body Validsw is
33 ----------------------------------
34 -- Reset_Validity_Check_Options --
35 ----------------------------------
37 procedure Reset_Validity_Check_Options is
39 Validity_Check_Copies := False;
40 Validity_Check_Default := True;
41 Validity_Check_Floating_Point := False;
42 Validity_Check_In_Out_Params := False;
43 Validity_Check_In_Params := False;
44 Validity_Check_Operands := False;
45 Validity_Check_Returns := False;
46 Validity_Check_Subscripts := False;
47 Validity_Check_Tests := False;
48 end Reset_Validity_Check_Options;
50 ---------------------------------
51 -- Save_Validity_Check_Options --
52 ---------------------------------
54 procedure Save_Validity_Check_Options
55 (Options : out Validity_Check_Options)
59 procedure Add (C : Character; S : Boolean);
60 -- Add given character C to string if switch S is true
62 procedure Add (C : Character; S : Boolean) is
70 -- Start of processing for Save_Validity_Check_Options
73 for K in Options'Range loop
77 Add ('c', Validity_Check_Copies);
78 Add ('d', Validity_Check_Default);
79 Add ('f', Validity_Check_Floating_Point);
80 Add ('i', Validity_Check_In_Params);
81 Add ('m', Validity_Check_In_Out_Params);
82 Add ('o', Validity_Check_Operands);
83 Add ('r', Validity_Check_Returns);
84 Add ('s', Validity_Check_Subscripts);
85 Add ('t', Validity_Check_Tests);
86 end Save_Validity_Check_Options;
88 ----------------------------------------
89 -- Set_Default_Validity_Check_Options --
90 ----------------------------------------
92 procedure Set_Default_Validity_Check_Options is
94 Reset_Validity_Check_Options;
95 Set_Validity_Check_Options ("d");
96 end Set_Default_Validity_Check_Options;
98 --------------------------------
99 -- Set_Validity_Check_Options --
100 --------------------------------
102 -- Version used when no error checking is required
104 procedure Set_Validity_Check_Options (Options : String) is
109 Set_Validity_Check_Options (Options, OK, EC);
110 end Set_Validity_Check_Options;
112 -- Normal version with error checking
114 procedure Set_Validity_Check_Options
117 Err_Col : out Natural)
123 Reset_Validity_Check_Options;
126 while J <= Options'Last loop
132 Validity_Check_Copies := True;
135 Validity_Check_Default := True;
138 Validity_Check_Floating_Point := True;
141 Validity_Check_In_Params := True;
144 Validity_Check_In_Out_Params := True;
147 Validity_Check_Operands := True;
150 Validity_Check_Returns := True;
153 Validity_Check_Subscripts := True;
156 Validity_Check_Tests := True;
159 Validity_Check_Copies := False;
162 Validity_Check_Default := False;
165 Validity_Check_In_Params := False;
168 Validity_Check_Floating_Point := False;
171 Validity_Check_In_Out_Params := False;
174 Validity_Check_Operands := False;
177 Validity_Check_Returns := False;
180 Validity_Check_Subscripts := False;
183 Validity_Check_Tests := False;
186 Validity_Check_Copies := True;
187 Validity_Check_Default := True;
188 Validity_Check_Floating_Point := True;
189 Validity_Check_In_Out_Params := True;
190 Validity_Check_In_Params := True;
191 Validity_Check_Operands := True;
192 Validity_Check_Returns := True;
193 Validity_Check_Subscripts := True;
194 Validity_Check_Tests := True;
197 Validity_Check_Copies := False;
198 Validity_Check_Default := False;
199 Validity_Check_Floating_Point := False;
200 Validity_Check_In_Out_Params := False;
201 Validity_Check_In_Params := False;
202 Validity_Check_Operands := False;
203 Validity_Check_Returns := False;
204 Validity_Check_Subscripts := False;
205 Validity_Check_Tests := False;
217 Validity_Checks_On := True;
219 Err_Col := Options'Last + 1;
220 end Set_Validity_Check_Options;