111
|
1 ------------------------------------------------------------------------------
|
|
2 -- --
|
|
3 -- GNAT COMPILER COMPONENTS --
|
|
4 -- --
|
|
5 -- W A R N S W --
|
|
6 -- --
|
|
7 -- B o d y --
|
|
8 -- --
|
145
|
9 -- Copyright (C) 1999-2019, Free Software Foundation, Inc. --
|
111
|
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 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. --
|
|
20 -- --
|
|
21 -- GNAT was originally developed by the GNAT team at New York University. --
|
|
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
23 -- --
|
|
24 ------------------------------------------------------------------------------
|
|
25
|
|
26 with Err_Vars; use Err_Vars;
|
|
27 with Opt; use Opt;
|
|
28 with Output; use Output;
|
|
29
|
|
30 package body Warnsw is
|
|
31
|
|
32 -- Local Subprograms
|
|
33
|
|
34 procedure All_Warnings (Setting : Boolean);
|
|
35 -- Sets all warnings off if Setting = False, and on if Setting = True
|
|
36
|
|
37 procedure WA_Warnings;
|
|
38 -- Turn on all warnings set by -gnatwa (also used by -gnatw.g)
|
|
39
|
|
40 ------------------
|
|
41 -- All_Warnings --
|
|
42 ------------------
|
|
43
|
|
44 procedure All_Warnings (Setting : Boolean) is
|
|
45 begin
|
145
|
46 Address_Clause_Overlay_Warnings := Setting;
|
|
47 Check_Unreferenced := Setting;
|
|
48 Check_Unreferenced_Formals := Setting;
|
|
49 Check_Withs := Setting;
|
|
50 Constant_Condition_Warnings := Setting;
|
|
51 Elab_Warnings := Setting;
|
|
52 Implementation_Unit_Warnings := Setting;
|
|
53 Ineffective_Inline_Warnings := Setting;
|
|
54 List_Body_Required_Info := Setting;
|
|
55 List_Inherited_Aspects := Setting;
|
|
56 Warn_On_Ada_2005_Compatibility := Setting;
|
|
57 Warn_On_Ada_2012_Compatibility := Setting;
|
|
58 Warn_On_All_Unread_Out_Parameters := Setting;
|
|
59 Warn_On_Anonymous_Allocators := Setting;
|
|
60 Warn_On_Assertion_Failure := Setting;
|
|
61 Warn_On_Assumed_Low_Bound := Setting;
|
|
62 Warn_On_Atomic_Synchronization := Setting;
|
|
63 Warn_On_Bad_Fixed_Value := Setting;
|
|
64 Warn_On_Biased_Representation := Setting;
|
|
65 Warn_On_Constant := Setting;
|
|
66 Warn_On_Deleted_Code := Setting;
|
|
67 Warn_On_Dereference := Setting;
|
|
68 Warn_On_Export_Import := Setting;
|
|
69 Warn_On_Hiding := Setting;
|
|
70 Warn_On_Late_Primitives := Setting;
|
|
71 Warn_On_Modified_Unread := Setting;
|
|
72 Warn_On_No_Value_Assigned := Setting;
|
|
73 Warn_On_Non_Local_Exception := Setting;
|
|
74 Warn_On_Object_Renames_Function := Setting;
|
|
75 Warn_On_Obsolescent_Feature := Setting;
|
|
76 Warn_On_Overlap := Setting;
|
|
77 Warn_On_Overridden_Size := Setting;
|
|
78 Warn_On_Parameter_Order := Setting;
|
|
79 Warn_On_Questionable_Layout := Setting;
|
|
80 Warn_On_Questionable_Missing_Parens := Setting;
|
|
81 Warn_On_Record_Holes := Setting;
|
|
82 Warn_On_Component_Order := Setting;
|
|
83 Warn_On_Redundant_Constructs := Setting;
|
|
84 Warn_On_Reverse_Bit_Order := Setting;
|
|
85 Warn_On_Size_Alignment := Setting;
|
|
86 Warn_On_Standard_Redefinition := Setting;
|
|
87 Warn_On_Suspicious_Contract := Setting;
|
|
88 Warn_On_Suspicious_Modulus_Value := Setting;
|
|
89 Warn_On_Unchecked_Conversion := Setting;
|
|
90 Warn_On_Unknown_Compile_Time_Warning := Setting;
|
|
91 Warn_On_Unordered_Enumeration_Type := Setting;
|
|
92 Warn_On_Unrecognized_Pragma := Setting;
|
|
93 Warn_On_Unrepped_Components := Setting;
|
|
94 Warn_On_Warnings_Off := Setting;
|
111
|
95 end All_Warnings;
|
|
96
|
|
97 ----------------------
|
|
98 -- Restore_Warnings --
|
|
99 ----------------------
|
|
100
|
|
101 procedure Restore_Warnings (W : Warning_Record) is
|
|
102 begin
|
145
|
103 Address_Clause_Overlay_Warnings :=
|
111
|
104 W.Address_Clause_Overlay_Warnings;
|
145
|
105 Check_Unreferenced :=
|
111
|
106 W.Check_Unreferenced;
|
145
|
107 Check_Unreferenced_Formals :=
|
111
|
108 W.Check_Unreferenced_Formals;
|
145
|
109 Check_Withs :=
|
111
|
110 W.Check_Withs;
|
145
|
111 Constant_Condition_Warnings :=
|
111
|
112 W.Constant_Condition_Warnings;
|
145
|
113 Elab_Warnings :=
|
111
|
114 W.Elab_Warnings;
|
145
|
115 Elab_Info_Messages :=
|
111
|
116 W.Elab_Info_Messages;
|
145
|
117 Implementation_Unit_Warnings :=
|
111
|
118 W.Implementation_Unit_Warnings;
|
145
|
119 Ineffective_Inline_Warnings :=
|
111
|
120 W.Ineffective_Inline_Warnings;
|
145
|
121 List_Body_Required_Info :=
|
111
|
122 W.List_Body_Required_Info;
|
145
|
123 List_Inherited_Aspects :=
|
111
|
124 W.List_Inherited_Aspects;
|
145
|
125 No_Warn_On_Non_Local_Exception :=
|
111
|
126 W.No_Warn_On_Non_Local_Exception;
|
145
|
127 Warning_Doc_Switch :=
|
111
|
128 W.Warning_Doc_Switch;
|
145
|
129 Warn_On_Ada_2005_Compatibility :=
|
111
|
130 W.Warn_On_Ada_2005_Compatibility;
|
145
|
131 Warn_On_Ada_2012_Compatibility :=
|
111
|
132 W.Warn_On_Ada_2012_Compatibility;
|
145
|
133 Warn_On_All_Unread_Out_Parameters :=
|
111
|
134 W.Warn_On_All_Unread_Out_Parameters;
|
145
|
135 Warn_On_Anonymous_Allocators :=
|
|
136 W.Warn_On_Anonymous_Allocators;
|
|
137 Warn_On_Assertion_Failure :=
|
111
|
138 W.Warn_On_Assertion_Failure;
|
145
|
139 Warn_On_Assumed_Low_Bound :=
|
111
|
140 W.Warn_On_Assumed_Low_Bound;
|
145
|
141 Warn_On_Atomic_Synchronization :=
|
111
|
142 W.Warn_On_Atomic_Synchronization;
|
145
|
143 Warn_On_Bad_Fixed_Value :=
|
111
|
144 W.Warn_On_Bad_Fixed_Value;
|
145
|
145 Warn_On_Biased_Representation :=
|
111
|
146 W.Warn_On_Biased_Representation;
|
145
|
147 Warn_On_Constant :=
|
111
|
148 W.Warn_On_Constant;
|
145
|
149 Warn_On_Deleted_Code :=
|
111
|
150 W.Warn_On_Deleted_Code;
|
145
|
151 Warn_On_Dereference :=
|
111
|
152 W.Warn_On_Dereference;
|
145
|
153 Warn_On_Export_Import :=
|
111
|
154 W.Warn_On_Export_Import;
|
145
|
155 Warn_On_Hiding :=
|
111
|
156 W.Warn_On_Hiding;
|
145
|
157 Warn_On_Late_Primitives :=
|
111
|
158 W.Warn_On_Late_Primitives;
|
145
|
159 Warn_On_Modified_Unread :=
|
111
|
160 W.Warn_On_Modified_Unread;
|
145
|
161 Warn_On_No_Value_Assigned :=
|
111
|
162 W.Warn_On_No_Value_Assigned;
|
145
|
163 Warn_On_Non_Local_Exception :=
|
111
|
164 W.Warn_On_Non_Local_Exception;
|
145
|
165 Warn_On_Object_Renames_Function :=
|
111
|
166 W.Warn_On_Object_Renames_Function;
|
145
|
167 Warn_On_Obsolescent_Feature :=
|
111
|
168 W.Warn_On_Obsolescent_Feature;
|
145
|
169 Warn_On_Overlap :=
|
111
|
170 W.Warn_On_Overlap;
|
145
|
171 Warn_On_Overridden_Size :=
|
111
|
172 W.Warn_On_Overridden_Size;
|
145
|
173 Warn_On_Parameter_Order :=
|
111
|
174 W.Warn_On_Parameter_Order;
|
145
|
175 Warn_On_Questionable_Layout :=
|
111
|
176 W.Warn_On_Questionable_Layout;
|
145
|
177 Warn_On_Questionable_Missing_Parens :=
|
111
|
178 W.Warn_On_Questionable_Missing_Parens;
|
145
|
179 Warn_On_Record_Holes :=
|
111
|
180 W.Warn_On_Record_Holes;
|
145
|
181 Warn_On_Component_Order :=
|
|
182 W.Warn_On_Component_Order;
|
|
183 Warn_On_Redundant_Constructs :=
|
111
|
184 W.Warn_On_Redundant_Constructs;
|
145
|
185 Warn_On_Reverse_Bit_Order :=
|
111
|
186 W.Warn_On_Reverse_Bit_Order;
|
145
|
187 Warn_On_Size_Alignment :=
|
111
|
188 W.Warn_On_Size_Alignment;
|
145
|
189 Warn_On_Standard_Redefinition :=
|
111
|
190 W.Warn_On_Standard_Redefinition;
|
145
|
191 Warn_On_Suspicious_Contract :=
|
111
|
192 W.Warn_On_Suspicious_Contract;
|
145
|
193 Warn_On_Unchecked_Conversion :=
|
111
|
194 W.Warn_On_Unchecked_Conversion;
|
145
|
195 Warn_On_Unknown_Compile_Time_Warning :=
|
|
196 W.Warn_On_Unknown_Compile_Time_Warning;
|
|
197 Warn_On_Unordered_Enumeration_Type :=
|
111
|
198 W.Warn_On_Unordered_Enumeration_Type;
|
145
|
199 Warn_On_Unrecognized_Pragma :=
|
111
|
200 W.Warn_On_Unrecognized_Pragma;
|
145
|
201 Warn_On_Unrepped_Components :=
|
111
|
202 W.Warn_On_Unrepped_Components;
|
145
|
203 Warn_On_Warnings_Off :=
|
111
|
204 W.Warn_On_Warnings_Off;
|
|
205 end Restore_Warnings;
|
|
206
|
|
207 -------------------
|
|
208 -- Save_Warnings --
|
|
209 -------------------
|
|
210
|
|
211 function Save_Warnings return Warning_Record is
|
|
212 W : Warning_Record;
|
|
213
|
|
214 begin
|
145
|
215 W.Address_Clause_Overlay_Warnings :=
|
111
|
216 Address_Clause_Overlay_Warnings;
|
145
|
217 W.Check_Unreferenced :=
|
111
|
218 Check_Unreferenced;
|
145
|
219 W.Check_Unreferenced_Formals :=
|
111
|
220 Check_Unreferenced_Formals;
|
145
|
221 W.Check_Withs :=
|
111
|
222 Check_Withs;
|
145
|
223 W.Constant_Condition_Warnings :=
|
111
|
224 Constant_Condition_Warnings;
|
145
|
225 W.Elab_Info_Messages :=
|
111
|
226 Elab_Info_Messages;
|
145
|
227 W.Elab_Warnings :=
|
111
|
228 Elab_Warnings;
|
145
|
229 W.Implementation_Unit_Warnings :=
|
111
|
230 Implementation_Unit_Warnings;
|
145
|
231 W.Ineffective_Inline_Warnings :=
|
111
|
232 Ineffective_Inline_Warnings;
|
145
|
233 W.List_Body_Required_Info :=
|
111
|
234 List_Body_Required_Info;
|
145
|
235 W.List_Inherited_Aspects :=
|
111
|
236 List_Inherited_Aspects;
|
145
|
237 W.No_Warn_On_Non_Local_Exception :=
|
111
|
238 No_Warn_On_Non_Local_Exception;
|
145
|
239 W.Warning_Doc_Switch :=
|
111
|
240 Warning_Doc_Switch;
|
145
|
241 W.Warn_On_Ada_2005_Compatibility :=
|
111
|
242 Warn_On_Ada_2005_Compatibility;
|
145
|
243 W.Warn_On_Ada_2012_Compatibility :=
|
111
|
244 Warn_On_Ada_2012_Compatibility;
|
145
|
245 W.Warn_On_All_Unread_Out_Parameters :=
|
111
|
246 Warn_On_All_Unread_Out_Parameters;
|
145
|
247 W.Warn_On_Anonymous_Allocators :=
|
|
248 Warn_On_Anonymous_Allocators;
|
|
249 W.Warn_On_Assertion_Failure :=
|
111
|
250 Warn_On_Assertion_Failure;
|
145
|
251 W.Warn_On_Assumed_Low_Bound :=
|
111
|
252 Warn_On_Assumed_Low_Bound;
|
145
|
253 W.Warn_On_Atomic_Synchronization :=
|
111
|
254 Warn_On_Atomic_Synchronization;
|
145
|
255 W.Warn_On_Bad_Fixed_Value :=
|
111
|
256 Warn_On_Bad_Fixed_Value;
|
145
|
257 W.Warn_On_Biased_Representation :=
|
111
|
258 Warn_On_Biased_Representation;
|
145
|
259 W.Warn_On_Constant :=
|
111
|
260 Warn_On_Constant;
|
145
|
261 W.Warn_On_Deleted_Code :=
|
111
|
262 Warn_On_Deleted_Code;
|
145
|
263 W.Warn_On_Dereference :=
|
111
|
264 Warn_On_Dereference;
|
145
|
265 W.Warn_On_Export_Import :=
|
111
|
266 Warn_On_Export_Import;
|
145
|
267 W.Warn_On_Hiding :=
|
111
|
268 Warn_On_Hiding;
|
145
|
269 W.Warn_On_Late_Primitives :=
|
111
|
270 Warn_On_Late_Primitives;
|
145
|
271 W.Warn_On_Modified_Unread :=
|
111
|
272 Warn_On_Modified_Unread;
|
145
|
273 W.Warn_On_No_Value_Assigned :=
|
111
|
274 Warn_On_No_Value_Assigned;
|
145
|
275 W.Warn_On_Non_Local_Exception :=
|
111
|
276 Warn_On_Non_Local_Exception;
|
145
|
277 W.Warn_On_Object_Renames_Function :=
|
111
|
278 Warn_On_Object_Renames_Function;
|
145
|
279 W.Warn_On_Obsolescent_Feature :=
|
111
|
280 Warn_On_Obsolescent_Feature;
|
145
|
281 W.Warn_On_Overlap :=
|
111
|
282 Warn_On_Overlap;
|
145
|
283 W.Warn_On_Overridden_Size :=
|
111
|
284 Warn_On_Overridden_Size;
|
145
|
285 W.Warn_On_Parameter_Order :=
|
111
|
286 Warn_On_Parameter_Order;
|
145
|
287 W.Warn_On_Questionable_Layout :=
|
111
|
288 Warn_On_Questionable_Layout;
|
145
|
289 W.Warn_On_Questionable_Missing_Parens :=
|
111
|
290 Warn_On_Questionable_Missing_Parens;
|
145
|
291 W.Warn_On_Record_Holes :=
|
111
|
292 Warn_On_Record_Holes;
|
145
|
293 W.Warn_On_Component_Order :=
|
|
294 Warn_On_Component_Order;
|
|
295 W.Warn_On_Redundant_Constructs :=
|
111
|
296 Warn_On_Redundant_Constructs;
|
145
|
297 W.Warn_On_Reverse_Bit_Order :=
|
111
|
298 Warn_On_Reverse_Bit_Order;
|
145
|
299 W.Warn_On_Size_Alignment :=
|
111
|
300 Warn_On_Size_Alignment;
|
145
|
301 W.Warn_On_Standard_Redefinition :=
|
111
|
302 Warn_On_Standard_Redefinition;
|
145
|
303 W.Warn_On_Suspicious_Contract :=
|
111
|
304 Warn_On_Suspicious_Contract;
|
145
|
305 W.Warn_On_Unchecked_Conversion :=
|
111
|
306 Warn_On_Unchecked_Conversion;
|
145
|
307 W.Warn_On_Unknown_Compile_Time_Warning :=
|
|
308 Warn_On_Unknown_Compile_Time_Warning;
|
|
309 W.Warn_On_Unordered_Enumeration_Type :=
|
111
|
310 Warn_On_Unordered_Enumeration_Type;
|
145
|
311 W.Warn_On_Unrecognized_Pragma :=
|
111
|
312 Warn_On_Unrecognized_Pragma;
|
145
|
313 W.Warn_On_Unrepped_Components :=
|
111
|
314 Warn_On_Unrepped_Components;
|
145
|
315 W.Warn_On_Warnings_Off :=
|
111
|
316 Warn_On_Warnings_Off;
|
|
317 return W;
|
|
318 end Save_Warnings;
|
|
319
|
|
320 ----------------------------
|
|
321 -- Set_Dot_Warning_Switch --
|
|
322 ----------------------------
|
|
323
|
|
324 function Set_Dot_Warning_Switch (C : Character) return Boolean is
|
|
325 begin
|
|
326 case C is
|
|
327 when 'a' =>
|
|
328 Warn_On_Assertion_Failure := True;
|
|
329
|
|
330 when 'A' =>
|
|
331 Warn_On_Assertion_Failure := False;
|
|
332
|
|
333 when 'b' =>
|
|
334 Warn_On_Biased_Representation := True;
|
|
335
|
|
336 when 'B' =>
|
|
337 Warn_On_Biased_Representation := False;
|
|
338
|
|
339 when 'c' =>
|
|
340 Warn_On_Unrepped_Components := True;
|
|
341
|
|
342 when 'C' =>
|
|
343 Warn_On_Unrepped_Components := False;
|
|
344
|
|
345 when 'd' =>
|
|
346 Warning_Doc_Switch := True;
|
|
347
|
|
348 when 'D' =>
|
|
349 Warning_Doc_Switch := False;
|
|
350
|
|
351 when 'e' =>
|
|
352 All_Warnings (True);
|
|
353
|
|
354 when 'f' =>
|
|
355 Warn_On_Elab_Access := True;
|
|
356
|
|
357 when 'F' =>
|
|
358 Warn_On_Elab_Access := False;
|
|
359
|
|
360 when 'g' =>
|
|
361 Set_GNAT_Mode_Warnings;
|
|
362
|
|
363 when 'h' =>
|
|
364 Warn_On_Record_Holes := True;
|
|
365
|
|
366 when 'H' =>
|
|
367 Warn_On_Record_Holes := False;
|
|
368
|
|
369 when 'i' =>
|
|
370 Warn_On_Overlap := True;
|
|
371
|
|
372 when 'I' =>
|
|
373 Warn_On_Overlap := False;
|
|
374
|
|
375 when 'j' =>
|
|
376 Warn_On_Late_Primitives := True;
|
|
377
|
|
378 when 'J' =>
|
|
379 Warn_On_Late_Primitives := False;
|
|
380
|
|
381 when 'k' =>
|
|
382 Warn_On_Standard_Redefinition := True;
|
|
383
|
|
384 when 'K' =>
|
|
385 Warn_On_Standard_Redefinition := False;
|
|
386
|
|
387 when 'l' =>
|
|
388 List_Inherited_Aspects := True;
|
|
389
|
|
390 when 'L' =>
|
|
391 List_Inherited_Aspects := False;
|
|
392
|
|
393 when 'm' =>
|
|
394 Warn_On_Suspicious_Modulus_Value := True;
|
|
395
|
|
396 when 'M' =>
|
|
397 Warn_On_Suspicious_Modulus_Value := False;
|
|
398
|
|
399 when 'n' =>
|
|
400 Warn_On_Atomic_Synchronization := True;
|
|
401
|
|
402 when 'N' =>
|
|
403 Warn_On_Atomic_Synchronization := False;
|
|
404
|
|
405 when 'o' =>
|
|
406 Warn_On_All_Unread_Out_Parameters := True;
|
|
407
|
|
408 when 'O' =>
|
|
409 Warn_On_All_Unread_Out_Parameters := False;
|
|
410
|
|
411 when 'p' =>
|
|
412 Warn_On_Parameter_Order := True;
|
|
413
|
|
414 when 'P' =>
|
|
415 Warn_On_Parameter_Order := False;
|
|
416
|
|
417 when 'q' =>
|
|
418 Warn_On_Questionable_Layout := True;
|
|
419
|
|
420 when 'Q' =>
|
|
421 Warn_On_Questionable_Layout := False;
|
|
422
|
|
423 when 'r' =>
|
|
424 Warn_On_Object_Renames_Function := True;
|
|
425
|
|
426 when 'R' =>
|
|
427 Warn_On_Object_Renames_Function := False;
|
|
428
|
|
429 when 's' =>
|
|
430 Warn_On_Overridden_Size := True;
|
|
431
|
|
432 when 'S' =>
|
|
433 Warn_On_Overridden_Size := False;
|
|
434
|
|
435 when 't' =>
|
|
436 Warn_On_Suspicious_Contract := True;
|
|
437
|
|
438 when 'T' =>
|
|
439 Warn_On_Suspicious_Contract := False;
|
|
440
|
|
441 when 'u' =>
|
|
442 Warn_On_Unordered_Enumeration_Type := True;
|
|
443
|
|
444 when 'U' =>
|
|
445 Warn_On_Unordered_Enumeration_Type := False;
|
|
446
|
|
447 when 'v' =>
|
|
448 Warn_On_Reverse_Bit_Order := True;
|
|
449
|
|
450 when 'V' =>
|
|
451 Warn_On_Reverse_Bit_Order := False;
|
|
452
|
|
453 when 'w' =>
|
|
454 Warn_On_Warnings_Off := True;
|
|
455
|
|
456 when 'W' =>
|
|
457 Warn_On_Warnings_Off := False;
|
|
458
|
|
459 when 'x' =>
|
|
460 Warn_On_Non_Local_Exception := True;
|
|
461
|
|
462 when 'X' =>
|
|
463 Warn_On_Non_Local_Exception := False;
|
|
464 No_Warn_On_Non_Local_Exception := True;
|
|
465
|
|
466 when 'y' =>
|
|
467 List_Body_Required_Info := True;
|
|
468
|
|
469 when 'Y' =>
|
|
470 List_Body_Required_Info := False;
|
|
471
|
|
472 when 'z' =>
|
|
473 Warn_On_Size_Alignment := True;
|
|
474
|
|
475 when 'Z' =>
|
|
476 Warn_On_Size_Alignment := False;
|
|
477
|
|
478 when others =>
|
|
479 if Ignore_Unrecognized_VWY_Switches then
|
|
480 Write_Line ("unrecognized switch -gnatw." & C & " ignored");
|
|
481 else
|
|
482 return False;
|
|
483 end if;
|
|
484 end case;
|
|
485
|
|
486 return True;
|
|
487 end Set_Dot_Warning_Switch;
|
|
488
|
|
489 -----------------------------------
|
|
490 -- Set_Underscore_Warning_Switch --
|
|
491 -----------------------------------
|
|
492
|
|
493 function Set_Underscore_Warning_Switch (C : Character) return Boolean is
|
|
494 begin
|
|
495 case C is
|
145
|
496 when 'a' =>
|
|
497 Warn_On_Anonymous_Allocators := True;
|
|
498
|
|
499 when 'A' =>
|
|
500 Warn_On_Anonymous_Allocators := False;
|
|
501
|
|
502 when 'c' =>
|
|
503 Warn_On_Unknown_Compile_Time_Warning := True;
|
|
504
|
|
505 when 'C' =>
|
|
506 Warn_On_Unknown_Compile_Time_Warning := False;
|
|
507
|
|
508 when 'r' =>
|
|
509 Warn_On_Component_Order := True;
|
|
510
|
|
511 when 'R' =>
|
|
512 Warn_On_Component_Order := False;
|
|
513
|
111
|
514 when others =>
|
|
515 if Ignore_Unrecognized_VWY_Switches then
|
|
516 Write_Line ("unrecognized switch -gnatw_" & C & " ignored");
|
|
517 else
|
|
518 return False;
|
|
519 end if;
|
|
520 end case;
|
|
521
|
|
522 return True;
|
|
523 end Set_Underscore_Warning_Switch;
|
|
524
|
|
525 ----------------------------
|
|
526 -- Set_GNAT_Mode_Warnings --
|
|
527 ----------------------------
|
|
528
|
|
529 procedure Set_GNAT_Mode_Warnings is
|
|
530 begin
|
|
531 -- Set -gnatwa warnings and no others
|
|
532
|
|
533 All_Warnings (False);
|
|
534 WA_Warnings;
|
|
535
|
|
536 -- These warnings are added to the -gnatwa set
|
|
537
|
|
538 Address_Clause_Overlay_Warnings := True;
|
|
539 Warn_On_Questionable_Layout := True;
|
|
540 Warn_On_Overridden_Size := True;
|
|
541
|
|
542 -- These warnings are removed from the -gnatwa set
|
|
543
|
|
544 Implementation_Unit_Warnings := False;
|
|
545 Warn_On_Non_Local_Exception := False;
|
|
546 No_Warn_On_Non_Local_Exception := True;
|
|
547 Warn_On_Reverse_Bit_Order := False;
|
|
548 Warn_On_Size_Alignment := False;
|
|
549 Warn_On_Unrepped_Components := False;
|
|
550 end Set_GNAT_Mode_Warnings;
|
|
551
|
|
552 ------------------------
|
|
553 -- Set_Warning_Switch --
|
|
554 ------------------------
|
|
555
|
|
556 function Set_Warning_Switch (C : Character) return Boolean is
|
|
557 begin
|
|
558 case C is
|
|
559 when 'a' =>
|
|
560 WA_Warnings;
|
|
561
|
|
562 when 'A' =>
|
|
563 All_Warnings (False);
|
|
564 No_Warn_On_Non_Local_Exception := True;
|
|
565
|
|
566 when 'b' =>
|
|
567 Warn_On_Bad_Fixed_Value := True;
|
|
568
|
|
569 when 'B' =>
|
|
570 Warn_On_Bad_Fixed_Value := False;
|
|
571
|
|
572 when 'c' =>
|
|
573 Constant_Condition_Warnings := True;
|
|
574
|
|
575 when 'C' =>
|
|
576 Constant_Condition_Warnings := False;
|
|
577
|
|
578 when 'd' =>
|
|
579 Warn_On_Dereference := True;
|
|
580
|
|
581 when 'D' =>
|
|
582 Warn_On_Dereference := False;
|
|
583
|
|
584 when 'e' =>
|
|
585 Warning_Mode := Treat_As_Error;
|
|
586
|
|
587 when 'E' =>
|
|
588 Warning_Mode := Treat_Run_Time_Warnings_As_Errors;
|
|
589
|
|
590 when 'f' =>
|
|
591 Check_Unreferenced_Formals := True;
|
|
592
|
|
593 when 'F' =>
|
|
594 Check_Unreferenced_Formals := False;
|
|
595
|
|
596 when 'g' =>
|
|
597 Warn_On_Unrecognized_Pragma := True;
|
|
598
|
|
599 when 'G' =>
|
|
600 Warn_On_Unrecognized_Pragma := False;
|
|
601
|
|
602 when 'h' =>
|
|
603 Warn_On_Hiding := True;
|
|
604
|
|
605 when 'H' =>
|
|
606 Warn_On_Hiding := False;
|
|
607
|
|
608 when 'i' =>
|
|
609 Implementation_Unit_Warnings := True;
|
|
610
|
|
611 when 'I' =>
|
|
612 Implementation_Unit_Warnings := False;
|
|
613
|
|
614 when 'j' =>
|
|
615 Warn_On_Obsolescent_Feature := True;
|
|
616
|
|
617 when 'J' =>
|
|
618 Warn_On_Obsolescent_Feature := False;
|
|
619
|
|
620 when 'k' =>
|
|
621 Warn_On_Constant := True;
|
|
622
|
|
623 when 'K' =>
|
|
624 Warn_On_Constant := False;
|
|
625
|
|
626 when 'l' =>
|
|
627 Elab_Warnings := True;
|
|
628
|
|
629 when 'L' =>
|
|
630 Elab_Warnings := False;
|
|
631
|
|
632 when 'm' =>
|
|
633 Warn_On_Modified_Unread := True;
|
|
634
|
|
635 when 'M' =>
|
|
636 Warn_On_Modified_Unread := False;
|
|
637
|
|
638 when 'n' =>
|
|
639 Warning_Mode := Normal;
|
|
640
|
|
641 when 'o' =>
|
|
642 Address_Clause_Overlay_Warnings := True;
|
|
643
|
|
644 when 'O' =>
|
|
645 Address_Clause_Overlay_Warnings := False;
|
|
646
|
|
647 when 'p' =>
|
|
648 Ineffective_Inline_Warnings := True;
|
|
649
|
|
650 when 'P' =>
|
|
651 Ineffective_Inline_Warnings := False;
|
|
652
|
|
653 when 'q' =>
|
|
654 Warn_On_Questionable_Missing_Parens := True;
|
|
655
|
|
656 when 'Q' =>
|
|
657 Warn_On_Questionable_Missing_Parens := False;
|
|
658
|
|
659 when 'r' =>
|
|
660 Warn_On_Redundant_Constructs := True;
|
|
661
|
|
662 when 'R' =>
|
|
663 Warn_On_Redundant_Constructs := False;
|
|
664
|
|
665 when 's' =>
|
|
666 Warning_Mode := Suppress;
|
|
667
|
|
668 when 't' =>
|
|
669 Warn_On_Deleted_Code := True;
|
|
670
|
|
671 when 'T' =>
|
|
672 Warn_On_Deleted_Code := False;
|
|
673
|
|
674 when 'u' =>
|
|
675 Check_Unreferenced := True;
|
|
676 Check_Withs := True;
|
|
677 Check_Unreferenced_Formals := True;
|
|
678
|
|
679 when 'U' =>
|
|
680 Check_Unreferenced := False;
|
|
681 Check_Withs := False;
|
|
682 Check_Unreferenced_Formals := False;
|
|
683
|
|
684 when 'v' =>
|
|
685 Warn_On_No_Value_Assigned := True;
|
|
686
|
|
687 when 'V' =>
|
|
688 Warn_On_No_Value_Assigned := False;
|
|
689
|
|
690 when 'w' =>
|
|
691 Warn_On_Assumed_Low_Bound := True;
|
|
692
|
|
693 when 'W' =>
|
|
694 Warn_On_Assumed_Low_Bound := False;
|
|
695
|
|
696 when 'x' =>
|
|
697 Warn_On_Export_Import := True;
|
|
698
|
|
699 when 'X' =>
|
|
700 Warn_On_Export_Import := False;
|
|
701
|
|
702 when 'y' =>
|
|
703 Warn_On_Ada_2005_Compatibility := True;
|
|
704 Warn_On_Ada_2012_Compatibility := True;
|
|
705
|
|
706 when 'Y' =>
|
|
707 Warn_On_Ada_2005_Compatibility := False;
|
|
708 Warn_On_Ada_2012_Compatibility := False;
|
|
709
|
|
710 when 'z' =>
|
|
711 Warn_On_Unchecked_Conversion := True;
|
|
712
|
|
713 when 'Z' =>
|
|
714 Warn_On_Unchecked_Conversion := False;
|
|
715
|
|
716 when others =>
|
|
717 if Ignore_Unrecognized_VWY_Switches then
|
|
718 Write_Line ("unrecognized switch -gnatw" & C & " ignored");
|
|
719 else
|
|
720 return False;
|
|
721 end if;
|
|
722 end case;
|
|
723
|
|
724 return True;
|
|
725 end Set_Warning_Switch;
|
|
726
|
|
727 -----------------
|
|
728 -- WA_Warnings --
|
|
729 -----------------
|
|
730
|
|
731 procedure WA_Warnings is
|
|
732 begin
|
|
733 Check_Unreferenced := True; -- -gnatwf/-gnatwu
|
|
734 Check_Unreferenced_Formals := True; -- -gnatwf/-gnatwu
|
|
735 Check_Withs := True; -- -gnatwu
|
|
736 Constant_Condition_Warnings := True; -- -gnatwc
|
|
737 Implementation_Unit_Warnings := True; -- -gnatwi
|
|
738 Ineffective_Inline_Warnings := True; -- -gnatwp
|
|
739 Warn_On_Ada_2005_Compatibility := True; -- -gnatwy
|
|
740 Warn_On_Ada_2012_Compatibility := True; -- -gnatwy
|
145
|
741 Warn_On_Anonymous_Allocators := True; -- -gnatw_a
|
111
|
742 Warn_On_Assertion_Failure := True; -- -gnatw.a
|
|
743 Warn_On_Assumed_Low_Bound := True; -- -gnatww
|
|
744 Warn_On_Bad_Fixed_Value := True; -- -gnatwb
|
|
745 Warn_On_Biased_Representation := True; -- -gnatw.b
|
|
746 Warn_On_Constant := True; -- -gnatwk
|
|
747 Warn_On_Export_Import := True; -- -gnatwx
|
|
748 Warn_On_Late_Primitives := True; -- -gnatw.j
|
|
749 Warn_On_Modified_Unread := True; -- -gnatwm
|
|
750 Warn_On_No_Value_Assigned := True; -- -gnatwv
|
|
751 Warn_On_Non_Local_Exception := True; -- -gnatw.x
|
|
752 Warn_On_Object_Renames_Function := True; -- -gnatw.r
|
|
753 Warn_On_Obsolescent_Feature := True; -- -gnatwj
|
|
754 Warn_On_Overlap := True; -- -gnatw.i
|
|
755 Warn_On_Parameter_Order := True; -- -gnatw.p
|
|
756 Warn_On_Questionable_Missing_Parens := True; -- -gnatwq
|
|
757 Warn_On_Redundant_Constructs := True; -- -gnatwr
|
|
758 Warn_On_Reverse_Bit_Order := True; -- -gnatw.v
|
|
759 Warn_On_Size_Alignment := True; -- -gnatw.z
|
|
760 Warn_On_Suspicious_Contract := True; -- -gnatw.t
|
|
761 Warn_On_Suspicious_Modulus_Value := True; -- -gnatw.m
|
|
762 Warn_On_Unchecked_Conversion := True; -- -gnatwz
|
|
763 Warn_On_Unrecognized_Pragma := True; -- -gnatwg
|
|
764 Warn_On_Unrepped_Components := True; -- -gnatw.c
|
|
765 end WA_Warnings;
|
|
766
|
|
767 end Warnsw;
|