]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/warnsw.adb
c++: Handle multiple aggregate overloads [PR95319].
[thirdparty/gcc.git] / gcc / ada / warnsw.adb
CommitLineData
499769ec
AC
1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- W A R N S W --
6-- --
7-- B o d y --
8-- --
1d005acc 9-- Copyright (C) 1999-2019, Free Software Foundation, Inc. --
499769ec
AC
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------------------------------------------------------------------------------
0e564ab4 25
a3633438
AC
26with Err_Vars; use Err_Vars;
27with Opt; use Opt;
d48cd424 28with Output; use Output;
14c34330 29
499769ec
AC
30package body Warnsw is
31
17cf9038
AC
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
0246fe44
BD
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;
94f76dc1 82 Warn_On_Component_Order := Setting;
0246fe44
BD
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;
17cf9038
AC
95 end All_Warnings;
96
14c34330
AC
97 ----------------------
98 -- Restore_Warnings --
99 ----------------------
100
101 procedure Restore_Warnings (W : Warning_Record) is
102 begin
0246fe44 103 Address_Clause_Overlay_Warnings :=
14c34330 104 W.Address_Clause_Overlay_Warnings;
0246fe44 105 Check_Unreferenced :=
14c34330 106 W.Check_Unreferenced;
0246fe44 107 Check_Unreferenced_Formals :=
14c34330 108 W.Check_Unreferenced_Formals;
0246fe44 109 Check_Withs :=
14c34330 110 W.Check_Withs;
0246fe44 111 Constant_Condition_Warnings :=
14c34330 112 W.Constant_Condition_Warnings;
0246fe44 113 Elab_Warnings :=
14c34330 114 W.Elab_Warnings;
0246fe44 115 Elab_Info_Messages :=
fe2194df 116 W.Elab_Info_Messages;
0246fe44 117 Implementation_Unit_Warnings :=
14c34330 118 W.Implementation_Unit_Warnings;
0246fe44 119 Ineffective_Inline_Warnings :=
14c34330 120 W.Ineffective_Inline_Warnings;
0246fe44 121 List_Body_Required_Info :=
98779361 122 W.List_Body_Required_Info;
0246fe44 123 List_Inherited_Aspects :=
14c34330 124 W.List_Inherited_Aspects;
0246fe44 125 No_Warn_On_Non_Local_Exception :=
17cf9038 126 W.No_Warn_On_Non_Local_Exception;
0246fe44 127 Warning_Doc_Switch :=
14c34330 128 W.Warning_Doc_Switch;
0246fe44 129 Warn_On_Ada_2005_Compatibility :=
14c34330 130 W.Warn_On_Ada_2005_Compatibility;
0246fe44 131 Warn_On_Ada_2012_Compatibility :=
14c34330 132 W.Warn_On_Ada_2012_Compatibility;
0246fe44 133 Warn_On_All_Unread_Out_Parameters :=
14c34330 134 W.Warn_On_All_Unread_Out_Parameters;
0246fe44 135 Warn_On_Anonymous_Allocators :=
b3889fff 136 W.Warn_On_Anonymous_Allocators;
0246fe44 137 Warn_On_Assertion_Failure :=
14c34330 138 W.Warn_On_Assertion_Failure;
0246fe44 139 Warn_On_Assumed_Low_Bound :=
14c34330 140 W.Warn_On_Assumed_Low_Bound;
0246fe44 141 Warn_On_Atomic_Synchronization :=
14c34330 142 W.Warn_On_Atomic_Synchronization;
0246fe44 143 Warn_On_Bad_Fixed_Value :=
14c34330 144 W.Warn_On_Bad_Fixed_Value;
0246fe44 145 Warn_On_Biased_Representation :=
14c34330 146 W.Warn_On_Biased_Representation;
0246fe44 147 Warn_On_Constant :=
14c34330 148 W.Warn_On_Constant;
0246fe44 149 Warn_On_Deleted_Code :=
14c34330 150 W.Warn_On_Deleted_Code;
0246fe44 151 Warn_On_Dereference :=
14c34330 152 W.Warn_On_Dereference;
0246fe44 153 Warn_On_Export_Import :=
14c34330 154 W.Warn_On_Export_Import;
0246fe44 155 Warn_On_Hiding :=
14c34330 156 W.Warn_On_Hiding;
0246fe44 157 Warn_On_Late_Primitives :=
48c8c473 158 W.Warn_On_Late_Primitives;
0246fe44 159 Warn_On_Modified_Unread :=
14c34330 160 W.Warn_On_Modified_Unread;
0246fe44 161 Warn_On_No_Value_Assigned :=
14c34330 162 W.Warn_On_No_Value_Assigned;
0246fe44 163 Warn_On_Non_Local_Exception :=
14c34330 164 W.Warn_On_Non_Local_Exception;
0246fe44 165 Warn_On_Object_Renames_Function :=
14c34330 166 W.Warn_On_Object_Renames_Function;
0246fe44 167 Warn_On_Obsolescent_Feature :=
14c34330 168 W.Warn_On_Obsolescent_Feature;
0246fe44 169 Warn_On_Overlap :=
14c34330 170 W.Warn_On_Overlap;
0246fe44 171 Warn_On_Overridden_Size :=
14c34330 172 W.Warn_On_Overridden_Size;
0246fe44 173 Warn_On_Parameter_Order :=
14c34330 174 W.Warn_On_Parameter_Order;
0246fe44 175 Warn_On_Questionable_Layout :=
8ab31c0c 176 W.Warn_On_Questionable_Layout;
0246fe44 177 Warn_On_Questionable_Missing_Parens :=
14c34330 178 W.Warn_On_Questionable_Missing_Parens;
0246fe44 179 Warn_On_Record_Holes :=
14c34330 180 W.Warn_On_Record_Holes;
94f76dc1
BD
181 Warn_On_Component_Order :=
182 W.Warn_On_Component_Order;
0246fe44 183 Warn_On_Redundant_Constructs :=
14c34330 184 W.Warn_On_Redundant_Constructs;
0246fe44 185 Warn_On_Reverse_Bit_Order :=
14c34330 186 W.Warn_On_Reverse_Bit_Order;
0246fe44 187 Warn_On_Size_Alignment :=
3f1bc2cf 188 W.Warn_On_Size_Alignment;
0246fe44 189 Warn_On_Standard_Redefinition :=
14c34330 190 W.Warn_On_Standard_Redefinition;
0246fe44 191 Warn_On_Suspicious_Contract :=
14c34330 192 W.Warn_On_Suspicious_Contract;
0246fe44 193 Warn_On_Unchecked_Conversion :=
14c34330 194 W.Warn_On_Unchecked_Conversion;
0246fe44
BD
195 Warn_On_Unknown_Compile_Time_Warning :=
196 W.Warn_On_Unknown_Compile_Time_Warning;
197 Warn_On_Unordered_Enumeration_Type :=
14c34330 198 W.Warn_On_Unordered_Enumeration_Type;
0246fe44 199 Warn_On_Unrecognized_Pragma :=
14c34330 200 W.Warn_On_Unrecognized_Pragma;
0246fe44 201 Warn_On_Unrepped_Components :=
14c34330 202 W.Warn_On_Unrepped_Components;
0246fe44 203 Warn_On_Warnings_Off :=
14c34330
AC
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
0246fe44 215 W.Address_Clause_Overlay_Warnings :=
14c34330 216 Address_Clause_Overlay_Warnings;
0246fe44 217 W.Check_Unreferenced :=
14c34330 218 Check_Unreferenced;
0246fe44 219 W.Check_Unreferenced_Formals :=
14c34330 220 Check_Unreferenced_Formals;
0246fe44 221 W.Check_Withs :=
14c34330 222 Check_Withs;
0246fe44 223 W.Constant_Condition_Warnings :=
14c34330 224 Constant_Condition_Warnings;
0246fe44 225 W.Elab_Info_Messages :=
fe2194df 226 Elab_Info_Messages;
0246fe44 227 W.Elab_Warnings :=
14c34330 228 Elab_Warnings;
0246fe44 229 W.Implementation_Unit_Warnings :=
14c34330 230 Implementation_Unit_Warnings;
0246fe44 231 W.Ineffective_Inline_Warnings :=
14c34330 232 Ineffective_Inline_Warnings;
0246fe44 233 W.List_Body_Required_Info :=
98779361 234 List_Body_Required_Info;
0246fe44 235 W.List_Inherited_Aspects :=
14c34330 236 List_Inherited_Aspects;
0246fe44 237 W.No_Warn_On_Non_Local_Exception :=
17cf9038 238 No_Warn_On_Non_Local_Exception;
0246fe44 239 W.Warning_Doc_Switch :=
14c34330 240 Warning_Doc_Switch;
0246fe44 241 W.Warn_On_Ada_2005_Compatibility :=
14c34330 242 Warn_On_Ada_2005_Compatibility;
0246fe44 243 W.Warn_On_Ada_2012_Compatibility :=
14c34330 244 Warn_On_Ada_2012_Compatibility;
0246fe44 245 W.Warn_On_All_Unread_Out_Parameters :=
14c34330 246 Warn_On_All_Unread_Out_Parameters;
0246fe44 247 W.Warn_On_Anonymous_Allocators :=
b3889fff 248 Warn_On_Anonymous_Allocators;
0246fe44 249 W.Warn_On_Assertion_Failure :=
14c34330 250 Warn_On_Assertion_Failure;
0246fe44 251 W.Warn_On_Assumed_Low_Bound :=
14c34330 252 Warn_On_Assumed_Low_Bound;
0246fe44 253 W.Warn_On_Atomic_Synchronization :=
14c34330 254 Warn_On_Atomic_Synchronization;
0246fe44 255 W.Warn_On_Bad_Fixed_Value :=
14c34330 256 Warn_On_Bad_Fixed_Value;
0246fe44 257 W.Warn_On_Biased_Representation :=
14c34330 258 Warn_On_Biased_Representation;
0246fe44 259 W.Warn_On_Constant :=
14c34330 260 Warn_On_Constant;
0246fe44 261 W.Warn_On_Deleted_Code :=
14c34330 262 Warn_On_Deleted_Code;
0246fe44 263 W.Warn_On_Dereference :=
14c34330 264 Warn_On_Dereference;
0246fe44 265 W.Warn_On_Export_Import :=
14c34330 266 Warn_On_Export_Import;
0246fe44 267 W.Warn_On_Hiding :=
14c34330 268 Warn_On_Hiding;
0246fe44 269 W.Warn_On_Late_Primitives :=
48c8c473 270 Warn_On_Late_Primitives;
0246fe44 271 W.Warn_On_Modified_Unread :=
14c34330 272 Warn_On_Modified_Unread;
0246fe44 273 W.Warn_On_No_Value_Assigned :=
14c34330 274 Warn_On_No_Value_Assigned;
0246fe44 275 W.Warn_On_Non_Local_Exception :=
14c34330 276 Warn_On_Non_Local_Exception;
0246fe44 277 W.Warn_On_Object_Renames_Function :=
14c34330 278 Warn_On_Object_Renames_Function;
0246fe44 279 W.Warn_On_Obsolescent_Feature :=
14c34330 280 Warn_On_Obsolescent_Feature;
0246fe44 281 W.Warn_On_Overlap :=
14c34330 282 Warn_On_Overlap;
0246fe44 283 W.Warn_On_Overridden_Size :=
14c34330 284 Warn_On_Overridden_Size;
0246fe44 285 W.Warn_On_Parameter_Order :=
14c34330 286 Warn_On_Parameter_Order;
0246fe44 287 W.Warn_On_Questionable_Layout :=
8ab31c0c 288 Warn_On_Questionable_Layout;
0246fe44 289 W.Warn_On_Questionable_Missing_Parens :=
14c34330 290 Warn_On_Questionable_Missing_Parens;
0246fe44 291 W.Warn_On_Record_Holes :=
14c34330 292 Warn_On_Record_Holes;
94f76dc1
BD
293 W.Warn_On_Component_Order :=
294 Warn_On_Component_Order;
0246fe44 295 W.Warn_On_Redundant_Constructs :=
14c34330 296 Warn_On_Redundant_Constructs;
0246fe44 297 W.Warn_On_Reverse_Bit_Order :=
14c34330 298 Warn_On_Reverse_Bit_Order;
0246fe44 299 W.Warn_On_Size_Alignment :=
3f1bc2cf 300 Warn_On_Size_Alignment;
0246fe44 301 W.Warn_On_Standard_Redefinition :=
14c34330 302 Warn_On_Standard_Redefinition;
0246fe44 303 W.Warn_On_Suspicious_Contract :=
14c34330 304 Warn_On_Suspicious_Contract;
0246fe44 305 W.Warn_On_Unchecked_Conversion :=
14c34330 306 Warn_On_Unchecked_Conversion;
0246fe44
BD
307 W.Warn_On_Unknown_Compile_Time_Warning :=
308 Warn_On_Unknown_Compile_Time_Warning;
309 W.Warn_On_Unordered_Enumeration_Type :=
14c34330 310 Warn_On_Unordered_Enumeration_Type;
0246fe44 311 W.Warn_On_Unrecognized_Pragma :=
14c34330 312 Warn_On_Unrecognized_Pragma;
0246fe44 313 W.Warn_On_Unrepped_Components :=
14c34330 314 Warn_On_Unrepped_Components;
0246fe44 315 W.Warn_On_Warnings_Off :=
14c34330 316 Warn_On_Warnings_Off;
14c34330
AC
317 return W;
318 end Save_Warnings;
319
499769ec
AC
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
a3633438 345 when 'd' =>
7fcd29e0 346 Warning_Doc_Switch := True;
a3633438
AC
347
348 when 'D' =>
7fcd29e0 349 Warning_Doc_Switch := False;
a3633438 350
499769ec 351 when 'e' =>
17cf9038 352 All_Warnings (True);
499769ec 353
10dfac72
AC
354 when 'f' =>
355 Warn_On_Elab_Access := True;
356
357 when 'F' =>
358 Warn_On_Elab_Access := False;
359
499769ec
AC
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
48c8c473
AC
375 when 'j' =>
376 Warn_On_Late_Primitives := True;
377
378 when 'J' =>
379 Warn_On_Late_Primitives := False;
380
616547fa
AC
381 when 'k' =>
382 Warn_On_Standard_Redefinition := True;
383
384 when 'K' =>
385 Warn_On_Standard_Redefinition := False;
386
499769ec
AC
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
12b4d338
AC
399 when 'n' =>
400 Warn_On_Atomic_Synchronization := True;
401
402 when 'N' =>
403 Warn_On_Atomic_Synchronization := False;
404
499769ec
AC
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
8ab31c0c
AC
417 when 'q' =>
418 Warn_On_Questionable_Layout := True;
419
420 when 'Q' =>
421 Warn_On_Questionable_Layout := False;
422
499769ec
AC
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
67c86178
AC
435 when 't' =>
436 Warn_On_Suspicious_Contract := True;
437
438 when 'T' =>
439 Warn_On_Suspicious_Contract := False;
440
499769ec
AC
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
98779361
RD
466 when 'y' =>
467 List_Body_Required_Info := True;
468
469 when 'Y' =>
470 List_Body_Required_Info := False;
471
3f1bc2cf
AC
472 when 'z' =>
473 Warn_On_Size_Alignment := True;
474
475 when 'Z' =>
476 Warn_On_Size_Alignment := False;
477
499769ec 478 when others =>
d48cd424
RD
479 if Ignore_Unrecognized_VWY_Switches then
480 Write_Line ("unrecognized switch -gnatw." & C & " ignored");
481 else
482 return False;
483 end if;
499769ec
AC
484 end case;
485
486 return True;
487 end Set_Dot_Warning_Switch;
488
683af98c
AC
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
b3889fff
JS
496 when 'a' =>
497 Warn_On_Anonymous_Allocators := True;
498
499 when 'A' =>
500 Warn_On_Anonymous_Allocators := False;
501
0246fe44
BD
502 when 'c' =>
503 Warn_On_Unknown_Compile_Time_Warning := True;
504
505 when 'C' =>
506 Warn_On_Unknown_Compile_Time_Warning := False;
507
94f76dc1
BD
508 when 'r' =>
509 Warn_On_Component_Order := True;
510
511 when 'R' =>
512 Warn_On_Component_Order := False;
513
683af98c
AC
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
499769ec
AC
525 ----------------------------
526 -- Set_GNAT_Mode_Warnings --
527 ----------------------------
528
529 procedure Set_GNAT_Mode_Warnings is
530 begin
17cf9038
AC
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
499769ec 538 Address_Clause_Overlay_Warnings := True;
8489c295 539 Warn_On_Questionable_Layout := True;
17cf9038
AC
540 Warn_On_Overridden_Size := True;
541
542 -- These warnings are removed from the -gnatwa set
543
499769ec 544 Implementation_Unit_Warnings := False;
499769ec 545 Warn_On_Non_Local_Exception := False;
17cf9038 546 No_Warn_On_Non_Local_Exception := True;
499769ec 547 Warn_On_Reverse_Bit_Order := False;
3f1bc2cf 548 Warn_On_Size_Alignment := False;
499769ec 549 Warn_On_Unrepped_Components := False;
499769ec
AC
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' =>
17cf9038 560 WA_Warnings;
499769ec
AC
561
562 when 'A' =>
17cf9038 563 All_Warnings (False);
499769ec
AC
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
b55993b3 587 when 'E' =>
2d249f52 588 Warning_Mode := Treat_Run_Time_Warnings_As_Errors;
b55993b3 589
499769ec
AC
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 =>
d48cd424
RD
717 if Ignore_Unrecognized_VWY_Switches then
718 Write_Line ("unrecognized switch -gnatw" & C & " ignored");
719 else
720 return False;
721 end if;
499769ec
AC
722 end case;
723
724 return True;
725 end Set_Warning_Switch;
726
17cf9038
AC
727 -----------------
728 -- WA_Warnings --
729 -----------------
730
731 procedure WA_Warnings is
732 begin
b329a739
AC
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
b3889fff 741 Warn_On_Anonymous_Allocators := True; -- -gnatw_a
b329a739
AC
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
48c8c473 748 Warn_On_Late_Primitives := True; -- -gnatw.j
b329a739
AC
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
17cf9038
AC
765 end WA_Warnings;
766
499769ec 767end Warnsw;