Pragma Unused (GNAT Reference Manual) (original) (raw)
2.199 Pragma Unused ¶
Syntax:
pragma Unused (LOCAL_NAME {, LOCAL_NAME});
This pragma signals that the assignable entities (variables,out
parameters, and in out
parameters) whose names are listed deliberately do not get assigned or referenced in the current source unit after the occurrence of the pragma in the current source unit. This suppresses warnings about the entities that are unreferenced and/or not assigned, and, in addition, a warning will be generated if one of these entities gets assigned or subsequently referenced in the same unit as the pragma (in the corresponding body or one of its subunits).
This is particularly useful for clearly signaling that a particular parameter is not modified or referenced, even though the spec suggests that it might be.
For the variable case, warnings are never given for unreferenced variables whose name contains one of the substringsDISCARD, DUMMY, IGNORE, JUNK, UNUSED
in any casing. Such names are typically to be used in cases where such warnings are expected. Thus it is never necessary to use pragma Unused
for such variables, though it is harmless to do so.