ada: Update copyright notice
[official-gcc.git] / gcc / ada / warnsw.ads
blob2636aba153aae3a0ffcdfa8b8db74f541c70c12b
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- W A R N S W --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1999-2023, 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 ------------------------------------------------------------------------------
26 -- This unit contains the routines used to handle setting of warning options
27 -- in the GNAT compiler.
29 package Warnsw is
31 -------------------
32 -- Warning Flags --
33 -------------------
35 -- These flags are activated or deactivated by -gnatw switches and control
36 -- whether warnings of a given class will be generated or not.
38 package Warnings_Package is
39 type Opt_Warnings_Enum is
40 -- List of all warnings that can be enabled, plus the two null-ish
41 -- values.
42 (No_Such_Warning, Special_Case, -- see body
44 Address_Clause_Overlay_Warnings,
45 Check_Unreferenced,
46 Check_Unreferenced_Formals,
47 Check_Withs,
48 Constant_Condition_Warnings,
49 Elab_Info_Messages,
50 Elab_Warnings,
51 Implementation_Unit_Warnings,
52 Ineffective_Inline_Warnings,
53 List_Body_Required_Info,
54 List_Inherited_Aspects,
55 Warning_Doc_Switch,
56 Warn_On_Ada_2005_Compatibility,
57 Warn_On_Ada_2012_Compatibility,
58 Warn_On_Ada_2022_Compatibility,
59 Warn_On_All_Unread_Out_Parameters,
60 Warn_On_Anonymous_Allocators,
61 Warn_On_Assertion_Failure,
62 Warn_On_Assumed_Low_Bound,
63 Warn_On_Atomic_Synchronization,
64 Warn_On_Bad_Fixed_Value,
65 Warn_On_Biased_Representation,
66 Warn_On_Component_Order,
67 Warn_On_Constant,
68 Warn_On_Deleted_Code,
69 Warn_On_Dereference,
70 Warn_On_Elab_Access,
71 Warn_On_Export_Import,
72 Warn_On_Hiding,
73 Warn_On_Ignored_Equality,
74 Warn_On_Late_Primitives,
75 Warn_On_Modified_Unread,
76 Warn_On_No_Value_Assigned,
77 Warn_On_Non_Local_Exception,
78 No_Warn_On_Non_Local_Exception,
79 Warn_On_Object_Renames_Function,
80 Warn_On_Obsolescent_Feature,
81 Warn_On_Overlap,
82 Warn_On_Overridden_Size,
83 Warn_On_Parameter_Order,
84 Warn_On_Pedantic_Checks,
85 Warn_On_Questionable_Layout,
86 Warn_On_Questionable_Missing_Parens,
87 Warn_On_Record_Holes,
88 Warn_On_Redundant_Constructs,
89 Warn_On_Reverse_Bit_Order,
90 Warn_On_Size_Alignment,
91 Warn_On_Standard_Redefinition,
92 Warn_On_Suspicious_Contract,
93 Warn_On_Suspicious_Modulus_Value,
94 Warn_On_Unchecked_Conversion,
95 Warn_On_Unknown_Compile_Time_Warning,
96 Warn_On_Unordered_Enumeration_Type,
97 Warn_On_Unrecognized_Pragma,
98 Warn_On_Unrepped_Components,
99 Warn_On_Warnings_Off); -- Opt_Warnings_Enum
101 subtype Warnings_Enum is Opt_Warnings_Enum
102 range Opt_Warnings_Enum'Succ (Special_Case) .. Opt_Warnings_Enum'Last;
103 -- Just the warning switches, without the null-ish values
104 end Warnings_Package;
105 use Warnings_Package;
107 type Warnings_State is array (Warnings_Enum) of Boolean;
108 pragma Pack (Warnings_State);
109 -- Without Pack, we can have bootstrapping failures, because the compiler
110 -- generates calls to System.Boolean_Array_Operations, which is not
111 -- currently part of the compiler.
113 Warning_Flags : Warnings_State :=
114 -- Current state of warnings -- True/False means enabled/disabled.
115 -- The following initializes the flags to their default values,
116 -- and warning switches modify them.
117 (Address_Clause_Overlay_Warnings |
118 Elab_Warnings |
119 Implementation_Unit_Warnings |
120 Warning_Doc_Switch |
121 Warn_On_Ada_2005_Compatibility |
122 Warn_On_Ada_2012_Compatibility |
123 Warn_On_Ada_2022_Compatibility |
124 Warn_On_Assertion_Failure |
125 Warn_On_Assumed_Low_Bound |
126 Warn_On_Biased_Representation |
127 Warn_On_Export_Import |
128 Warn_On_No_Value_Assigned |
129 Warn_On_Questionable_Missing_Parens |
130 Warn_On_Reverse_Bit_Order |
131 Warn_On_Size_Alignment |
132 Warn_On_Suspicious_Contract |
133 Warn_On_Suspicious_Modulus_Value |
134 Warn_On_Unchecked_Conversion |
135 Warn_On_Unknown_Compile_Time_Warning |
136 Warn_On_Unrecognized_Pragma =>
137 True,
139 Check_Unreferenced |
140 Check_Unreferenced_Formals |
141 Check_Withs |
142 Constant_Condition_Warnings |
143 Elab_Info_Messages |
144 Ineffective_Inline_Warnings |
145 List_Body_Required_Info |
146 List_Inherited_Aspects |
147 Warn_On_All_Unread_Out_Parameters |
148 Warn_On_Anonymous_Allocators |
149 Warn_On_Atomic_Synchronization |
150 Warn_On_Bad_Fixed_Value |
151 Warn_On_Component_Order |
152 Warn_On_Constant |
153 Warn_On_Deleted_Code |
154 Warn_On_Dereference |
155 Warn_On_Elab_Access |
156 Warn_On_Hiding |
157 Warn_On_Ignored_Equality |
158 Warn_On_Late_Primitives |
159 Warn_On_Modified_Unread |
160 Warn_On_Non_Local_Exception |
161 No_Warn_On_Non_Local_Exception |
162 Warn_On_Object_Renames_Function |
163 Warn_On_Obsolescent_Feature |
164 Warn_On_Overlap |
165 Warn_On_Overridden_Size |
166 Warn_On_Parameter_Order |
167 Warn_On_Pedantic_Checks |
168 Warn_On_Questionable_Layout |
169 Warn_On_Record_Holes |
170 Warn_On_Redundant_Constructs |
171 Warn_On_Standard_Redefinition |
172 Warn_On_Unordered_Enumeration_Type |
173 Warn_On_Unrepped_Components |
174 Warn_On_Warnings_Off =>
175 False);
177 package X renames Warnings_Package;
178 F : Warnings_State renames Warning_Flags;
179 -- Short-hand names used only locally to this package
181 -- The following rename all the components of Warning_Flags for convenient
182 -- access throughout the compiler.
184 pragma Style_Checks ("M120");
185 Address_Clause_Overlay_Warnings : Boolean renames F (X.Address_Clause_Overlay_Warnings);
186 -- Set False to disable address clause warnings. Modified by use of
187 -- -gnatwo/O.
189 Check_Unreferenced : Boolean renames F (X.Check_Unreferenced);
190 -- Set to True to enable checking for unreferenced entities other
191 -- than formal parameters (for which see Check_Unreferenced_Formals)
192 -- Modified by use of -gnatwu/U.
194 Check_Unreferenced_Formals : Boolean renames F (X.Check_Unreferenced_Formals);
195 -- Set to True to check for unreferenced formals. This is turned on by
196 -- -gnatwa/wf/wu and turned off by -gnatwA/wF/wU.
198 Check_Withs : Boolean renames F (X.Check_Withs);
199 -- Set to True to enable checking for unused withs, and also the case
200 -- of withing a package and using none of the entities in the package.
201 -- Modified by use of -gnatwu/U.
203 Constant_Condition_Warnings : Boolean renames F (X.Constant_Condition_Warnings);
204 -- Set to True to activate warnings on constant conditions. Modified by
205 -- use of -gnatwc/C.
207 Elab_Info_Messages : Boolean renames F (X.Elab_Info_Messages);
208 -- Set to True to output info messages for static elabmodel (-gnatel)
210 Elab_Warnings : Boolean renames F (X.Elab_Warnings);
211 -- Set to True to generate elaboration warnings (-gnatwl). The warnings are
212 -- enabled by default because they carry the same importance as errors. The
213 -- compiler cannot emit actual errors because elaboration diagnostics need
214 -- dataflow analysis, which is not available. This behavior parallels that
215 -- of the old ABE mechanism.
217 Implementation_Unit_Warnings : Boolean renames F (X.Implementation_Unit_Warnings);
218 -- Set True to active warnings for use of implementation internal units.
219 -- Modified by use of -gnatwi/-gnatwI.
221 Ineffective_Inline_Warnings : Boolean renames F (X.Ineffective_Inline_Warnings);
222 -- Set True to activate warnings if front-end inlining (-gnatN) is not able
223 -- to actually inline a particular call (or all calls). Can be controlled
224 -- by use of -gnatwp/-gnatwP. Also set True to activate warnings if
225 -- frontend inlining is not able to inline a subprogram expected to
226 -- be inlined in GNATprove mode.
228 List_Body_Required_Info : Boolean renames F (X.List_Body_Required_Info);
229 -- List info messages about why a package requires a body. Modified by use
230 -- of -gnatw.y/.Y.
232 List_Inherited_Aspects : Boolean renames F (X.List_Inherited_Aspects);
233 -- List inherited invariants, preconditions, and postconditions from
234 -- Invariant'Class, Pre'Class, and Post'Class aspects. Also list inherited
235 -- subtype predicates. Modified by use of -gnatw.l/.L.
237 Warning_Doc_Switch : Boolean renames F (X.Warning_Doc_Switch);
238 -- If this is set True, then the ??/?*?/?$?/?x?/?.x?/?_x? insertion
239 -- sequences in error messages generate appropriate tags for the output
240 -- error messages. If this switch is False, then these sequences are still
241 -- recognized (for the purposes of implementing the pattern matching in
242 -- pragmas Warnings (Off,..) and Warning_As_Error(...) but do not result
243 -- in adding the error message tag. The -gnatw.d switch sets this flag
244 -- True, -gnatw.D sets this flag False.
246 Warn_On_Ada_2005_Compatibility : Boolean renames F (X.Warn_On_Ada_2005_Compatibility);
247 -- Set to True to generate all warnings on Ada 2005 compatibility issues,
248 -- including warnings on Ada 2005 obsolescent features used in Ada 2005
249 -- mode. Set by default, modified by use of -gnatwy/Y.
251 Warn_On_Ada_2012_Compatibility : Boolean renames F (X.Warn_On_Ada_2012_Compatibility);
252 -- Set to True to generate all warnings on Ada 2012 compatibility issues,
253 -- including warnings on Ada 2012 obsolescent features used in Ada 2012
254 -- mode. Modified by use of -gnatwy/Y.
256 Warn_On_Ada_2022_Compatibility : Boolean renames F (X.Warn_On_Ada_2022_Compatibility);
257 -- Set to True to generate all warnings on Ada 2022 compatibility issues,
258 -- including warnings on Ada 2022 obsolescent features used in Ada 2022
259 -- mode. There is no switch controlling this option.
261 Warn_On_All_Unread_Out_Parameters : Boolean renames F (X.Warn_On_All_Unread_Out_Parameters);
262 -- Set to True to generate warnings in all cases where a variable is
263 -- modified by being passed as to an OUT formal, but the resulting value is
264 -- never read. The default is that this warning is suppressed. Modified
265 -- by use of gnatw.o/.O.
267 Warn_On_Anonymous_Allocators : Boolean renames F (X.Warn_On_Anonymous_Allocators);
268 -- Warn when allocators for anonymous access types are present, which,
269 -- although not illegal in Ada, may be confusing to users due to how
270 -- accessibility checks get generated. Off by default, modified by use
271 -- of -gnatw_a/_A and set as part of -gnatwa.
273 Warn_On_Assertion_Failure : Boolean renames F (X.Warn_On_Assertion_Failure);
274 -- Set to True to activate warnings on assertions that can be determined
275 -- at compile time will always fail. Modified by use of -gnatw.a/.A.
277 Warn_On_Assumed_Low_Bound : Boolean renames F (X.Warn_On_Assumed_Low_Bound);
278 -- Set to True to activate warnings for string parameters that are indexed
279 -- with literals or S'Length, presumably assuming a lower bound of one.
280 -- Modified by use of -gnatww/W.
282 Warn_On_Atomic_Synchronization : Boolean renames F (X.Warn_On_Atomic_Synchronization);
283 -- Set to True to generate information messages for atomic synchronization.
284 -- Modified by use of -gnatw.n/.N.
286 Warn_On_Bad_Fixed_Value : Boolean renames F (X.Warn_On_Bad_Fixed_Value);
287 -- Set to True to generate warnings for static fixed-point expression
288 -- values that are not an exact multiple of the small value of the type.
289 -- Odd by default, modified by use of -gnatwb/B.
291 Warn_On_Biased_Representation : Boolean renames F (X.Warn_On_Biased_Representation);
292 -- Set to True to generate warnings for size clauses, component clauses
293 -- and component_size clauses that force biased representation. Modified
294 -- by use of -gnatw.b/.B.
296 Warn_On_Component_Order : Boolean renames F (X.Warn_On_Component_Order);
297 -- Warn when record component clauses are out of order with respect to the
298 -- component declarations, or if the memory layout is out of order with
299 -- respect to component declarations and clauses. Off by default, set by
300 -- -gnatw_r (but not -gnatwa).
302 Warn_On_Constant : Boolean renames F (X.Warn_On_Constant);
303 -- Set to True to generate warnings for variables that could be declared
304 -- as constants. Modified by use of -gnatwk/K.
306 Warn_On_Deleted_Code : Boolean renames F (X.Warn_On_Deleted_Code);
307 -- Set to True to generate warnings for code deleted by the front end
308 -- for conditional statements whose outcome is known at compile time.
309 -- Modified by use of -gnatwt/T.
311 Warn_On_Dereference : Boolean renames F (X.Warn_On_Dereference);
312 -- Set to True to generate warnings for implicit dereferences for array
313 -- indexing and record component access. Modified by use of -gnatwd/D.
315 Warn_On_Elab_Access : Boolean renames F (X.Warn_On_Elab_Access);
316 -- Set to True to generate warnings for P'Access in the case where
317 -- subprogram P is in the same package as the P'Access, and the P'Access is
318 -- evaluated at package elaboration time, and occurs before the body of P
319 -- has been elaborated. Modified by use of -gnatw.f/.F.
321 Warn_On_Export_Import : Boolean renames F (X.Warn_On_Export_Import);
322 -- Set to True to generate warnings for suspicious use of export or
323 -- import pragmas. Modified by use of -gnatwx/X.
325 Warn_On_Hiding : Boolean renames F (X.Warn_On_Hiding);
326 -- Set to True to generate warnings if a declared entity hides another
327 -- entity. The default is that this warning is suppressed. Modified by
328 -- use of -gnatwh/H.
330 Warn_On_Ignored_Equality : Boolean renames F (X.Warn_On_Ignored_Equality);
331 -- Warn when a user-defined "=" function does not compose (i.e. is ignored
332 -- for a predefined "=" for a composite type containing a component of
333 -- whose type has the user-defined "=" as primitive). Off by default, and
334 -- set by -gnatw_q (but not -gnatwa).
336 Warn_On_Late_Primitives : Boolean renames F (X.Warn_On_Late_Primitives);
337 -- Warn when tagged type public primitives are defined after its private
338 -- extensions.
340 Warn_On_Modified_Unread : Boolean renames F (X.Warn_On_Modified_Unread);
341 -- Set to True to generate warnings if a variable is assigned but is never
342 -- read. Also controls warnings for similar cases involving out parameters,
343 -- but only if there is only one out parameter for the procedure involved.
344 -- The default is that this warning is suppressed, modified by use of
345 -- -gnatwm/M.
347 Warn_On_No_Value_Assigned : Boolean renames F (X.Warn_On_No_Value_Assigned);
348 -- Set to True to generate warnings if no value is ever assigned to a
349 -- variable that is at least partially uninitialized. Set to false to
350 -- suppress such warnings. The default is that such warnings are enabled.
351 -- Modified by use of -gnatwv/V.
353 Warn_On_Non_Local_Exception : Boolean renames F (X.Warn_On_Non_Local_Exception);
354 -- Set to True to generate warnings for non-local exception raises and also
355 -- handlers that can never handle a local raise. This warning is only ever
356 -- generated if pragma Restrictions (No_Exception_Propagation) is set. The
357 -- default is not to generate the warnings except that if the source has
358 -- at least one exception handler, and this restriction is set, and the
359 -- warning was not explicitly turned off, then it is turned on by default.
360 -- Modified by use of -gnatw.x/.X.
362 No_Warn_On_Non_Local_Exception : Boolean renames F (X.No_Warn_On_Non_Local_Exception);
363 -- This is set to True if the above warning is explicitly suppressed. We
364 -- use this to avoid turning it on by default when No_Exception_Propagation
365 -- restriction is set and an exception handler is present.
367 Warn_On_Object_Renames_Function : Boolean renames F (X.Warn_On_Object_Renames_Function);
368 -- Set to True to generate warnings when a function result is renamed as
369 -- an object. The default is that this warning is disabled. Modified by
370 -- use of -gnatw.r/.R.
372 Warn_On_Obsolescent_Feature : Boolean renames F (X.Warn_On_Obsolescent_Feature);
373 -- Set to True to generate warnings on use of any feature in Annex or if a
374 -- subprogram is called for which a pragma Obsolescent applies. Modified
375 -- by use of -gnatwj/J.
377 Warn_On_Overlap : Boolean renames F (X.Warn_On_Overlap);
378 -- Set to True to generate warnings when a writable actual overlaps with
379 -- another actual in a subprogram call. This applies only in modes before
380 -- Ada 2012. Starting with Ada 2012, such overlaps are illegal.
381 -- Modified by use of -gnatw.i/.I.
383 Warn_On_Overridden_Size : Boolean renames F (X.Warn_On_Overridden_Size);
384 -- Warn when explicit record component clause or array component_size
385 -- clause specifies a size that overrides a size for the type which was
386 -- set with an explicit size clause. Off by default, modified by use of
387 -- -gnatw.s/.S (but not -gnatwa).
389 Warn_On_Parameter_Order : Boolean renames F (X.Warn_On_Parameter_Order);
390 -- Set to True to generate warnings for cases where the argument list for
391 -- a call is a sequence of identifiers that match the formal identifiers,
392 -- but are in the wrong order.
394 Warn_On_Pedantic_Checks : Boolean renames F (X.Warn_On_Pedantic_Checks);
395 -- Warn for violation of miscellaneous pedantic rules (such as when the
396 -- subtype of a formal parameter given in a subprogram body's specification
397 -- comes from a different subtype declaration that the subtype of the
398 -- formal in the subprogram declaration). Off by default, and set by
399 -- -gnatw_p (but not -gnatwa).
401 Warn_On_Questionable_Layout : Boolean renames F (X.Warn_On_Questionable_Layout);
402 -- Warn when default layout of a record type is questionable for run-time
403 -- efficiency reasons and would be improved by reordering the components.
404 -- Off by default, modified by use of -gnatw.q/.Q (but not -gnatwa).
406 function Get_Warn_On_Questionable_Layout return Boolean is
407 (Warn_On_Questionable_Layout);
408 -- WARNING: There is a matching C declaration of this function in fe.h
410 Warn_On_Questionable_Missing_Parens : Boolean renames F (X.Warn_On_Questionable_Missing_Parens);
411 -- Set to True to generate warnings for cases where parentheses are missing
412 -- and the usage is questionable, because the intent is unclear. On by
413 -- default, modified by use of -gnatwq/Q.
415 Warn_On_Record_Holes : Boolean renames F (X.Warn_On_Record_Holes);
416 -- Warn when explicit record component clauses leave uncovered holes (gaps)
417 -- in a record layout. Off by default, set by -gnatw.h (but not -gnatwa).
419 Warn_On_Redundant_Constructs : Boolean renames F (X.Warn_On_Redundant_Constructs);
420 -- Set to True to generate warnings for redundant constructs (e.g. useless
421 -- assignments/conversions). The default is that this warning is disabled.
422 -- Modified by use of -gnatwr/R.
424 Warn_On_Reverse_Bit_Order : Boolean renames F (X.Warn_On_Reverse_Bit_Order);
425 -- Set to True to generate warning (informational) messages for component
426 -- clauses that are affected by non-standard bit-order. The default is
427 -- that this warning is enabled. Modified by -gnatw.v/.V.
429 Warn_On_Size_Alignment : Boolean renames F (X.Warn_On_Size_Alignment);
430 -- Warn when explicit Size and Alignment clauses are given for a type, and
431 -- the size is not a multiple of the alignment. Off by default, modified
432 -- by use of -gnatw.z/.Z and set as part of -gnatwa.
434 Warn_On_Standard_Redefinition : Boolean renames F (X.Warn_On_Standard_Redefinition);
435 -- Warn when a program defines an identifier that matches a name in
436 -- Standard. Off by default, modified by use of -gnatw.k/.K (but not
437 -- by -gnatwa).
439 Warn_On_Suspicious_Contract : Boolean renames F (X.Warn_On_Suspicious_Contract);
440 -- Set to True to generate warnings for suspicious contracts expressed as
441 -- pragmas or aspects precondition and postcondition, as well as other
442 -- suspicious cases of expressions typically found in contracts like
443 -- quantified expressions and uses of Update attribute. The default is that
444 -- this warning is enabled. Modified by use of -gnatw.t/.T.
446 Warn_On_Suspicious_Modulus_Value : Boolean renames F (X.Warn_On_Suspicious_Modulus_Value);
447 -- Set to True to generate warnings for suspicious modulus values, as well
448 -- as negative literals of a modular type. The default is that this warning
449 -- is enabled. Modified by -gnatw.m/.M.
451 Warn_On_Unchecked_Conversion : Boolean renames F (X.Warn_On_Unchecked_Conversion);
452 -- Set to True to generate warnings for unchecked conversions that may have
453 -- non-portable semantics (e.g. because sizes of types differ). Modified
454 -- by use of -gnatwz/Z.
456 Warn_On_Unknown_Compile_Time_Warning : Boolean renames F (X.Warn_On_Unknown_Compile_Time_Warning);
457 -- Warn on a pragma Compile_Time_Warning whose condition has a value that
458 -- is not known at compile time. On by default, modified by use
459 -- of -gnatw_c/_C and set as part of -gnatwa.
461 Warn_On_Unordered_Enumeration_Type : Boolean renames F (X.Warn_On_Unordered_Enumeration_Type);
462 -- Set to True to generate warnings for inappropriate uses (comparisons
463 -- and explicit ranges) on unordered enumeration types (which includes
464 -- all enumeration types for which pragma Ordered is not given). The
465 -- default is that this warning is disabled. Modified by -gnat.u/.U.
467 Warn_On_Unrecognized_Pragma : Boolean renames F (X.Warn_On_Unrecognized_Pragma);
468 -- Set to True to generate warnings for unrecognized pragmas. The default
469 -- is that this warning is enabled. Modified by use of -gnatwg/G.
471 Warn_On_Unrepped_Components : Boolean renames F (X.Warn_On_Unrepped_Components);
472 -- Set to True to generate warnings for the case of components of record
473 -- which have a record representation clause but this component does not
474 -- have a component clause. Modified by use of -gnatw.c/.C.
476 Warn_On_Warnings_Off : Boolean renames F (X.Warn_On_Warnings_Off);
477 -- Set to True to generate warnings for use of Pragma Warnings (Off, ent),
478 -- where either the pragma is never used, or it could be replaced by a
479 -- pragma Unmodified or Unreferenced. Also generates warnings for pragma
480 -- Warning (Off, string) which either has no matching pragma Warning On,
481 -- or where no warning has been suppressed by the use of the pragma.
482 -- Modified by use of -gnatw.w/.W.
483 pragma Style_Checks ("M79");
485 -----------------------------------
486 -- Saving and Restoring Warnings --
487 -----------------------------------
489 function Save_Warnings return Warnings_State;
490 -- Returns current settings of warnings
492 procedure Restore_Warnings (W : Warnings_State);
493 -- Restores current settings of warning flags from W
495 -----------------
496 -- Subprograms --
497 -----------------
499 type Warning_Family is
500 -- The "family" indicates the form of warning switch:
501 (Plain, -- form "-gnatwx"
502 '.', -- form "-gnatw.x"
503 '_'); -- form "-gnatw_x"
504 -- where "x" is a lowercase letter that enables a particular warning.
505 -- Typically, uppercase of "x" disables the warning, but there are some
506 -- switches that do not follow that pattern.
508 function Set_Warning_Switch
509 (Family : Warning_Family; C : Character) return Boolean;
510 -- Set the warning switch or switches corresponding to the given family and
511 -- character. Returns True for valid warning switch, False for invalid.
512 -- Called for -gnatw... switches, and for pragma Warnings.
514 procedure Set_GNAT_Mode_Warnings;
515 -- Called for -gnatg and -gnatw.g to set GNAT mode warnings. This set of
516 -- warnings is neither a subset nor a superset of -gnatwa.
518 end Warnsw;