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