pragma Warnings (On | Off [, local_NAME]); pragma Warnings (static_string_EXPRESSION);
Normally warnings are enabled, with the output being controlled by
the command line switch. Warnings (
Off) turns off generation of
warnings until a Warnings (
On) is encountered or the end of the
current unit. If generation of warnings is turned off using this
pragma, then no warning messages are output, regardless of the
setting of the command line switches.
The form with a single argument is a configuration pragma.
If the local_NAME parameter is present, warnings are suppressed for
the specified entity. This suppression is effective from the point where
it occurs till the end of the extended scope of the variable (similar to
the scope of
The form with a static_string_EXPRESSION argument provides more precise control over which warnings are active. The string is a list of letters specifying which warnings are to be activated and which deactivated. The code for these letters is the same as the string used in the command line switch controlling warnings. The following is a brief summary. For full details see the GNAT Users Guide:
a turn on all optional warnings (except d,h,l) A turn off all optional warnings b turn on warnings for bad fixed value (not multiple of small) B turn off warnings for bad fixed value (not multiple of small) c turn on warnings for constant conditional C turn off warnings for constant conditional d turn on warnings for implicit dereference D turn off warnings for implicit dereference e treat all warnings as errors f turn on warnings for unreferenced formal F turn off warnings for unreferenced formal g turn on warnings for unrecognized pragma G turn off warnings for unrecognized pragma h turn on warnings for hiding variable H turn off warnings for hiding variable i turn on warnings for implementation unit I turn off warnings for implementation unit j turn on warnings for obsolescent (annex J) feature J turn off warnings for obsolescent (annex J) feature k turn on warnings on constant variable K turn off warnings on constant variable l turn on warnings for missing elaboration pragma L turn off warnings for missing elaboration pragma m turn on warnings for variable assigned but not read M turn off warnings for variable assigned but not read n normal warning mode (cancels s/e) o turn on warnings for address clause overlay O turn off warnings for address clause overlay p turn on warnings for ineffective pragma Inline P turn off warnings for ineffective pragma Inline r turn on warnings for redundant construct R turn off warnings for redundant construct s suppress all warnings u turn on warnings for unused entity U turn off warnings for unused entity v turn on warnings for unassigned variable V turn off warnings for unassigned variable x turn on warnings for export/import X turn off warnings for export/import y turn on warnings for Ada 2005 incompatibility Y turn off warnings for Ada 2005 incompatibility z turn on size/align warnings for unchecked conversion Z turn off size/align warnings for unchecked conversion
The specified warnings will be in effect until the end of the program or another pragma Warnings is encountered. The effect of the pragma is cumulative. Initially the set of warnings is the standard default set as possibly modified by compiler switches. Then each pragma Warning modifies this set of warnings as specified.