1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1999-2010, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
28 package body Warnsw is
30 ----------------------------
31 -- Set_Dot_Warning_Switch --
32 ----------------------------
34 function Set_Dot_Warning_Switch (C : Character) return Boolean is
38 Warn_On_Assertion_Failure := True;
41 Warn_On_Assertion_Failure := False;
44 Warn_On_Biased_Representation := True;
47 Warn_On_Biased_Representation := False;
50 Warn_On_Unrepped_Components := True;
53 Warn_On_Unrepped_Components := False;
56 Address_Clause_Overlay_Warnings := True;
57 Check_Unreferenced := True;
58 Check_Unreferenced_Formals := True;
60 Constant_Condition_Warnings := True;
61 Elab_Warnings := True;
62 Implementation_Unit_Warnings := True;
63 Ineffective_Inline_Warnings := True;
64 List_Inherited_Aspects := True;
65 Warn_On_Ada_2005_Compatibility := True;
66 Warn_On_Ada_2012_Compatibility := True;
67 Warn_On_All_Unread_Out_Parameters := True;
68 Warn_On_Assertion_Failure := True;
69 Warn_On_Assumed_Low_Bound := True;
70 Warn_On_Bad_Fixed_Value := True;
71 Warn_On_Biased_Representation := True;
72 Warn_On_Constant := True;
73 Warn_On_Deleted_Code := True;
74 Warn_On_Dereference := True;
75 Warn_On_Export_Import := True;
76 Warn_On_Hiding := True;
77 Warn_On_Modified_Unread := True;
78 Warn_On_No_Value_Assigned := True;
79 Warn_On_Non_Local_Exception := True;
80 Warn_On_Object_Renames_Function := True;
81 Warn_On_Obsolescent_Feature := True;
82 Warn_On_Overlap := True;
83 Warn_On_Overridden_Size := True;
84 Warn_On_Parameter_Order := True;
85 Warn_On_Questionable_Missing_Parens := True;
86 Warn_On_Record_Holes := True;
87 Warn_On_Redundant_Constructs := True;
88 Warn_On_Reverse_Bit_Order := True;
89 Warn_On_Unchecked_Conversion := True;
90 Warn_On_Unordered_Enumeration_Type := True;
91 Warn_On_Unrecognized_Pragma := True;
92 Warn_On_Unrepped_Components := True;
93 Warn_On_Warnings_Off := True;
96 Set_GNAT_Mode_Warnings;
99 Warn_On_Record_Holes := True;
102 Warn_On_Record_Holes := False;
105 Warn_On_Overlap := True;
108 Warn_On_Overlap := False;
111 List_Inherited_Aspects := True;
114 List_Inherited_Aspects := False;
117 Warn_On_Suspicious_Modulus_Value := True;
120 Warn_On_Suspicious_Modulus_Value := False;
123 Warn_On_All_Unread_Out_Parameters := True;
126 Warn_On_All_Unread_Out_Parameters := False;
129 Warn_On_Parameter_Order := True;
132 Warn_On_Parameter_Order := False;
135 Warn_On_Object_Renames_Function := True;
138 Warn_On_Object_Renames_Function := False;
141 Warn_On_Overridden_Size := True;
144 Warn_On_Overridden_Size := False;
147 Warn_On_Unordered_Enumeration_Type := True;
150 Warn_On_Unordered_Enumeration_Type := False;
153 Warn_On_Reverse_Bit_Order := True;
156 Warn_On_Reverse_Bit_Order := False;
159 Warn_On_Warnings_Off := True;
162 Warn_On_Warnings_Off := False;
165 Warn_On_Non_Local_Exception := True;
168 Warn_On_Non_Local_Exception := False;
169 No_Warn_On_Non_Local_Exception := True;
176 end Set_Dot_Warning_Switch;
178 ----------------------------
179 -- Set_GNAT_Mode_Warnings --
180 ----------------------------
182 procedure Set_GNAT_Mode_Warnings is
184 Address_Clause_Overlay_Warnings := True;
185 Check_Unreferenced := True;
186 Check_Unreferenced_Formals := True;
188 Constant_Condition_Warnings := True;
189 Elab_Warnings := False;
190 Implementation_Unit_Warnings := False;
191 Ineffective_Inline_Warnings := True;
192 List_Inherited_Aspects := False;
193 Warn_On_Ada_2005_Compatibility := True;
194 Warn_On_Ada_2012_Compatibility := True;
195 Warn_On_All_Unread_Out_Parameters := False;
196 Warn_On_Assertion_Failure := True;
197 Warn_On_Assumed_Low_Bound := True;
198 Warn_On_Bad_Fixed_Value := True;
199 Warn_On_Biased_Representation := True;
200 Warn_On_Constant := True;
201 Warn_On_Deleted_Code := False;
202 Warn_On_Dereference := False;
203 Warn_On_Export_Import := True;
204 Warn_On_Hiding := False;
205 Warn_On_Modified_Unread := True;
206 Warn_On_No_Value_Assigned := True;
207 Warn_On_Non_Local_Exception := False;
208 Warn_On_Object_Renames_Function := False;
209 Warn_On_Obsolescent_Feature := True;
210 Warn_On_Questionable_Missing_Parens := True;
211 Warn_On_Redundant_Constructs := True;
212 Warn_On_Reverse_Bit_Order := False;
213 Warn_On_Object_Renames_Function := True;
214 Warn_On_Unchecked_Conversion := True;
215 Warn_On_Unordered_Enumeration_Type := False;
216 Warn_On_Unrecognized_Pragma := True;
217 Warn_On_Unrepped_Components := False;
218 Warn_On_Warnings_Off := False;
219 end Set_GNAT_Mode_Warnings;
221 ------------------------
222 -- Set_Warning_Switch --
223 ------------------------
225 function Set_Warning_Switch (C : Character) return Boolean is
229 Check_Unreferenced := True;
230 Check_Unreferenced_Formals := True;
232 Constant_Condition_Warnings := True;
233 Implementation_Unit_Warnings := True;
234 Ineffective_Inline_Warnings := True;
235 List_Inherited_Aspects := True;
236 Warn_On_Ada_2005_Compatibility := True;
237 Warn_On_Ada_2012_Compatibility := True;
238 Warn_On_Assertion_Failure := True;
239 Warn_On_Assumed_Low_Bound := True;
240 Warn_On_Bad_Fixed_Value := True;
241 Warn_On_Biased_Representation := True;
242 Warn_On_Constant := True;
243 Warn_On_Export_Import := True;
244 Warn_On_Modified_Unread := True;
245 Warn_On_No_Value_Assigned := True;
246 Warn_On_Non_Local_Exception := True;
247 Warn_On_Object_Renames_Function := True;
248 Warn_On_Obsolescent_Feature := True;
249 Warn_On_Parameter_Order := True;
250 Warn_On_Questionable_Missing_Parens := True;
251 Warn_On_Redundant_Constructs := True;
252 Warn_On_Reverse_Bit_Order := True;
253 Warn_On_Unchecked_Conversion := True;
254 Warn_On_Unrecognized_Pragma := True;
255 Warn_On_Unrepped_Components := True;
258 Address_Clause_Overlay_Warnings := False;
259 Check_Unreferenced := False;
260 Check_Unreferenced_Formals := False;
261 Check_Withs := False;
262 Constant_Condition_Warnings := False;
263 Elab_Warnings := False;
264 Implementation_Unit_Warnings := False;
265 Ineffective_Inline_Warnings := False;
266 List_Inherited_Aspects := False;
267 Warn_On_Ada_2005_Compatibility := False;
268 Warn_On_Ada_2012_Compatibility := False;
269 Warn_On_All_Unread_Out_Parameters := False;
270 Warn_On_Assertion_Failure := False;
271 Warn_On_Assumed_Low_Bound := False;
272 Warn_On_Bad_Fixed_Value := False;
273 Warn_On_Biased_Representation := False;
274 Warn_On_Constant := False;
275 Warn_On_Deleted_Code := False;
276 Warn_On_Dereference := False;
277 Warn_On_Export_Import := False;
278 Warn_On_Hiding := False;
279 Warn_On_Modified_Unread := False;
280 Warn_On_No_Value_Assigned := False;
281 Warn_On_Non_Local_Exception := False;
282 Warn_On_Object_Renames_Function := False;
283 Warn_On_Obsolescent_Feature := False;
284 Warn_On_Overlap := False;
285 Warn_On_Overridden_Size := False;
286 Warn_On_Parameter_Order := False;
287 Warn_On_Record_Holes := False;
288 Warn_On_Questionable_Missing_Parens := False;
289 Warn_On_Redundant_Constructs := False;
290 Warn_On_Reverse_Bit_Order := False;
291 Warn_On_Unchecked_Conversion := False;
292 Warn_On_Unordered_Enumeration_Type := False;
293 Warn_On_Unrecognized_Pragma := False;
294 Warn_On_Unrepped_Components := False;
295 Warn_On_Warnings_Off := False;
297 No_Warn_On_Non_Local_Exception := True;
300 Warn_On_Bad_Fixed_Value := True;
303 Warn_On_Bad_Fixed_Value := False;
306 Constant_Condition_Warnings := True;
309 Constant_Condition_Warnings := False;
312 Warn_On_Dereference := True;
315 Warn_On_Dereference := False;
318 Warning_Mode := Treat_As_Error;
321 Check_Unreferenced_Formals := True;
324 Check_Unreferenced_Formals := False;
327 Warn_On_Unrecognized_Pragma := True;
330 Warn_On_Unrecognized_Pragma := False;
333 Warn_On_Hiding := True;
336 Warn_On_Hiding := False;
339 Implementation_Unit_Warnings := True;
342 Implementation_Unit_Warnings := False;
345 Warn_On_Obsolescent_Feature := True;
348 Warn_On_Obsolescent_Feature := False;
351 Warn_On_Constant := True;
354 Warn_On_Constant := False;
357 Elab_Warnings := True;
360 Elab_Warnings := False;
363 Warn_On_Modified_Unread := True;
366 Warn_On_Modified_Unread := False;
369 Warning_Mode := Normal;
372 Address_Clause_Overlay_Warnings := True;
375 Address_Clause_Overlay_Warnings := False;
378 Ineffective_Inline_Warnings := True;
381 Ineffective_Inline_Warnings := False;
384 Warn_On_Questionable_Missing_Parens := True;
387 Warn_On_Questionable_Missing_Parens := False;
390 Warn_On_Redundant_Constructs := True;
393 Warn_On_Redundant_Constructs := False;
396 Warning_Mode := Suppress;
399 Warn_On_Deleted_Code := True;
402 Warn_On_Deleted_Code := False;
405 Check_Unreferenced := True;
407 Check_Unreferenced_Formals := True;
410 Check_Unreferenced := False;
411 Check_Withs := False;
412 Check_Unreferenced_Formals := False;
415 Warn_On_No_Value_Assigned := True;
418 Warn_On_No_Value_Assigned := False;
421 Warn_On_Assumed_Low_Bound := True;
424 Warn_On_Assumed_Low_Bound := False;
427 Warn_On_Export_Import := True;
430 Warn_On_Export_Import := False;
433 Warn_On_Ada_2005_Compatibility := True;
434 Warn_On_Ada_2012_Compatibility := True;
437 Warn_On_Ada_2005_Compatibility := False;
438 Warn_On_Ada_2012_Compatibility := False;
441 Warn_On_Unchecked_Conversion := True;
444 Warn_On_Unchecked_Conversion := False;
451 end Set_Warning_Switch;