8000 gh-112301: Enable warning emitting options and ignore warnings in CI … · python/cpython@cfe6074 · GitHub
[go: up one dir, main page]

Skip to content

Commit cfe6074

Browse files
nohlsonhugovkblurb-it[bot]
authored
gh-112301: Enable warning emitting options and ignore warnings in CI (#123020)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent b46c65e commit cfe6074

File tree

8 files changed

+779
-91
lines changed
  • 8 files changed

    +779
    -91
    lines changed

    .github/workflows/reusable-macos.yml

    Lines changed: 15 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -35,7 +35,7 @@ jobs:
    3535
    path: config.cache
    3636
    key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
    3737
    - name: Install Homebrew dependencies
    38-
    run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk
    38+
    run: brew install pkg-config openssl@3.0 xz gdbm tcl-tk make
    3939
    - name: Configure CPython
    4040
    run: |
    4141
    GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
    @@ -48,10 +48,22 @@ jobs:
    4848
    --prefix=/opt/python-dev \
    4949
    --with-openssl="$(brew --prefix openssl@3.0)"
    5050
    - name: Build CPython
    51-
    run: set -o pipefail; make -j8 2>&1 | tee compiler_output.txt
    51+
    if : ${{ inputs.free-threading || inputs.os != 'macos-13' }}
    52+
    run: gmake -j8
    53+
    - name: Build CPython for compiler warning check
    54+
    if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
    55+
    run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
    5256
    - name: Display build info
    5357
    run: make pythoninfo
    5458
    - name: Check compiler warnings
    55-
    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
    59+
    if : ${{ !inputs.free-threading && inputs.os == 'macos-13' }}
    60+
    run: >-
    61+
    python3 Tools/build/check_warnings.py
    62+
    --compiler-output-file-path=compiler_output_macos.txt
    63+
    --warning-ignore-file-path=Tools/build/.warningignore_macos
    64+
    --compiler-output-type=clang
    65+
    --fail-on-regression
    66+
    --fail-on-improvement
    67+
    --path-prefix="./"
    5668
    - name: Tests
    5769
    run: make test

    .github/workflows/reusable-ubuntu.yml

    Lines changed: 15 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -67,20 +67,32 @@ jobs:
    6767
    working-directory: ${{ env.CPYTHON_BUILDDIR }}
    6868
    run: >-
    6969
    ../cpython-ro-srcdir/configure
    70-
    CFLAGS="-fdiagnostics-format=json"
    7170
    --config-cache
    7271
    --with-pydebug
    7372
    --enable-slower-safety
    7473
    --with-openssl=$OPENSSL_DIR
    7574
    ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
    7675
    - name: Build CPython out-of-tree
    76+
    if: ${{ inputs.free-threading }}
    7777
    working-directory: ${{ env.CPYTHON_BUILDDIR }}
    78-
    run: set -o pipefail; make -j4 2>&1 | tee compiler_output.txt
    78+
    run: make -j4
    79+
    - name: Build CPython out-of-tree (for compiler warning check)
    80+
    if: ${{ !inputs.free-threading}}
    81+
    working-directory: ${{ env.CPYTHON_BUILDDIR }}
    82+
    run: set -o pipefail; make -j4 2>&1 | tee compiler_output_ubuntu.txt
    7983
    - name: Display build info
    8084
    working-directory: ${{ env.CPYTHON_BUILDDIR }}
    8185
    run: make pythoninfo
    8286
    - name: Check compiler warnings
    83-
    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
    87+
    if: ${{ !inputs.free-threading }}
    88+
    run: >-
    89+
    python Tools/build/check_warnings.py
    90+
    --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output_ubuntu.txt
    91+
    --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu
    92+
    --compiler-output-type=gcc
    93+
    --fail-on-regression
    94+
    --fail-on-improvement
    95+
    --path-prefix="../cpython-ro-srcdir/"
    8496
    - name: Remount sources writable for tests
    8597
    # some tests write to srcdir, lack of pyc files slows down testing
    8698
    run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1 @@
    1+
    Enable compiler options that warn of potential security vulnerabilities.

    Tools/build/.warningignore_macos

    Lines changed: 227 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -3,3 +3,230 @@
    33
    # Keep lines sorted lexicographically to help avoid merge conflicts.
    44
    # Format example:
    55
    # /path/to/file (number of warnings in file)
    6+
    Include/internal/mimalloc/mimalloc/internal.h 4
    7+
    Include/internal/pycore_backoff.h 1
    8+
    Include/internal/pycore_dict.h 2
    9+
    Include/internal/pycore_gc.h 1
    10+
    Include/internal/pycore_long.h 2
    11+
    Include/internal/pycore_object.h 4
    12+
    Modules/_asynciomodule.c 3
    13+
    Modules/_bisectmodule.c 2
    14+
    Modules/_bz2module.c 5
    15+
    Modules/_collectionsmodule.c 2
    16+
    Modules/_csv.c 3
    17+
    Modules/_ctypes/_ctypes.c 37
    18+
    Modules/_ctypes/_ctypes_test_generated.c.h 141
    19+
    Modules/_ctypes/callbacks.c 6
    20+
    Modules/_ctypes/callproc.c 15
    21+
    Modules/_ctypes/cfield.c 59
    22+
    Modules/_ctypes/malloc_closure.c 3
    23+
    Modules/_ctypes/stgdict.c 17
    24+
    Modules/_cursesmodule.c 24
    25+
    Modules/_datetimemodule.c 28
    26+
    Modules/_dbmmodule.c 8
    27+
    Modules/_decimal/_decimal.c 15
    28+
    Modules/_elementtree.c 42
    29+
    Modules/_functoolsmodule.c 6
    30+
    Modules/_gdbmmodule.c 5
    31+
    Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c 84
    32+
    Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c 84
    33+
    Modules/_hacl/include/krml/FStar_UInt_8_16_32_64.h 24
    34+
    Modules/_hashopenssl.c 16
    35+
    Modules/_interpchannelsmodule.c 1
    36+
    Modules/_interpqueuesmodule.c 1
    37+
    Modules/_io/_iomodule.c 1
    38+
    Modules/_io/bufferedio.c 4
    39+
    Modules/_io/bytesio.c 11
    40+
    Modules/_io/fileio.c 9
    41+
    Modules/_io/stringio.c 8
    42+
    Modules/_io/textio.c 11
    43+
    Modules/_json.c 19
    44+
    Modules/_localemodule.c 3
    45+
    Modules/_lzmamodule.c 10
    46+
    Modules/_multiprocessing/semaphore.c 2
    47+
    Modules/_operator.c 5
    48+
    Modules/_pickle.c 71
    49+
    Modules/_posixsubprocess.c 8
    50+
    Modules/_queuemodule.c 4
    51+
    Modules/_randommodule.c 3
    52+
    Modules/_scproxy.c 3
    53+
    Modules/_sqlite/connection.c 4
    54+
    Modules/_sqlite/cursor.c 3
    55+
    Modules/_sqlite/module.c 2
    56+
    Modules/_sre/sre.c 18
    57+
    Modules/_sre/sre_lib.h 62
    58+
    Modules/_ssl.c 29
    59+
    Modules/_struct.c 1
    60+
    Modules/_testbuffer.c 22
    61+
    Modules/_testcapi/heaptype.c 1
    62+
    Modules/_testcapi/long.c 2
    63+
    Modules/_testcapi/mem.c 2
    64+
    Modules/_testcapi/monitoring.c 3
    65+
    Modules/_testcapi/pyatomic.c 1
    66+
    Modules/_testcapi/unicode.c 2
    67+
    Modules/_testcapi/vectorcall.c 3
    68+
    Modules/_testcapi/watchers.c 3
    69+
    Modules/_testcapimodule.c 3
    70+
    Modules/_testclinic.c 14
    71+
    Modules/_testexternalinspection.c 8
    72+
    Modules/_testinternalcapi.c 8
    73+
    Modules/_testinternalcapi/pytime.c 8
    74+
    Modules/_testinternalcapi/test_critical_sections.c 1
    75+
    Modules/_testinternalcapi/test_lock.c 2
    76+
    Modules/_testlimitedcapi/heaptype_relative.c 4
    77+
    Modules/_testlimitedcapi/object.c 2
    78+
    Modules/_testlimitedcapi/unicode.c 2
    79+
    Modules/_threadmodule.c 2
    80+
    Modules/_tkinter.c 6
    81+
    Modules/_xxtestfuzz/_xxtestfuzz.c 1
    82+
    Modules/_xxtestfuzz/fuzzer.c 11
    83+
    Modules/_zoneinfo.c 14
    84+
    Modules/arraymodule.c 32
    85+
    Modules/atexitmodule.c 1
    86+
    Modules/binascii.c 206
    87+
    Modules/blake2module.c 6
    88+
    Modules/cjkcodecs/_codecs_cn.c 1
    89+
    Modules/cjkcodecs/_codecs_iso2022.c 2
    90+
    Modules/cjkcodecs/_codecs_jp.c 14
    91+
    Modules/cjkcodecs/_codecs_kr.c 3
    92+
    Modules/cjkcodecs/cjkcodecs.h 1
    93+
    Modules/cjkcodecs/multibytecodec.c 2
    94+
    Modules/clinic/_testclinic.c.h 1
    95+
    Modules/clinic/arraymodule.c.h 1
    96+
    Modules/clinic/unicodedata.c.h 10
    97+
    Modules/cmathmodule.c 1
    98+
    Modules/expat/siphash.h 8
    99+
    Modules/expat/xmlparse.c 45
    100+
    Modules/expat/xmltok.c 17
    101+
    Modules/expat/xmltok_impl.c 34
    102+
    Modules/faulthandler.c 3
    103+
    Modules/fcntlmodule.c 1
    104+
    Modules/getpath.c 7
    105+
    Modules/grpmodule.c 4
    106+
    Modules/itertoolsmodule.c 7
    107+
    Modules/main.c 2
    108+
    Modules/mathmodule.c 15
    109+
    Modules/mmapmodule.c 20
    110+
    Modules/posixmodule.c 67
    111+
    Modules/pwdmodule.c 4
    112+
    Modules/pyexpat.c 20
    113+
    Modules/readline.c 1
    114+
    Modules/resource.c 3
    115+
    Modules/rotatingtree.c 1
    116+
    Modules/selectmodule.c 6
    117+
    Modules/sha3module.c 4
    118+
    Modules/signalmodule.c 1
    119+
    Modules/socketmodule.c 44
    120+
    Modules/syslogmodule.c 3
    121+
    Modules/timemodule.c 4
    122+
    Modules/unicodedata.c 28
    123+
    Modules/unicodedata_db.h 1
    124+
    Modules/xxsubtype.c 2
    125+
    Modules/zlibmodule.c 16
    126+
    Objects/abstract.c 2
    127+
    Objects/bytearrayobject.c 34
    128+
    Objects/bytes_methods.c 9
    129+
    Objects/bytesobject.c 35
    130+
    Objects/call.c 13
    131+
    Objects/classobject.c 4
    132+
    Objects/codeobject.c 15
    133+
    Objects/descrobject.c 2
    134+
    Objects/dictobject.c 28
    135+
    Objects/fileobject.c 3
    136+
    Objects/floatobject.c 30
    137+
    Objects/frameobject.c 19
    138+
    Objects/funcobject.c 1
    139+
    Objects/genobject.c 5
    140+
    Objects/listobject.c 43
    141+
    Objects/longobject.c 46
    142+
    Objects/memoryobject.c 6
    143+
    Objects/methodobject.c 1
    144+
    Objects/mimalloc/alloc.c 6
    145+
    Objects/mimalloc/arena.c 6
    146+
    Objects/mimalloc/heap.c 1
    147+
    Objects/mimalloc/init.c 2
    148+
    Objects/mimalloc/options.c 1
    149+
    Objects/mimalloc/os.c 4
    150+
    Objects/mimalloc/page-queue.c 2
    151+
    Objects/mimalloc/page.c 1
    152+
    Objects/mimalloc/prim/osx/../unix/prim.c 2
    153+
    Objects/mimalloc/random.c 1
    154+
    Objects/mimalloc/segment.c 11
    155+
    Objects/mimalloc/stats.c 1
    156+
    Objects/moduleobject.c 2
    157+
    Objects/object.c 1
    158+
    Objects/obmalloc.c 6
    159+
    Objects/odictobject.c 3
    160+
    Objects/rangeobject.c 10
    161+
    Objects/setobject.c 13
    162+
    Objects/sliceobject.c 4
    163+
    Objects/stringlib/codecs.h 26
    164+
    Objects/stringlib/eq.h 1
    165+
    Objects/stringlib/fastsearch.h 14
    166+
    Objects/stringlib/join.h 1
    167+
    Objects/stringlib/replace.h 4
    168+
    Objects/stringlib/repr.h 21
    169+
    Objects/stringlib/transmogrify.h 5
    170+
    Objects/structseq.c 14
    171+
    Objects/tupleobject.c 10
    172+
    Objects/typeobject.c 17
    173+
    Objects/unicodectype.c 7
    174+
    Objects/unicodeobject.c 113
    175+
    Parser/action_helpers.c 4
    176+
    Parser/lexer/buffer.c 1
    177+
    Parser/lexer/lexer.c 12
    178+
    Parser/parser.c 116
    179+
    Parser/pegen.c 7
    180+
    Parser/string_parser.c 7
    181+
    Parser/tokenizer/file_tokenizer.c 8
    182+
    Parser/tokenizer/helpers.c 7
    183+
    Parser/tokenizer/readline_tokenizer.c 3
    184+
    Programs/_freeze_module.c 1
    185+
    Python/Python-ast.c 15
    186+
    Python/asdl.c 3
    187+
    Python/assemble.c 7
    188+
    Python/ast_opt.c 7
    189+
    Python/bltinmodule.c 9
    190+
    Python/bootstrap_hash.c 4
    191+
    Python/ceval.c 8
    192+
    Python/ceval_gil.c 2
    193+
    Python/codecs.c 32
    194+
    Python/codegen.c 6
    195+
    Python/compile.c 2
    196+
    Python/context.c 1
    197+
    Python/crossinterp.c 2
    198+
    Python/crossinterp_data_lookup.h 1
    199+
    Python/dtoa.c 34
    200+
    Python/errors.c 1
    201+
    Python/fileutils.c 7
    202+
    Python/flowgraph.c 8
    203+
    Python/formatter_unicode.c 7
    204+
    Python/frame.c 4
    205+
    Python/gc.c 8
    206+
    Python/generated_cases.c.h 35
    207+
    Python/getargs.c 11
    208+
    Python/import.c 5
    209+
    Python/initconfig.c 11
    210+
    Python/instrumentation.c 31
    211+
    Python/intrinsics.c 1
    212+
    Python/legacy_tracing.c 3
    213+
    Python/lock.c 4
    214+
    Python/marshal.c 11
    215+
    Python/modsupport.c 3
    216+
    Python/mystrtoul.c 4
    217+
    Python/pathconfig.c 1
    218+
    Python/preconfig.c 2
    219+
    Python/pyarena.c 1
    220+
    Python/pyhash.c 2
    221+
    Python/pylifecycle.c 7
    222+
    Python/pystate.c 6
    223+
    Python/pystrhex.c 19
    224+
    Python/pystrtod.c 3
    225+
    Python/qsbr.c 2
    226+
    Python/specialize.c 10
    227+
    Python/suggestions.c 12
    228+
    Python/symtable.c 18
    229+
    Python/sysmodule.c 2
    230+
    Python/thread_pthread.h 1
    231+
    Python/traceback.c 6
    232+
    Python/tracemalloc.c 6

    0 commit comments

    Comments
     (0)
    0