From b8a46a0c8beddf257edb9b95cac017bf9b6f3745 Mon Sep 17 00:00:00 2001 From: mediumshade Date: Tue, 17 Sep 2024 17:44:12 -0500 Subject: [PATCH 1/4] Add updating warning ignore file guidance to tools for tracking compiler warnings --- development-tools/warnings.rst | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/development-tools/warnings.rst b/development-tools/warnings.rst index dc4fb197e..038645a6b 100644 --- a/development-tools/warnings.rst +++ b/development-tools/warnings.rst @@ -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: @@ -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. From 7fe10387eccd0607077d5a46fa8d3458d83884fd Mon Sep 17 00:00:00 2001 From: mediumshade Date: Tue, 17 Sep 2024 18:02:47 -0500 Subject: [PATCH 2/4] Fix formatting issues --- development-tools/warnings.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/development-tools/warnings.rst b/development-tools/warnings.rst index 038645a6b..455a95dc8 100644 --- a/development-tools/warnings.rst +++ b/development-tools/warnings.rst @@ -48,12 +48,15 @@ If a warning check fails with: 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 From b93b035266487e9160730a525cf05b6354ab524e Mon Sep 17 00:00:00 2001 From: Nate Ohlson Date: Wed, 18 Sep 2024 01:03:47 -0500 Subject: [PATCH 3/4] Update development-tools/warnings.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- development-tools/warnings.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/development-tools/warnings.rst b/development-tools/warnings.rst index 455a95dc8..13438807e 100644 --- a/development-tools/warnings.rst +++ b/development-tools/warnings.rst @@ -56,7 +56,6 @@ 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 From 10ee7fdac99491dcd2729183f13e80fc49164ef9 Mon Sep 17 00:00:00 2001 From: mediumshade Date: Wed, 18 Sep 2024 01:07:39 -0500 Subject: [PATCH 4/4] Add newline without indent --- development-tools/warnings.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/development-tools/warnings.rst b/development-tools/warnings.rst index 13438807e..b6448f397 100644 --- a/development-tools/warnings.rst +++ b/development-tools/warnings.rst @@ -56,6 +56,7 @@ 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