Skip to content

Commit

Permalink
Add updating warning ignore file guidance to tools for tracking compi…
Browse files Browse the repository at this point in the history
…ler warnings
  • Loading branch information
nohlson committed Sep 17, 2024
1 parent d493655 commit b8a46a0
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions development-tools/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ by running::

The script can be run locally by providing the compiler output file
(where the output is saved) and the compiler output type
(either ``json`` or ``clang``) to see a list of unique warnings::
(either ``gcc`` or ``clang``) to see a list of unique warnings::

python Tools/build/check_warnings.py --compiler-output-file-path=compiler_output.txt --compiler-output-type=json

.. note:: The ``-fdiagnostics-format=json`` flag is required when compiling with GCC
for the script to properly parse the compiler output.
python Tools/build/check_warnings.py --compiler-output-file-path=compiler_output.txt --compiler-output-type=gcc

.. _warning-check-failure:

Expand All @@ -49,3 +46,18 @@ If a warning check fails with:
* Document in the PR that the change reduces the number of compiler
warnings. Decrement the count in the platform-specific warning
ignore file or remove the file if the count is now zero.

.. _updating-warning-ignore-file:
Updating the warning ignore file
--------------------------
The warning ignore files can be found in the :cpy-file:`Tools/build/` directory.
Both files and directories can be added to the ignore file. Files can have an explicit warning count or a wildcard count.
Directories must be followed by a wildcard count. Wildcards indicate that 0 or more warnings will be ignored.
The following is an example of the warning ignore file format::
Modules/_ctypes/_ctypes_test_generated.c.h *
Objects/longobject.c 46
Objects/methodobject.c 1
Objects/mimalloc/ *

Using wildcards is reserved for code that is not maintained by CPython, or code that is for tests.
Keep lines in warning ignore files sorted lexicographically.

0 comments on commit b8a46a0

Please sign in to comment.