Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-112301: Enable warning emitting options and ignore warnings in CI #123020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
5148727
Create simple warning check tool and add to ubuntu build and test job
nohlson Jul 13, 2024
3bd5a10
Add flags to check warnings script to fail on regression or improvement
nohlson Jul 13, 2024
6813003
Remove redundant comment
nohlson Jul 13, 2024
ab4d754
Rename warnigore file to warningignore
nohlson Jul 13, 2024
615d228
Use regex to extract json arrays
nohlson Jul 13, 2024
fc0a60b
Trim whitespace
nohlson Jul 13, 2024
7793d80
Test on github unexpected improvement
nohlson Jul 13, 2024
99715d2
Add config for improve fail check
nohlson Jul 13, 2024
bc44ec2
Revert to prod check warning state
nohlson Jul 13, 2024
e2ca75f
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 13, 2024
bd1634e
Refactor creating set of files with warnings to a dedicated function
nohlson Jul 17, 2024
b07b1d6
Move cflags configure option to top level build configuration
nohlson Jul 23, 2024
e1954a5
Add json diagnostics to ubuntu configuration as first argument
nohlson Jul 23, 2024
5935143
Add newline to news
nohlson Jul 23, 2024
7f1a238
Create simple warning check tool and add to ubuntu build and test job
nohlson Jul 13, 2024
144136e
Add macos warning checks to GitHub actions
nohlson Jul 22, 2024
3dd40fd
Revert reusable-macos.yml for environment variables
nohlson Jul 22, 2024
1158f53
Update paths
nohlson Jul 22, 2024
cb51b4f
Test unexpected improvement
nohlson Jul 22, 2024
77e0f6e
Remove warning ignore
nohlson Jul 22, 2024
3e1d75f
Add json output option to macos configure job
nohlson Jul 22, 2024
b5cd58a
Add common dictionary format when parsing warnings
nohlson Jul 23, 2024
02f313e
Remove configure option for macos job
nohlson Jul 23, 2024
83d1ed7
Print out json version of compiler output
nohlson Jul 23, 2024
08a6f6d
Remove old version of warning ignore file
nohlson Jul 23, 2024
7be8ee6
Remove compiler output print diagnostic
nohlson Jul 24, 2024
8b0a2ee
📜🤖 Added by blurb_it.
blurb-it[bot] Jul 24, 2024
49cbd87
Remove superfluous comment
nohlson Jul 24, 2024
522f27c
oMerge branch 'main' into add-macos-warnings-tracking-tooling
nohlson Jul 30, 2024
b654a84
Add period to news
nohlson Jul 30, 2024
7780da6
Merge branch 'main' into add-macos-warnings-tracking-tooling
nohlson Jul 31, 2024
3688c5c
Make warning ignore file optional
nohlson Jul 31, 2024
cb1f276
Add write compiler output to log and file
nohlson Jul 31, 2024
fb91e3e
Fix formatting and update regex
nohlson Jul 31, 2024
f35ba60
Fix comment formatting
nohlson Aug 5, 2024
294dd61
Add warning count to check warnigns tooling
nohlson Aug 5, 2024
4056985
Remove duplicate warnings from check warning tooling
nohlson Aug 5, 2024
dad672b
Merge branch 'main' into add-warning-count-to-warning-ignore-files
nohlson Aug 5, 2024
4164b81
Trim trailing whitespace
nohlson Aug 6, 2024
8b07ae8
📜🤖 Added by blurb_it.
blurb-it[bot] Aug 6, 2024
17858b9
Reformat news
nohlson Aug 6, 2024
f483e04
Merge branch 'main' into add-warning-count-to-warning-ignore-files
nohlson Aug 6, 2024
55e20bd
Update helpers for function argument types
nohlson Aug 6, 2024
566e8cd
Format line length
nohlson Aug 6, 2024
b00cc51
Add new warnings
nohlson Aug 12, 2024
f8ae75e
Use named tuple for warning filename and count
nohlson Aug 12, 2024
f68eb71
Add more warnings
nohlson Aug 12, 2024
39223dc
Merge branch 'add-warning-count-to-warning-ignore-files' into add-war…
nohlson Aug 12, 2024
cbf069b
Use proper type
nohlson Aug 12, 2024
a04cad8
Merge branch 'add-warning-count-to-warning-ignore-files' into add-war…
nohlson Aug 12, 2024
e8ef3e3
Add path prefix argument to check warnings script
nohlson Aug 13, 2024
ba6486f
Add path prefix to check warning script call
nohlson Aug 13, 2024
034552f
Fix spelling
nohlson Aug 13, 2024
9b724b3
Add condition to check MSI files only on PR
nohlson Aug 13, 2024
ab8f099
Add warnings to ubuntu ignore list
nohlson Aug 13, 2024
6296a46
Remove warning ignore files
nohlson Aug 13, 2024
19df803
Add files to ignore warnings
nohlson Aug 13, 2024
4081a96
Add files to ignore
nohlson Aug 13, 2024
26b40d3
Update function signatures and make files with expected warnings list…
nohlson Aug 13, 2024
78b90be
Remove warnigns to ignore
nohlson Aug 13, 2024
c5a983b
Add warnings to ignore
nohlson Aug 13, 2024
e8b57dc
Remove debug traces
nohlson Aug 13, 2024
3051648
Add debug outputs
nohlson Aug 13, 2024
d351928
Remove warning ignore files
nohlson Aug 13, 2024
ef9ac02
Merge branch 'add-warning-count-to-warning-ignore-files' into add-war…
nohlson Aug 13, 2024
69f37ea
Make warning check only run on non-free-threading jobs
nohlson Aug 13, 2024
74164c5
Add option parsing for clang
nohlson Aug 14, 2024
fd4620d
Revert reusable change detection
nohlson Aug 14, 2024
207a664
Remove debug prints
nohlson Aug 14, 2024
a0f8fd5
Merge branch 'main' into add-warning-options-and-include-in-check-war…
nohlson Aug 14, 2024
f11ec0d
Fail macos on regression and improvement
nohlson Aug 14, 2024
ae74ee4
Re-add fix for running workflow manually
nohlson Aug 14, 2024
50f43bc
Add back in warning by file processing
nohlson Aug 14, 2024
008a2f9
Build cpython single process
nohlson Aug 14, 2024
caf6b1a
Add ignore files for macos
nohlson Aug 14, 2024
8eb8a51
Use path prefix for clang parsing
nohlson Aug 14, 2024
dc6ba2f
Add debug prints
nohlson Aug 14, 2024
e31f6d1
Specify unique compiler output files for different jobs
nohlson Aug 14, 2024
ef982eb
Only run check warnings when necessary
nohlson Aug 14, 2024
13ac922
Move check warning decision to reusable macos
nohlson Aug 14, 2024
da7bbde
Revert to old regex
nohlson Aug 14, 2024
7c7c78c
Tweak warning ignore for ubuntu and revert regex
nohlson Aug 14, 2024
46ee5d5
Add pegen warning ignore
nohlson Aug 14, 2024
c4371af
Remove debug printing
nohlson Aug 14, 2024
ff9eb6a
Sort warning ignore file lexicographically
nohlson Aug 14, 2024
b747bb0
Format line length for check warnings script
nohlson Aug 14, 2024
d0ea15e
Merge branch 'main' into add-warning-options-and-include-in-check-war…
nohlson Aug 14, 2024
423300a
Clarify argument help for path prefix
nohlson Aug 14, 2024
efe6167
Remove format 2
nohlson Aug 14, 2024
2a04a08
Add file overview for unexpected warnings and unexpected improvements
nohlson Aug 14, 2024
c5a156a
Remove warning ignores associated with format 2 option
nohlson Aug 14, 2024
2c54b6a
Move arguments to newline
nohlson Aug 14, 2024
cfe2097
📜🤖 Added by blurb_it.
blurb-it[bot] Aug 14, 2024
460131c
Merge branch 'main' into add-warning-options-and-include-in-check-war…
nohlson Aug 15, 2024
e9a2d71
Update .github/workflows/reusable-macos.yml
nohlson Aug 15, 2024
a88ebbb
Update Tools/build/check_warnings.py
nohlson Aug 15, 2024
d8b43a6
Update Tools/build/check_warnings.py
nohlson Aug 15, 2024
97c0103
Update Tools/build/check_warnings.py
nohlson Aug 15, 2024
dd532ed
Revert to 8 thread build for macos job
nohlson Aug 15, 2024
20b2e12
Up macos build thread count to 8
nohlson Aug 15, 2024
363e254
Run macos14 for non-forks
nohlson Aug 15, 2024
be4b6ba
Use gmake
nohlson Aug 15, 2024
111010f
Add make to homebrew dependency install
nohlson Aug 15, 2024
87368fb
Use output sync option when building for warning check
nohlson Aug 15, 2024
e491f04
Switch macos warning check to non-threaded macos-13
nohlson Aug 15, 2024
edd0897
Update reusable-macos.yml
nohlson Aug 15, 2024
8abbd9b
Use remove prefix instead of lstrip
nohlson Aug 20, 2024
f4a5d98
Revert build order
nohlson Aug 20, 2024
25ffe61
Reorder steps in ubuntu job and add warnings to ignore
nohlson Aug 20, 2024
aaa9007
Merge branch 'main' into add-warning-options-and-include-in-check-war…
nohlson Aug 20, 2024
410ea1d
Add link to devguide for help with check warning tool
nohlson Aug 26, 2024
2e666c2
Remove conversion warning
nohlson Aug 27, 2024
e5d0bee
Update macos warning ignore
nohlson Aug 27, 2024
b2cfe15
Reintroduce -Wconversion
nohlson Aug 28, 2024
3e331ea
Merge branch 'main' into add-warning-options-and-include-in-check-war…
nohlson Aug 28, 2024
98851b6
Change gcc compiler output parsing to not use json
nohlson Aug 29, 2024
51c39df
Update ubuntu workflow to not output json
nohlson Aug 29, 2024
3e3b81c
Update ubuntu warning ignore list for regular GCC compiler output
nohlson Aug 29, 2024
db5d6bb
Remove leading space from macos warning ignore file
nohlson Aug 29, 2024
b82355f
Merge branch 'main' into add-warning-options-and-include-in-check-war…
nohlson Sep 10, 2024
bf90af1
Update warning ignore files for new warnings from main
nohlson Sep 11, 2024
9701292
Remove zero count files from warning ignore
nohlson Sep 11, 2024
0cd2731
Remove redundant line in warningignore
nohlson Sep 11, 2024
71b0617
Merge branch 'main' into add-warning-options-and-include-in-check-war…
hugovk Sep 13, 2024
51782d5
Update warning ignore files for new warnings from main
hugovk Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/reusable-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] xz gdbm tcl-tk
run: brew install pkg-config [email protected] xz gdbm tcl-tk make
- name: Configure CPython
run: |
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
Expand All @@ -48,10 +48,22 @@ jobs:
--prefix=/opt/python-dev \
--with-openssl="$(brew --prefix [email protected])"
- name: Build CPython
run: set -o pipefail; make -j8 2>&1 | tee compiler_output.txt
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
- name: Display build info
run: make pythoninfo
- name: Check compiler warnings
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
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="./"
- name: Tests
run: make test
18 changes: 15 additions & 3 deletions .github/workflows/reusable-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,32 @@ 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: set -o pipefail; make -j4 2>&1 | tee compiler_output.txt
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
- name: Display build info
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make pythoninfo
- name: Check compiler warnings
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
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/"
- 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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable compiler options that warn of potential security vulnerabilities.
sethmlarson marked this conversation as resolved.
Show resolved Hide resolved
227 changes: 227 additions & 0 deletions Tools/build/.warningignore_macos
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,230 @@
# 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
Loading
Loading