Skip to content

Commit 2175e48

Browse files
committed
Add documentation about compiler-based rule instantiation limitations
1 parent 117bfc2 commit 2175e48

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

lkql_checker/doc/generated/predefined_rules.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4316,6 +4316,21 @@ the pragma ``Restrictions`` or ``Restriction_Warnings``.
43164316
Restrictions: {Arg: ["Max_Task_Entries=>2", "No_Access_Subprograms"]}
43174317
}
43184318
4319+
.. attention::
4320+
It is forbidden to provide the same restriction name in multiple instances
4321+
of the ``Restrictions`` rule. Meaning that such configuration is invalid and
4322+
will cause GNATcheck to issue an error message:
4323+
4324+
.. code-block:: lkql
4325+
4326+
val rules = @{
4327+
Restrictions: [
4328+
{Arg: ["Max_Task_Entries=>2", "No_Access_Subprograms"]},
4329+
{Arg: ["Max_Task_Entries=>6"], instance_name: "Another_Instance"}
4330+
# ^^^^^^^^^^^^^^^^ The "Max_Task_Entries" name is provided in multiple instances of "Restrictions"
4331+
]
4332+
}
4333+
43194334
If your code contains pragmas ``Warnings`` with parameter ``Off``, this may
43204335
result in false negatives for this rule, because the corresponding warnings
43214336
generated during compilation will be suppressed. The workaround is to
@@ -5362,6 +5377,21 @@ mentioned above).
53625377
Warnings: "u"
53635378
}
53645379
5380+
.. attention::
5381+
It is forbidden to provide the same parameter in multiple instance of the
5382+
``Warnings`` rule. Meaning that such configuration is invalid and will cause
5383+
GNATcheck to issue an error message:
5384+
5385+
.. code-block:: lkql
5386+
5387+
val rules = @{
5388+
Warnings: [
5389+
{Arg: "u"},
5390+
{Arg: "u", instance_name: "Another_Instance"}
5391+
# ^-- The "u" parameter is provided in multiple instances of "Warnings"
5392+
]
5393+
}
5394+
53655395
Note that ``s`` and ``e`` parameters, corresponding respectively to GNAT
53665396
``-gnatws`` and ``-gnatwe`` options, are not allowed for the ``Warnings``
53675397
GNATcheck rule since they may have side effects on other rules.
@@ -6236,6 +6266,21 @@ the compiler style check that corresponds to ``-gnatyO`` style check option.
62366266
Style_Checks: "xz"
62376267
}
62386268
6269+
.. attention::
6270+
It is forbidden to provide the same parameter in multiple instances of the
6271+
``Style_Checks`` rule. Meaning that such configuration is invalid and will
6272+
cause GNATcheck to issue an error message:
6273+
6274+
.. code-block:: lkql
6275+
6276+
val rules = @{
6277+
Style_Checks: [
6278+
{Arg: "xz"},
6279+
{Arg: "x", instance_name: "Another_Instance"}
6280+
# ^-- The "x" parameter is provided in multiple instances of "Style_Checks"
6281+
]
6282+
}
6283+
62396284
This rule allows parametric rule exemptions, the parameters
62406285
that are allowed in the definition of exemption sections are the
62416286
same as the parameters of the rule itself.

lkql_checker/doc/stubs/restrictions.lkql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ fun restrictions() =
3232
|" Restrictions: {Arg: ["Max_Task_Entries=>2", "No_Access_Subprograms"]}
3333
|" }
3434
|"
35+
|" .. attention::
36+
|" It is forbidden to provide the same restriction name in multiple instances
37+
|" of the ``Restrictions`` rule. Meaning that such configuration is invalid and
38+
|" will cause GNATcheck to issue an error message:
39+
|"
40+
|" .. code-block:: lkql
41+
|"
42+
|" val rules = @{
43+
|" Restrictions: [
44+
|" {Arg: ["Max_Task_Entries=>2", "No_Access_Subprograms"]},
45+
|" {Arg: ["Max_Task_Entries=>6"], instance_name: "Another_Instance"}
46+
|" # ^^^^^^^^^^^^^^^^ The "Max_Task_Entries" name is provided in multiple instances of "Restrictions"
47+
|" ]
48+
|" }
49+
|"
3550
|" If your code contains pragmas ``Warnings`` with parameter ``Off``, this may
3651
|" result in false negatives for this rule, because the corresponding warnings
3752
|" generated during compilation will be suppressed. The workaround is to

lkql_checker/doc/stubs/style_checks.lkql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ fun style_checks() =
4242
|" Style_Checks: "xz"
4343
|" }
4444
|"
45+
|" .. attention::
46+
|" It is forbidden to provide the same parameter in multiple instances of the
47+
|" ``Style_Checks`` rule. Meaning that such configuration is invalid and will
48+
|" cause GNATcheck to issue an error message:
49+
|"
50+
|" .. code-block:: lkql
51+
|"
52+
|" val rules = @{
53+
|" Style_Checks: [
54+
|" {Arg: "xz"},
55+
|" {Arg: "x", instance_name: "Another_Instance"}
56+
|" # ^-- The "x" parameter is provided in multiple instances of "Style_Checks"
57+
|" ]
58+
|" }
59+
|"
4560
|" This rule allows parametric rule exemptions, the parameters
4661
|" that are allowed in the definition of exemption sections are the
4762
|" same as the parameters of the rule itself.

lkql_checker/doc/stubs/warnings.lkql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ fun warnings() =
3434
|" Warnings: "u"
3535
|" }
3636
|"
37+
|" .. attention::
38+
|" It is forbidden to provide the same parameter in multiple instance of the
39+
|" ``Warnings`` rule. Meaning that such configuration is invalid and will cause
40+
|" GNATcheck to issue an error message:
41+
|"
42+
|" .. code-block:: lkql
43+
|"
44+
|" val rules = @{
45+
|" Warnings: [
46+
|" {Arg: "u"},
47+
|" {Arg: "u", instance_name: "Another_Instance"}
48+
|" # ^-- The "u" parameter is provided in multiple instances of "Warnings"
49+
|" ]
50+
|" }
51+
|"
3752
|" Note that ``s`` and ``e`` parameters, corresponding respectively to GNAT
3853
|" ``-gnatws`` and ``-gnatwe`` options, are not allowed for the ``Warnings``
3954
|" GNATcheck rule since they may have side effects on other rules.

0 commit comments

Comments
 (0)