@@ -664,23 +664,22 @@ justification are documented in a special section of the report file that
664664
665665.. _Using_pragma_Annotate_to_Control_Rule_Exemption :
666666
667- Using pragma ``Annotate `` to Control Rule Exemption
668- ---------------------------------------------------
667+ Using pragma ``Annotate `` to control rule and instance exemption
668+ ----------------------------------------------------------------
669669
670- .. index :: Using pragma Annotate to control rule exemption
671-
672- Rule exemption is controlled by pragma ``Annotate `` when its first
673- argument is 'gnatcheck'. The syntax of ``gnatcheck ``'s
674- exemption control annotations is as follows:
670+ .. index :: using pragma Annotate to control rule and instance exemption
675671
672+ Rule and instance exemption is controlled by pragma ``Annotate `` when its first
673+ argument is 'gnatcheck'. The syntax of ``gnatcheck ``'s exemption control
674+ annotations is as follows:
676675
677676::
678677
679- <pragma_exemption> ::= pragma Annotate (gnatcheck, <exemption_control>, <rule_name > [, <justification>]);
678+ <pragma_exemption> ::= pragma Annotate (gnatcheck, <exemption_control>, <exempted_name > [, <justification>]);
680679
681680 <exemption_control> ::= Exempt_On | Exempt_Off
682681
683- <rule_name> ::= <string_literal>
682+ <exempted_name> ::= <string_literal>
684683
685684 <justification> ::= <expression>
686685
@@ -694,12 +693,19 @@ issues a warning and ignores the additional arguments. If the arguments do not
694693follow the syntax above, ``gnatcheck `` emits a warning and ignores the
695694annotation.
696695
697- The ``rule_name `` argument should be the name of some existing ``gnatcheck ``
698- rule, or the name of a synonym for a rule. Otherwise a warning message is
699- generated and the pragma is ignored. If ``rule_name `` denotes a rule that is
700- not activated by the given ``gnatcheck `` call, the pragma is ignored and no
701- warning is issued. The exception from this rule is that exemption sections for
702- ``Warnings `` rule are fully processed when ``Restrictions `` rule is activated.
696+ The ``exempted_name `` argument should be the name of some existing ``gnatcheck ``
697+ rule, or the name of a rule instance. Otherwise a warning message is generated
698+ and the pragma is ignored. If ``exempted_name `` doesn't denote an activated rule
699+ or a valid instance in the given ``gnatcheck `` call, the pragma is ignored and
700+ no warning is issued. The exception from this rule is that exemption sections
701+ for ``Warnings `` rule are fully processed when ``Restrictions `` rule is
702+ activated.
703+
704+ .. attention ::
705+
706+ Please not that for now it isn't possible to provide an exempted name which
707+ designates an instance of a compiler-based rule (``Warnings ``,
708+ ``Style_Checks `` and ``Restrictions ``).
703709
704710A source code section where an exemption is active for a given rule is
705711delimited by an ``exempt_on `` and ``exempt_off `` annotation pair:
@@ -710,9 +716,14 @@ delimited by an ``exempt_on`` and ``exempt_off`` annotation pair:
710716 -- source code section
711717 pragma Annotate (gnatcheck, Exempt_Off, "Rule_Name");
712718
713- For some rules it is possible specify rule parameter(s) when defining
714- an exemption section for a rule. This means that only the checks
715- corresponding to the given rule parameter(s) are exempted in this section:
719+ Using such annotations will exempt all violations of the rule designated by
720+ ``Rule_Name `` inside the exempted source section. But you can also provide the
721+ name of a rule instance to only exempt violations raised by this instance.
722+
723+ For some rules it is possible specify rule parameter(s) when defining an
724+ exemption section for a rule or an instance of it. This means that only the
725+ checks corresponding to the given rule parameter(s) are exempted in this
726+ section:
716727
717728.. code-block :: ada
718729
@@ -765,7 +776,7 @@ GNATcheck Annotations Rules
765776
766777* A matching 'Exempt_Off' annotation pragma for an 'Exempt_On' pragma
767778 that defines a parametric exemption section is the pragma that contains
768- exactly the same set of rule parameters for the same rule .
779+ exactly the same set of rule parameters for the same exempted name .
769780
770781* Parametric exemption sections for the same rule with different parameters
771782 can intersect or overlap in case if the parameter sets for such sections
@@ -775,7 +786,7 @@ GNATcheck Annotations Rules
775786 the corresponding rule exemptions are ignored.
776787
777788* When an exempted source code section does not contain at least one violation
778- of the exempted rule , a warning is emitted on :file: `stderr `.
789+ of the exempted name , a warning is emitted on :file: `stderr `.
779790
780791* If an 'Exempt_On' annotation pragma does not have a matching
781792 'Exempt_Off' annotation pragma in the same compilation unit, a warning is
@@ -785,17 +796,17 @@ GNATcheck Annotations Rules
785796
786797.. _using_comments_to_control_rule_exemption :
787798
788- Using comments to control rule exemption
789- ----------------------------------------
799+ Using comments to control rule and instance exemption
800+ -----------------------------------------------------
790801
791- .. index :: using comments to control rule exemption
802+ .. index :: using comments to control rule and instance exemption
792803
793804As an alternative to the ``pragma Annotate `` syntax, it is also possible to use
794805a syntax based on comments, with the following syntax:
795806
796807::
797808
798- <comment_exemption> ::= --## rule (on | off) <rule_name > [## <rule_justification >]
809+ <comment_exemption> ::= --## rule (on | off) <exempted_name > [## <exemption_justification >]
799810
800811Here is an example:
801812
@@ -815,7 +826,7 @@ The rules mentioned in :ref:`gnatcheck_Annotations_Rules` are relaxed, in
815826particular:
816827
817828* Justifications are not checked and are optional;
818- * Anything between the rule name and ``## `` will be ignored;
829+ * Anything between the exempted name and ``## `` will be ignored;
819830* Rules regarding parametric exemption do not apply, as per the notice above.
820831
821832The ``rule on `` marker corresponds to ``Exempt_Off `` and ``rule off `` corresponds
@@ -825,16 +836,16 @@ in a similar fashion as the ones described above.
825836
826837In addition, a shorthand syntax is available to exempt a rule just for one line::
827838
828- <line_comment_exemption> ::= --## rule line off <rule_name > [## <rule_justification>]
839+ <line_comment_exemption> ::= --## rule line off <exempted_name > [## <rule_justification>]
829840
830841For instance, from the previous example:
831842
832843.. code-block :: ada
833844
834845 procedure Bar (A : Integer); --## rule line off implicit_in ## Exemption justification
835846
836- This will exempt the given rule only for the line on which this comment is
837- placed, and automatically turn it back on on the next line.
847+ This will exempt the given rule or instance only for the line on which this
848+ comment is placed, and automatically turn it back on on the next line.
838849
839850.. _Using_GNATcheck_as_a_KP_Detector :
840851
0 commit comments