Skip to content

Commit 0268e3c

Browse files
committed
Refactor and clarify GNATkp documentation.
For eng/libadalang/langkit-query-language#164
1 parent 7500bb2 commit 0268e3c

File tree

3 files changed

+74
-70
lines changed

3 files changed

+74
-70
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ testsuite/tests/*/*/*/*.ad[bs] no-precommit-check
33
testsuite/ada_projects/*/*.ad[bs] no-precommit-check
44

55
* text eol=lf
6+
*.bat text eol=crlf
67

78
# No needs
89
*.java no-precommit-check

lkql_checker/doc/gnatcheck_rm/using_gnatcheck.rst

+38-35
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ justified violations. However, exempted violations along with their
520520
justification are documented in a special section of the report file that
521521
``gnatcheck`` generates.
522522

523-
.. _Using_pragma_``Annotate``_to_Control_Rule_Exemption:
523+
.. _Using_pragma_Annotate_to_Control_Rule_Exemption:
524524

525525
Using pragma ``Annotate`` to Control Rule Exemption
526526
---------------------------------------------------
@@ -701,49 +701,41 @@ Using GNATcheck as a Known Problem Detector
701701

702702
If you are a GNAT Pro Assurance customer, you have access to a special
703703
packaging of GNATcheck called ``gnatkp`` (GNAT Known Problem detector)
704-
where the ``gnatcheck`` executable is replaced by ``gnatkp`` and provides
705-
the following main user interface:
704+
where the ``gnatcheck`` executable is replaced by ``gnatkp``, and the
705+
coding standard rules are replaced by rules designed to detect constructs
706+
affected by known problems in official compiler releases. Note that GNATkp
707+
comes in addition and not as a replacement of GNATcheck.
706708

707-
.. code-block:: sh
709+
You can use the command ``gnatkp --help`` to list all the switches
710+
relevant to GNATkp. GNATkp mostly accepts the same command arguments as
711+
GNATcheck and behaves in a similar way, but there are some differences that
712+
are described below.
708713

709-
gnatkp -Pproject -rules +Rkp_xxxx_xxx [+Rkp_xxxx_xxx]
710-
711-
where ``kp_xxxx_xxx`` is the name of a relevant known-problem to detect. You can
712-
get the list of detectors available via the command ``gnatkp -h``. When
713-
combined with the ``--kp-version`` and possibly ``--target`` switches (see
714-
below), ``gnatkp -h`` will only list the detectors relevant to the version
715-
(and target) specified.
716-
717-
Note that GNATkp comes in addition and not as a replacement of GNATcheck: it
718-
only comes with known problem detectors, and does not include coding standard
719-
rules.
720-
721-
The ``gnatkp`` command above will process all the files in the
722-
given project file and run the listed known problem detectors, generating
723-
a list of occurrences on standard error, as well as in a file called
724-
:file:`gnatkp.out`.
725-
726-
Alternatively you can specify the version of GNAT Pro relevant to your
727-
query and let ``gnatkp`` run all the registered known problem detectors
728-
relevant to this version, via the ``--kp-version`` switch, e.g:
714+
The easiest way to use GNATkp is by specifying the version of GNAT Pro that
715+
you have and letting ``gnatkp`` run all known problem detectors
716+
registered for this version, via the switch ``--kp-version``. For example:
729717

730-
.. code-block:: sh
718+
.. code-block:: none
731719
732720
gnatkp -Pproject --kp-version=21.2
733721
734-
will run all the detectors relevant to GNAT Pro 21.2. The list of detectors
735-
will be displayed as info messages, and will also be listed in the file
736-
:file:`gnatkp-rule-list.out`. You can also list them without running the
737-
detectors via:
722+
will run all detectors relevant to GNAT Pro 21.2 on all files in the
723+
project. The list of detectors will be displayed as info messages, and will
724+
also be listed in the file :file:`gnatkp-rule-list.out`. The list of detected
725+
source locations will be generated on standard error, as well as in a file
726+
called :file:`gnatkp.out`.
738727

739-
.. code-block:: sh
728+
You can display the list of detectors without running them by specifying
729+
additionally the ``-h`` switch, e.g.:
730+
731+
.. code-block:: none
740732
741733
gnatkp --kp-version=21.2 -h
742734
743735
You can also combine the ``--kp-version`` switch with the ``--target`` switch
744736
to filter out detectors not relevant for your target, e.g:
745737

746-
.. code-block:: sh
738+
.. code-block:: none
747739
748740
gnatkp -Pproject --kp-version=21.2 --target=powerpc-elf
749741
@@ -753,14 +745,25 @@ target.
753745
Note that you need to have the corresponding target GNAT compiler installed
754746
to use this option. By default, detectors for all targets are enabled.
755747

756-
You can also use the command ``gnatkp --help`` to list all the switches
757-
relevant to ``gnatkp``.
748+
It is also possible to specify the custom list of detectors for GNATkp to run
749+
using the switch ``-rules``:
750+
751+
.. code-block:: none
752+
753+
gnatkp -Pproject -rules +Rkp_xxxx_xxx [+Rkp_xxxx_xxx]
754+
755+
where ``kp_xxxx_xxx`` is the name of a relevant known-problem to detect. You
756+
can get the list of available detectors via the command ``gnatkp -h``. When
757+
combined with the ``--kp-version`` and possibly ``--target`` switches,
758+
``gnatkp -h`` will only list the detectors relevant to the version
759+
(and target) specified.
758760

759761
You can check via the GNAT Tracker interface which known problems are
760762
relevant to your version of GNAT and your target before deciding which
761763
known problems may impact you: most known problems are only relevant to a
762-
specific version of GNAT or a specific target. Do not hesitate to contact the
763-
AdaCore support if needed to identify the relevant entries.
764+
specific version of GNAT, a specific target, or a specific usage profile. Do
765+
not hesitate to contact the AdaCore support if you need help identifying the
766+
entries that may be relevant to you.
764767

765768
.. _Transition_from_ASIS-based_GNATcheck:
766769

user_manual/make.bat

+35-35
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
@ECHO OFF
2-
3-
pushd %~dp0
4-
5-
REM Command file for Sphinx documentation
6-
7-
if "%SPHINXBUILD%" == "" (
8-
set SPHINXBUILD=sphinx-build
9-
)
10-
set SOURCEDIR=source
11-
set BUILDDIR=build
12-
13-
if "%1" == "" goto help
14-
15-
%SPHINXBUILD% >NUL 2>NUL
16-
if errorlevel 9009 (
17-
echo.
18-
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19-
echo.installed, then set the SPHINXBUILD environment variable to point
20-
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21-
echo.may add the Sphinx directory to PATH.
22-
echo.
23-
echo.If you don't have Sphinx installed, grab it from
24-
echo.http://sphinx-doc.org/
25-
exit /b 1
26-
)
27-
28-
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29-
goto end
30-
31-
:help
32-
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33-
34-
:end
35-
popd
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

0 commit comments

Comments
 (0)