From ea7797371856c13ded5db7854b721faa3cda38dc Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 13 Sep 2024 22:47:12 +0300 Subject: [PATCH] Revert "gh-112301: Enable warning emitting options and ignore warnings in CI (#123020)" (#124065) --- .github/workflows/reusable-macos.yml | 18 +- .github/workflows/reusable-ubuntu.yml | 18 +- ...-08-14-19-43-57.gh-issue-112301.IQUcOy.rst | 1 - Tools/build/.warningignore_macos | 227 --------------- Tools/build/.warningignore_ubuntu | 260 ------------------ Tools/build/check_warnings.py | 146 ++++++---- configure | 195 ------------- configure.ac | 5 - 8 files changed, 91 insertions(+), 779 deletions(-) delete mode 100644 Misc/NEWS.d/next/Security/2024-08-14-19-43-57.gh-issue-112301.IQUcOy.rst diff --git a/.github/workflows/reusable-macos.yml b/.github/workflows/reusable-macos.yml index 49613a8ddae..d77723ef27c 100644 --- a/.github/workflows/reusable-macos.yml +++ b/.github/workflows/reusable-macos.yml @@ -35,7 +35,7 @@ jobs: path: config.cache key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }} - name: Install Homebrew dependencies - run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk make + run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk - name: Configure CPython run: | GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \ @@ -48,22 +48,10 @@ jobs: --prefix=/opt/python-dev \ --with-openssl="$(brew --prefix openssl@3.0)" - name: Build CPython - if : ${{ inputs.free-threading || inputs.os != 'macos-13' }} - run: gmake -j8 - - name: Build CPython for compiler warning check - if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }} - run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt + run: set -o pipefail; make -j8 2>&1 | tee compiler_output.txt - name: Display build info run: make pythoninfo - name: Check compiler warnings - if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }} - run: >- - python3 Tools/build/check_warnings.py - --compiler-output-file-path=compiler_output_macos.txt - --warning-ignore-file-path=Tools/build/.warningignore_macos - --compiler-output-type=clang - --fail-on-regression - --fail-on-improvement - --path-prefix="./" + run: python3 Tools/build/check_warnings.py --compiler-output-file-path=compiler_output.txt --warning-ignore-file-path=Tools/build/.warningignore_macos --compiler-output-type=clang - name: Tests run: make test diff --git a/.github/workflows/reusable-ubuntu.yml b/.github/workflows/reusable-ubuntu.yml index f2c83798027..b197db814b2 100644 --- a/.github/workflows/reusable-ubuntu.yml +++ b/.github/workflows/reusable-ubuntu.yml @@ -67,32 +67,20 @@ jobs: working-directory: ${{ env.CPYTHON_BUILDDIR }} run: >- ../cpython-ro-srcdir/configure + CFLAGS="-fdiagnostics-format=json" --config-cache --with-pydebug --enable-slower-safety --with-openssl=$OPENSSL_DIR ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - name: Build CPython out-of-tree - if: ${{ inputs.free-threading }} working-directory: ${{ env.CPYTHON_BUILDDIR }} - run: make -j4 - - name: Build CPython out-of-tree (for compiler warning check) - if: ${{ !inputs.free-threading}} - working-directory: ${{ env.CPYTHON_BUILDDIR }} - run: set -o pipefail; make -j4 2>&1 | tee compiler_output_ubuntu.txt + run: set -o pipefail; make -j4 2>&1 | tee compiler_output.txt - name: Display build info working-directory: ${{ env.CPYTHON_BUILDDIR }} run: make pythoninfo - name: Check compiler warnings - if: ${{ !inputs.free-threading }} - run: >- - python Tools/build/check_warnings.py - --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output_ubuntu.txt - --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu - --compiler-output-type=gcc - --fail-on-regression - --fail-on-improvement - --path-prefix="../cpython-ro-srcdir/" + run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu --compiler-output-type=json - name: Remount sources writable for tests # some tests write to srcdir, lack of pyc files slows down testing run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw diff --git a/Misc/NEWS.d/next/Security/2024-08-14-19-43-57.gh-issue-112301.IQUcOy.rst b/Misc/NEWS.d/next/Security/2024-08-14-19-43-57.gh-issue-112301.IQUcOy.rst deleted file mode 100644 index 9750cf203ee..00000000000 --- a/Misc/NEWS.d/next/Security/2024-08-14-19-43-57.gh-issue-112301.IQUcOy.rst +++ /dev/null @@ -1 +0,0 @@ -Enable compiler options that warn of potential security vulnerabilities. diff --git a/Tools/build/.warningignore_macos b/Tools/build/.warningignore_macos index fffb828eb4a..67f50119db7 100644 --- a/Tools/build/.warningignore_macos +++ b/Tools/build/.warningignore_macos @@ -3,230 +3,3 @@ # Keep lines sorted lexicographically to help avoid merge conflicts. # Format example: # /path/to/file (number of warnings in file) -Include/internal/mimalloc/mimalloc/internal.h 4 -Include/internal/pycore_backoff.h 1 -Include/internal/pycore_dict.h 2 -Include/internal/pycore_gc.h 1 -Include/internal/pycore_long.h 2 -Include/internal/pycore_object.h 4 -Modules/_asynciomodule.c 3 -Modules/_bisectmodule.c 2 -Modules/_bz2module.c 5 -Modules/_collectionsmodule.c 2 -Modules/_csv.c 3 -Modules/_ctypes/_ctypes.c 37 -Modules/_ctypes/_ctypes_test_generated.c.h 141 -Modules/_ctypes/callbacks.c 6 -Modules/_ctypes/callproc.c 15 -Modules/_ctypes/cfield.c 59 -Modules/_ctypes/malloc_closure.c 3 -Modules/_ctypes/stgdict.c 17 -Modules/_cursesmodule.c 24 -Modules/_datetimemodule.c 28 -Modules/_dbmmodule.c 8 -Modules/_decimal/_decimal.c 15 -Modules/_elementtree.c 42 -Modules/_functoolsmodule.c 6 -Modules/_gdbmmodule.c 5 -Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c 84 -Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c 84 -Modules/_hacl/include/krml/FStar_UInt_8_16_32_64.h 24 -Modules/_hashopenssl.c 16 -Modules/_interpchannelsmodule.c 1 -Modules/_interpqueuesmodule.c 1 -Modules/_io/_iomodule.c 1 -Modules/_io/bufferedio.c 4 -Modules/_io/bytesio.c 11 -Modules/_io/fileio.c 9 -Modules/_io/stringio.c 8 -Modules/_io/textio.c 11 -Modules/_json.c 19 -Modules/_localemodule.c 3 -Modules/_lzmamodule.c 10 -Modules/_multiprocessing/semaphore.c 2 -Modules/_operator.c 5 -Modules/_pickle.c 71 -Modules/_posixsubprocess.c 8 -Modules/_queuemodule.c 4 -Modules/_randommodule.c 3 -Modules/_scproxy.c 3 -Modules/_sqlite/connection.c 4 -Modules/_sqlite/cursor.c 3 -Modules/_sqlite/module.c 2 -Modules/_sre/sre.c 18 -Modules/_sre/sre_lib.h 62 -Modules/_ssl.c 29 -Modules/_struct.c 1 -Modules/_testbuffer.c 22 -Modules/_testcapi/heaptype.c 1 -Modules/_testcapi/long.c 2 -Modules/_testcapi/mem.c 2 -Modules/_testcapi/monitoring.c 3 -Modules/_testcapi/pyatomic.c 1 -Modules/_testcapi/unicode.c 2 -Modules/_testcapi/vectorcall.c 3 -Modules/_testcapi/watchers.c 3 -Modules/_testcapimodule.c 3 -Modules/_testclinic.c 14 -Modules/_testexternalinspection.c 8 -Modules/_testinternalcapi.c 8 -Modules/_testinternalcapi/pytime.c 8 -Modules/_testinternalcapi/test_critical_sections.c 1 -Modules/_testinternalcapi/test_lock.c 2 -Modules/_testlimitedcapi/heaptype_relative.c 4 -Modules/_testlimitedcapi/object.c 2 -Modules/_testlimitedcapi/unicode.c 2 -Modules/_threadmodule.c 2 -Modules/_tkinter.c 6 -Modules/_xxtestfuzz/_xxtestfuzz.c 1 -Modules/_xxtestfuzz/fuzzer.c 11 -Modules/_zoneinfo.c 14 -Modules/arraymodule.c 32 -Modules/atexitmodule.c 1 -Modules/binascii.c 206 -Modules/blake2module.c 6 -Modules/cjkcodecs/_codecs_cn.c 1 -Modules/cjkcodecs/_codecs_iso2022.c 2 -Modules/cjkcodecs/_codecs_jp.c 14 -Modules/cjkcodecs/_codecs_kr.c 3 -Modules/cjkcodecs/cjkcodecs.h 1 -Modules/cjkcodecs/multibytecodec.c 2 -Modules/clinic/_testclinic.c.h 1 -Modules/clinic/arraymodule.c.h 1 -Modules/clinic/unicodedata.c.h 10 -Modules/cmathmodule.c 1 -Modules/expat/siphash.h 8 -Modules/expat/xmlparse.c 45 -Modules/expat/xmltok.c 17 -Modules/expat/xmltok_impl.c 34 -Modules/faulthandler.c 3 -Modules/fcntlmodule.c 1 -Modules/getpath.c 7 -Modules/grpmodule.c 4 -Modules/itertoolsmodule.c 7 -Modules/main.c 2 -Modules/mathmodule.c 15 -Modules/mmapmodule.c 20 -Modules/posixmodule.c 67 -Modules/pwdmodule.c 4 -Modules/pyexpat.c 20 -Modules/readline.c 1 -Modules/resource.c 3 -Modules/rotatingtree.c 1 -Modules/selectmodule.c 6 -Modules/sha3module.c 4 -Modules/signalmodule.c 1 -Modules/socketmodule.c 44 -Modules/syslogmodule.c 3 -Modules/timemodule.c 4 -Modules/unicodedata.c 28 -Modules/unicodedata_db.h 1 -Modules/xxsubtype.c 2 -Modules/zlibmodule.c 16 -Objects/abstract.c 2 -Objects/bytearrayobject.c 34 -Objects/bytes_methods.c 9 -Objects/bytesobject.c 35 -Objects/call.c 13 -Objects/classobject.c 4 -Objects/codeobject.c 15 -Objects/descrobject.c 2 -Objects/dictobject.c 28 -Objects/fileobject.c 3 -Objects/floatobject.c 30 -Objects/frameobject.c 19 -Objects/funcobject.c 1 -Objects/genobject.c 5 -Objects/listobject.c 43 -Objects/longobject.c 46 -Objects/memoryobject.c 6 -Objects/methodobject.c 1 -Objects/mimalloc/alloc.c 6 -Objects/mimalloc/arena.c 6 -Objects/mimalloc/heap.c 1 -Objects/mimalloc/init.c 2 -Objects/mimalloc/options.c 1 -Objects/mimalloc/os.c 4 -Objects/mimalloc/page-queue.c 2 -Objects/mimalloc/page.c 1 -Objects/mimalloc/prim/osx/../unix/prim.c 2 -Objects/mimalloc/random.c 1 -Objects/mimalloc/segment.c 11 -Objects/mimalloc/stats.c 1 -Objects/moduleobject.c 2 -Objects/object.c 1 -Objects/obmalloc.c 6 -Objects/odictobject.c 3 -Objects/rangeobject.c 10 -Objects/setobject.c 13 -Objects/sliceobject.c 4 -Objects/stringlib/codecs.h 26 -Objects/stringlib/eq.h 1 -Objects/stringlib/fastsearch.h 14 -Objects/stringlib/join.h 1 -Objects/stringlib/replace.h 4 -Objects/stringlib/repr.h 21 -Objects/stringlib/transmogrify.h 5 -Objects/structseq.c 14 -Objects/tupleobject.c 10 -Objects/typeobject.c 17 -Objects/unicodectype.c 7 -Objects/unicodeobject.c 113 -Parser/action_helpers.c 4 -Parser/lexer/buffer.c 1 -Parser/lexer/lexer.c 12 -Parser/parser.c 116 -Parser/pegen.c 7 -Parser/string_parser.c 7 -Parser/tokenizer/file_tokenizer.c 8 -Parser/tokenizer/helpers.c 7 -Parser/tokenizer/readline_tokenizer.c 3 -Programs/_freeze_module.c 1 -Python/Python-ast.c 15 -Python/asdl.c 3 -Python/assemble.c 7 -Python/ast_opt.c 7 -Python/bltinmodule.c 9 -Python/bootstrap_hash.c 4 -Python/ceval.c 8 -Python/ceval_gil.c 2 -Python/codecs.c 32 -Python/codegen.c 6 -Python/compile.c 2 -Python/context.c 1 -Python/crossinterp.c 2 -Python/crossinterp_data_lookup.h 1 -Python/dtoa.c 34 -Python/errors.c 1 -Python/fileutils.c 7 -Python/flowgraph.c 8 -Python/formatter_unicode.c 7 -Python/frame.c 4 -Python/gc.c 8 -Python/generated_cases.c.h 35 -Python/getargs.c 11 -Python/import.c 5 -Python/initconfig.c 11 -Python/instrumentation.c 31 -Python/intrinsics.c 1 -Python/legacy_tracing.c 3 -Python/lock.c 4 -Python/marshal.c 11 -Python/modsupport.c 3 -Python/mystrtoul.c 4 -Python/pathconfig.c 1 -Python/preconfig.c 2 -Python/pyarena.c 1 -Python/pyhash.c 2 -Python/pylifecycle.c 7 -Python/pystate.c 6 -Python/pystrhex.c 19 -Python/pystrtod.c 3 -Python/qsbr.c 2 -Python/specialize.c 10 -Python/suggestions.c 12 -Python/symtable.c 18 -Python/sysmodule.c 2 -Python/thread_pthread.h 1 -Python/traceback.c 6 -Python/tracemalloc.c 6 diff --git a/Tools/build/.warningignore_ubuntu b/Tools/build/.warningignore_ubuntu index e98305e8180..469c727abfb 100644 --- a/Tools/build/.warningignore_ubuntu +++ b/Tools/build/.warningignore_ubuntu @@ -3,263 +3,3 @@ # Keep lines sorted lexicographically to help avoid merge conflicts. # Format example: # /path/to/file (number of warnings in file) -/home/runner/work/cpython/cpython/multissl/openssl/3.0.15/include/openssl/evp.h 2 -/home/runner/work/cpython/cpython/multissl/openssl/3.0.15/include/openssl/ssl.h 4 -/usr/include/tcl8.6/tclTomMathDecls.h 1 -Include/cpython/bytearrayobject.h 1 -Include/cpython/bytesobject.h 3 -Include/cpython/dictobject.h 2 -Include/cpython/listobject.h 1 -Include/cpython/pyctype.h 2 -Include/cpython/tupleobject.h 1 -Include/cpython/unicodeobject.h 7 -Include/internal/mimalloc/mimalloc/internal.h 4 -Include/internal/mimalloc/mimalloc/types.h 2 -Include/internal/pycore_asdl.h 1 -Include/internal/pycore_backoff.h 3 -Include/internal/pycore_blocks_output_buffer.h 1 -Include/internal/pycore_dict.h 2 -Include/internal/pycore_gc.h 1 -Include/internal/pycore_gc.h 1 -Include/internal/pycore_interp.h 1 -Include/internal/pycore_list.h 1 -Include/internal/pycore_long.h 3 -Include/internal/pycore_object.h 4 -Include/internal/pycore_obmalloc.h 1 -Include/internal/pycore_pymath.h 1 -Include/internal/pycore_runtime_init.h 1 -Include/longobject.h 1 -Include/object.h 4 -Include/opcode_ids.h 1 -Include/pymacro.h 4 -Include/pymath.h 1 -Include/pymem.h 2 -Include/pyport.h 2 -Modules/_asynciomodule.c 3 -Modules/_bisectmodule.c 4 -Modules/_bz2module.c 5 -Modules/_collectionsmodule.c 2 -Modules/_csv.c 2 -Modules/_ctypes/_ctypes.c 53 -Modules/_ctypes/_ctypes_test.c 7 -Modules/_ctypes/_ctypes_test_generated.c.h 2 -Modules/_ctypes/callbacks.c 3 -Modules/_ctypes/callproc.c 13 -Modules/_ctypes/cfield.c 33 -Modules/_ctypes/stgdict.c 17 -Modules/_cursesmodule.c 27 -Modules/_datetimemodule.c 38 -Modules/_datetimemodule.c 38 -Modules/_dbmmodule.c 7 -Modules/_decimal/_decimal.c 19 -Modules/_elementtree.c 37 -Modules/_functoolsmodule.c 6 -Modules/_gdbmmodule.c 4 -Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c 84 -Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c 84 -Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c 84 -Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c 84 -Modules/_hacl/include/krml/FStar_UInt_8_16_32_64.h 4 -Modules/_hashopenssl.c 13 -Modules/_io/_iomodule.c 1 -Modules/_io/bufferedio.c 15 -Modules/_io/bytesio.c 14 -Modules/_io/fileio.c 9 -Modules/_io/stringio.c 8 -Modules/_io/textio.c 17 -Modules/_json.c 19 -Modules/_localemodule.c 2 -Modules/_lsprof.c 5 -Modules/_lzmamodule.c 6 -Modules/_multiprocessing/posixshmem.c 1 -Modules/_multiprocessing/semaphore.c 1 -Modules/_operator.c 5 -Modules/_pickle.c 73 -Modules/_posixsubprocess.c 11 -Modules/_queuemodule.c 4 -Modules/_randommodule.c 3 -Modules/_sqlite/connection.c 5 -Modules/_sqlite/cursor.c 3 -Modules/_sqlite/module.c 2 -Modules/_sre/sre.c 14 -Modules/_sre/sre_lib.h 25 -Modules/_ssl.c 26 -Modules/_struct.c 3 -Modules/_testbuffer.c 27 -Modules/_testcapi/bytes.c 1 -Modules/_testcapi/heaptype.c 1 -Modules/_testcapi/long.c 2 -Modules/_testcapi/mem.c 2 -Modules/_testcapi/monitoring.c 3 -Modules/_testcapi/pyatomic.c 4 -Modules/_testcapi/pyatomic.c 4 -Modules/_testcapi/unicode.c 1 -Modules/_testcapi/vectorcall.c 3 -Modules/_testcapi/watchers.c 3 -Modules/_testcapimodule.c 1 -Modules/_testclinic.c 14 -Modules/_testclinic.c 14 -Modules/_testexternalinspection.c 7 -Modules/_testinternalcapi.c 10 -Modules/_testinternalcapi/test_critical_sections.c 1 -Modules/_testinternalcapi/test_lock.c 4 -Modules/_testlimitedcapi/heaptype_relative.c 3 -Modules/_testlimitedcapi/object.c 2 -Modules/_testlimitedcapi/unicode.c 1 -Modules/_testmultiphase.c 1 -Modules/_tkinter.c 8 -Modules/_xxtestfuzz/_xxtestfuzz.c 1 -Modules/_xxtestfuzz/fuzzer.c 13 -Modules/_zoneinfo.c 17 -Modules/arraymodule.c 48 -Modules/binascii.c 208 -Modules/blake2module.c 8 -Modules/cjkcodecs/_codecs_iso2022.c 1 -Modules/cjkcodecs/_codecs_jp.c 17 -Modules/cjkcodecs/_codecs_kr.c 7 -Modules/cjkcodecs/alg_jisx0201.h 2 -Modules/cjkcodecs/cjkcodecs.h 1 -Modules/cjkcodecs/multibytecodec.c 12 -Modules/expat/pyexpatns.h 3 -Modules/expat/siphash.h 1 -Modules/expat/xmlparse.c 43 -Modules/expat/xmltok.c 15 -Modules/expat/xmltok.c 15 -Modules/expat/xmltok_impl.c 8 -Modules/faulthandler.c 5 -Modules/fcntlmodule.c 6 -Modules/getpath.c 7 -Modules/grpmodule.c 4 -Modules/itertoolsmodule.c 4 -Modules/main.c 2 -Modules/mathmodule.c 14 -Modules/mmapmodule.c 22 -Modules/mmapmodule.c 22 -Modules/posixmodule.c 79 -Modules/pwdmodule.c 4 -Modules/pyexpat.c 10 -Modules/readline.c 1 -Modules/resource.c 4 -Modules/rotatingtree.c 2 -Modules/selectmodule.c 1 -Modules/sha3module.c 4 -Modules/signalmodule.c 3 -Modules/socketmodule.c 75 -Modules/syslogmodule.c 3 -Modules/termios.c 1 -Modules/timemodule.c 10 -Modules/unicodedata.c 24 -Modules/unicodedata_db.h 1 -Modules/zlibmodule.c 24 -Objects/abstract.c 6 -Objects/bytearrayobject.c 42 -Objects/bytes_methods.c 4 -Objects/bytesobject.c 45 -Objects/call.c 12 -Objects/classobject.c 4 -Objects/codeobject.c 19 -Objects/descrobject.c 2 -Objects/dictobject.c 31 -Objects/fileobject.c 3 -Objects/floatobject.c 10 -Objects/frameobject.c 16 -Objects/funcobject.c 1 -Objects/genobject.c 3 -Objects/listobject.c 38 -Objects/longobject.c 47 -Objects/memoryobject.c 12 -Objects/methodobject.c 1 -Objects/mimalloc/alloc.c 6 -Objects/mimalloc/arena.c 6 -Objects/mimalloc/heap.c 2 -Objects/mimalloc/init.c 2 -Objects/mimalloc/options.c 4 -Objects/mimalloc/os.c 4 -Objects/mimalloc/page-queue.c 2 -Objects/mimalloc/page.c 2 -Objects/mimalloc/prim/unix/prim.c 6 -Objects/mimalloc/random.c 1 -Objects/mimalloc/segment.c 11 -Objects/mimalloc/stats.c 5 -Objects/moduleobject.c 4 -Objects/object.c 1 -Objects/obmalloc.c 6 -Objects/odictobject.c 6 -Objects/rangeobject.c 10 -Objects/setobject.c 13 -Objects/sliceobject.c 2 -Objects/stringlib/codecs.h 12 -Objects/stringlib/eq.h 1 -Objects/stringlib/fastsearch.h 8 -Objects/stringlib/join.h 3 -Objects/stringlib/replace.h 4 -Objects/stringlib/repr.h 21 -Objects/stringlib/transmogrify.h 26 -Objects/structseq.c 10 -Objects/tupleobject.c 8 -Objects/typeobject.c 38 -Objects/unicodectype.c 7 -Objects/unicodeobject.c 135 -Parser/action_helpers.c 3 -Parser/lexer/buffer.c 1 -Parser/lexer/lexer.c 14 -Parser/parser.c 116 -Parser/pegen.c 8 -Parser/string_parser.c 7 -Parser/tokenizer/file_tokenizer.c 9 -Parser/tokenizer/helpers.c 7 -Parser/tokenizer/readline_tokenizer.c 4 -Python/assemble.c 11 -Python/ast_opt.c 5 -Python/bltinmodule.c 8 -Python/bootstrap_hash.c 7 -Python/ceval.c 8 -Python/ceval_gil.c 2 -Python/codecs.c 28 -Python/codegen.c 6 -Python/compile.c 2 -Python/context.c 1 -Python/crossinterp.c 2 -Python/crossinterp_data_lookup.h 1 -Python/dtoa.c 30 -Python/errors.c 1 -Python/fileutils.c 11 -Python/flowgraph.c 7 -Python/formatter_unicode.c 6 -Python/frame.c 3 -Python/gc.c 9 -Python/gc.c 9 -Python/generated_cases.c.h 27 -Python/generated_cases.c.h 27 -Python/getargs.c 7 -Python/hashtable.c 1 -Python/import.c 6 -Python/import.c 7 -Python/initconfig.c 11 -Python/instrumentation.c 43 -Python/intrinsics.c 1 -Python/legacy_tracing.c 3 -Python/lock.c 4 -Python/marshal.c 16 -Python/modsupport.c 3 -Python/mystrtoul.c 4 -Python/pathconfig.c 1 -Python/perf_jit_trampoline.c 32 -Python/perf_trampoline.c 12 -Python/preconfig.c 2 -Python/pyarena.c 1 -Python/pyhash.c 4 -Python/pylifecycle.c 3 -Python/pystate.c 4 -Python/pystrhex.c 15 -Python/pystrtod.c 12 -Python/pytime.c 2 -Python/qsbr.c 2 -Python/specialize.c 9 -Python/suggestions.c 12 -Python/symtable.c 15 -Python/sysmodule.c 2 -Python/thread.c 1 -Python/thread_pthread.h 6 -Python/traceback.c 6 -Python/tracemalloc.c 6 diff --git a/Tools/build/check_warnings.py b/Tools/build/check_warnings.py index a9d0c1eeddb..1ed83447b6b 100644 --- a/Tools/build/check_warnings.py +++ b/Tools/build/check_warnings.py @@ -1,49 +1,38 @@ """ -Parses compiler output from Clang or GCC and checks that warnings +Parses compiler output with -fdiagnostics-format=json and checks that warnings exist only in files that are expected to have warnings. """ import argparse from collections import defaultdict +import json import re import sys from pathlib import Path from typing import NamedTuple - class FileWarnings(NamedTuple): name: str count: int -def extract_warnings_from_compiler_output( +def extract_warnings_from_compiler_output_clang( compiler_output: str, - compiler_output_type: str, - path_prefix: str = "", ) -> list[dict]: """ - Extracts warnings from the compiler output based on compiler - output type. Removes path prefix from file paths if provided. - Compatible with GCC and Clang compiler output. + Extracts warnings from the compiler output when using clang """ - # Choose pattern and compile regex for particular compiler output - if compiler_output_type == "gcc": - regex_pattern = ( - r"(?P.*):(?P\d+):(?P\d+): warning: " - r"(?P.*?)(?: (?P