1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1999-2013, 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 ------------------------------------------------------------------------------
26 with Err_Vars
; use Err_Vars
;
28 with Targparm
; use Targparm
;
29 package body Warnsw
is
31 ----------------------------
32 -- Set_Dot_Warning_Switch --
33 ----------------------------
35 function Set_Dot_Warning_Switch
(C
: Character) return Boolean is
39 Warn_On_Assertion_Failure
:= True;
42 Warn_On_Assertion_Failure
:= False;
45 Warn_On_Biased_Representation
:= True;
48 Warn_On_Biased_Representation
:= False;
51 Warn_On_Unrepped_Components
:= True;
54 Warn_On_Unrepped_Components
:= False;
57 if OpenVMS_On_Target
then
61 Warning_Doc_Switch
:= True;
64 if OpenVMS_On_Target
then
68 Warning_Doc_Switch
:= False;
71 Address_Clause_Overlay_Warnings
:= True;
72 Check_Unreferenced
:= True;
73 Check_Unreferenced_Formals
:= True;
75 Constant_Condition_Warnings
:= True;
76 Elab_Warnings
:= True;
77 Implementation_Unit_Warnings
:= True;
78 Ineffective_Inline_Warnings
:= True;
79 List_Inherited_Aspects
:= True;
81 if not OpenVMS_On_Target
then
82 Warning_Doc_Switch
:= True;
85 Warn_On_Ada_2005_Compatibility
:= True;
86 Warn_On_Ada_2012_Compatibility
:= True;
87 Warn_On_All_Unread_Out_Parameters
:= True;
88 Warn_On_Assertion_Failure
:= True;
89 Warn_On_Assumed_Low_Bound
:= True;
90 Warn_On_Atomic_Synchronization
:= True;
91 Warn_On_Bad_Fixed_Value
:= True;
92 Warn_On_Biased_Representation
:= True;
93 Warn_On_Constant
:= True;
94 Warn_On_Deleted_Code
:= True;
95 Warn_On_Dereference
:= True;
96 Warn_On_Export_Import
:= True;
97 Warn_On_Hiding
:= True;
98 Warn_On_Modified_Unread
:= True;
99 Warn_On_No_Value_Assigned
:= True;
100 Warn_On_Non_Local_Exception
:= True;
101 Warn_On_Object_Renames_Function
:= True;
102 Warn_On_Obsolescent_Feature
:= True;
103 Warn_On_Overlap
:= True;
104 Warn_On_Overridden_Size
:= True;
105 Warn_On_Parameter_Order
:= True;
106 Warn_On_Questionable_Missing_Parens
:= True;
107 Warn_On_Record_Holes
:= True;
108 Warn_On_Redundant_Constructs
:= True;
109 Warn_On_Reverse_Bit_Order
:= True;
110 Warn_On_Standard_Redefinition
:= True;
111 Warn_On_Suspicious_Contract
:= True;
112 Warn_On_Unchecked_Conversion
:= True;
113 Warn_On_Unordered_Enumeration_Type
:= True;
114 Warn_On_Unrecognized_Pragma
:= True;
115 Warn_On_Unrepped_Components
:= True;
116 Warn_On_Warnings_Off
:= True;
119 Set_GNAT_Mode_Warnings
;
122 Warn_On_Record_Holes
:= True;
125 Warn_On_Record_Holes
:= False;
128 Warn_On_Overlap
:= True;
131 Warn_On_Overlap
:= False;
134 Warn_On_Standard_Redefinition
:= True;
137 Warn_On_Standard_Redefinition
:= False;
140 List_Inherited_Aspects
:= True;
143 List_Inherited_Aspects
:= False;
146 Warn_On_Suspicious_Modulus_Value
:= True;
149 Warn_On_Suspicious_Modulus_Value
:= False;
152 Warn_On_Atomic_Synchronization
:= True;
155 Warn_On_Atomic_Synchronization
:= False;
158 Warn_On_All_Unread_Out_Parameters
:= True;
161 Warn_On_All_Unread_Out_Parameters
:= False;
164 Warn_On_Parameter_Order
:= True;
167 Warn_On_Parameter_Order
:= False;
170 Warn_On_Object_Renames_Function
:= True;
173 Warn_On_Object_Renames_Function
:= False;
176 Warn_On_Overridden_Size
:= True;
179 Warn_On_Overridden_Size
:= False;
182 Warn_On_Suspicious_Contract
:= True;
185 Warn_On_Suspicious_Contract
:= False;
188 Warn_On_Unordered_Enumeration_Type
:= True;
191 Warn_On_Unordered_Enumeration_Type
:= False;
194 Warn_On_Reverse_Bit_Order
:= True;
197 Warn_On_Reverse_Bit_Order
:= False;
200 Warn_On_Warnings_Off
:= True;
203 Warn_On_Warnings_Off
:= False;
206 Warn_On_Non_Local_Exception
:= True;
209 Warn_On_Non_Local_Exception
:= False;
210 No_Warn_On_Non_Local_Exception
:= True;
217 end Set_Dot_Warning_Switch
;
219 ----------------------------
220 -- Set_GNAT_Mode_Warnings --
221 ----------------------------
223 procedure Set_GNAT_Mode_Warnings
is
225 Address_Clause_Overlay_Warnings
:= True;
226 Check_Unreferenced
:= True;
227 Check_Unreferenced_Formals
:= True;
229 Constant_Condition_Warnings
:= True;
230 Elab_Warnings
:= False;
231 Implementation_Unit_Warnings
:= False;
232 Ineffective_Inline_Warnings
:= True;
233 List_Inherited_Aspects
:= False;
234 Warning_Doc_Switch
:= False;
235 Warn_On_Ada_2005_Compatibility
:= True;
236 Warn_On_Ada_2012_Compatibility
:= True;
237 Warn_On_All_Unread_Out_Parameters
:= False;
238 Warn_On_Assertion_Failure
:= True;
239 Warn_On_Assumed_Low_Bound
:= True;
240 Warn_On_Atomic_Synchronization
:= False;
241 Warn_On_Bad_Fixed_Value
:= True;
242 Warn_On_Biased_Representation
:= True;
243 Warn_On_Constant
:= True;
244 Warn_On_Deleted_Code
:= False;
245 Warn_On_Dereference
:= False;
246 Warn_On_Export_Import
:= True;
247 Warn_On_Hiding
:= False;
248 Warn_On_Modified_Unread
:= True;
249 Warn_On_No_Value_Assigned
:= True;
250 Warn_On_Non_Local_Exception
:= False;
251 Warn_On_Object_Renames_Function
:= True;
252 Warn_On_Obsolescent_Feature
:= True;
253 Warn_On_Overlap
:= True;
254 Warn_On_Overridden_Size
:= True;
255 Warn_On_Parameter_Order
:= True;
256 Warn_On_Questionable_Missing_Parens
:= True;
257 Warn_On_Record_Holes
:= False;
258 Warn_On_Redundant_Constructs
:= True;
259 Warn_On_Reverse_Bit_Order
:= False;
260 Warn_On_Suspicious_Contract
:= True;
261 Warn_On_Unchecked_Conversion
:= True;
262 Warn_On_Unordered_Enumeration_Type
:= False;
263 Warn_On_Unrecognized_Pragma
:= True;
264 Warn_On_Unrepped_Components
:= False;
265 Warn_On_Warnings_Off
:= False;
266 end Set_GNAT_Mode_Warnings
;
268 ------------------------
269 -- Set_Warning_Switch --
270 ------------------------
272 function Set_Warning_Switch
(C
: Character) return Boolean is
276 Check_Unreferenced
:= True;
277 Check_Unreferenced_Formals
:= True;
279 Constant_Condition_Warnings
:= True;
280 Implementation_Unit_Warnings
:= True;
281 Ineffective_Inline_Warnings
:= True;
282 Warn_On_Ada_2005_Compatibility
:= True;
283 Warn_On_Ada_2012_Compatibility
:= True;
284 Warn_On_Assertion_Failure
:= True;
285 Warn_On_Assumed_Low_Bound
:= True;
286 Warn_On_Bad_Fixed_Value
:= True;
287 Warn_On_Biased_Representation
:= True;
288 Warn_On_Constant
:= True;
289 Warn_On_Export_Import
:= True;
290 Warn_On_Modified_Unread
:= True;
291 Warn_On_No_Value_Assigned
:= True;
292 Warn_On_Non_Local_Exception
:= True;
293 Warn_On_Object_Renames_Function
:= True;
294 Warn_On_Obsolescent_Feature
:= True;
295 Warn_On_Overlap
:= True;
296 Warn_On_Parameter_Order
:= True;
297 Warn_On_Questionable_Missing_Parens
:= True;
298 Warn_On_Redundant_Constructs
:= True;
299 Warn_On_Reverse_Bit_Order
:= True;
300 Warn_On_Suspicious_Contract
:= True;
301 Warn_On_Unchecked_Conversion
:= True;
302 Warn_On_Unrecognized_Pragma
:= True;
303 Warn_On_Unrepped_Components
:= True;
306 Address_Clause_Overlay_Warnings
:= False;
307 Check_Unreferenced
:= False;
308 Check_Unreferenced_Formals
:= False;
309 Check_Withs
:= False;
310 Constant_Condition_Warnings
:= False;
311 Elab_Warnings
:= False;
312 Implementation_Unit_Warnings
:= False;
313 Ineffective_Inline_Warnings
:= False;
314 List_Inherited_Aspects
:= False;
315 Warning_Doc_Switch
:= False;
316 Warn_On_Ada_2005_Compatibility
:= False;
317 Warn_On_Ada_2012_Compatibility
:= False;
318 Warn_On_All_Unread_Out_Parameters
:= False;
319 Warn_On_Assertion_Failure
:= False;
320 Warn_On_Assumed_Low_Bound
:= False;
321 Warn_On_Bad_Fixed_Value
:= False;
322 Warn_On_Biased_Representation
:= False;
323 Warn_On_Constant
:= False;
324 Warn_On_Deleted_Code
:= False;
325 Warn_On_Dereference
:= False;
326 Warn_On_Export_Import
:= False;
327 Warn_On_Hiding
:= False;
328 Warn_On_Modified_Unread
:= False;
329 Warn_On_No_Value_Assigned
:= False;
330 Warn_On_Non_Local_Exception
:= False;
331 Warn_On_Object_Renames_Function
:= False;
332 Warn_On_Obsolescent_Feature
:= False;
333 Warn_On_Overlap
:= False;
334 Warn_On_Overridden_Size
:= False;
335 Warn_On_Parameter_Order
:= False;
336 Warn_On_Record_Holes
:= False;
337 Warn_On_Questionable_Missing_Parens
:= False;
338 Warn_On_Redundant_Constructs
:= False;
339 Warn_On_Reverse_Bit_Order
:= False;
340 Warn_On_Standard_Redefinition
:= False;
341 Warn_On_Suspicious_Contract
:= False;
342 Warn_On_Suspicious_Modulus_Value
:= False;
343 Warn_On_Unchecked_Conversion
:= False;
344 Warn_On_Unordered_Enumeration_Type
:= False;
345 Warn_On_Unrecognized_Pragma
:= False;
346 Warn_On_Unrepped_Components
:= False;
347 Warn_On_Warnings_Off
:= False;
349 No_Warn_On_Non_Local_Exception
:= True;
352 Warn_On_Bad_Fixed_Value
:= True;
355 Warn_On_Bad_Fixed_Value
:= False;
358 Constant_Condition_Warnings
:= True;
361 Constant_Condition_Warnings
:= False;
364 Warn_On_Dereference
:= True;
367 Warn_On_Dereference
:= False;
370 Warning_Mode
:= Treat_As_Error
;
373 Check_Unreferenced_Formals
:= True;
376 Check_Unreferenced_Formals
:= False;
379 Warn_On_Unrecognized_Pragma
:= True;
382 Warn_On_Unrecognized_Pragma
:= False;
385 Warn_On_Hiding
:= True;
388 Warn_On_Hiding
:= False;
391 Implementation_Unit_Warnings
:= True;
394 Implementation_Unit_Warnings
:= False;
397 Warn_On_Obsolescent_Feature
:= True;
400 Warn_On_Obsolescent_Feature
:= False;
403 Warn_On_Constant
:= True;
406 Warn_On_Constant
:= False;
409 Elab_Warnings
:= True;
412 Elab_Warnings
:= False;
415 Warn_On_Modified_Unread
:= True;
418 Warn_On_Modified_Unread
:= False;
421 Warning_Mode
:= Normal
;
424 Address_Clause_Overlay_Warnings
:= True;
427 Address_Clause_Overlay_Warnings
:= False;
430 Ineffective_Inline_Warnings
:= True;
433 Ineffective_Inline_Warnings
:= False;
436 Warn_On_Questionable_Missing_Parens
:= True;
439 Warn_On_Questionable_Missing_Parens
:= False;
442 Warn_On_Redundant_Constructs
:= True;
445 Warn_On_Redundant_Constructs
:= False;
448 Warning_Mode
:= Suppress
;
451 Warn_On_Deleted_Code
:= True;
454 Warn_On_Deleted_Code
:= False;
457 Check_Unreferenced
:= True;
459 Check_Unreferenced_Formals
:= True;
462 Check_Unreferenced
:= False;
463 Check_Withs
:= False;
464 Check_Unreferenced_Formals
:= False;
467 Warn_On_No_Value_Assigned
:= True;
470 Warn_On_No_Value_Assigned
:= False;
473 Warn_On_Assumed_Low_Bound
:= True;
476 Warn_On_Assumed_Low_Bound
:= False;
479 Warn_On_Export_Import
:= True;
482 Warn_On_Export_Import
:= False;
485 Warn_On_Ada_2005_Compatibility
:= True;
486 Warn_On_Ada_2012_Compatibility
:= True;
489 Warn_On_Ada_2005_Compatibility
:= False;
490 Warn_On_Ada_2012_Compatibility
:= False;
493 Warn_On_Unchecked_Conversion
:= True;
496 Warn_On_Unchecked_Conversion
:= False;
503 end Set_Warning_Switch
;