Skip to content

Fixed compilation warnings#7050

Merged
mergify[bot] merged 3 commits intopython-pillow:mainfrom
radarhere:warning
Mar 31, 2023
Merged

Fixed compilation warnings#7050
mergify[bot] merged 3 commits intopython-pillow:mainfrom
radarhere:warning

Conversation

@radarhere
Copy link
Member

https://github.com/python-pillow/Pillow/actions/runs/4571913703/jobs/8070643875#step:7:66

src/_imaging.c: In function ‘getink’:
src/_imaging.c:555:44: warning: ‘tupleSize’ may be used uninitialized in this function [-Wmaybe-uninitialized]
555 | if (tupleSize != 1 && tupleSize != 2) {
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

This variable was added in #7010.

@radarhere
Copy link
Member Author

radarhere commented Mar 31, 2023

Compiling on my macOS machine, I see

src/libImaging/Quant.c:344:17: warning: variable 'nLeft' set but not used [-Wunused-but-set-variable]
int nRight, nLeft;
^
1 warning generated.

This is because nLeft is only used if NO_OUTPUT is defined. I've added a commit to also only set nLeft if NO_OUTPUT is defined.

@radarhere radarhere changed the title Fix warning that variable may be uninitialized Fixed compilation warnings Mar 31, 2023
@hugovk hugovk added automerge Automatically merge PRs that are ready Cleanup labels Mar 31, 2023
@mergify mergify bot merged commit b441916 into python-pillow:main Mar 31, 2023
@radarhere radarhere deleted the warning branch March 31, 2023 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge PRs that are ready Cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants