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