Ada Programming/Attributes/'Enabled
Description
editThe Enabled
attribute allows an application program to check at compile time to see if the designated check is currently enabled. The prefix is a simple identifier, referencing any predefined check name (other than All_Checks
) or a check name introduced by pragma Check_Name. If no argument is given for the attribute, the check is for the general state of the check, if an argument is given, then it is an entity name, and the check indicates whether an Suppress
or Unsuppress
has been given naming the entity (if not, then the argument is ignored).
Note that instantiations inherit the check status at the point of the instantiation, so a useful idiom is to have a library package that introduces a check name with pragma Check_Name
, and then contains generic packages or subprograms which use the Enabled
attribute to see if the check is enabled. A user of this package can then issue a pragma Suppress
or pragma Unsuppress
before instantiating the package or subprogram, controlling whether the check will be present.