classification
Title: Fix some compiler warnings
Type: compile error Stage: resolved
Components: Build Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel, lukasz.langa, methane, miss-islington, samuelmarks, vstinner
Priority: normal Keywords: patch

Created on 2020-09-20 06:10 by samuelmarks, last changed 2020-10-21 08:55 by methane. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22329 closed samuelmarks, 2020-09-20 06:10
PR 22332 merged samuelmarks, 2020-09-21 02:01
PR 22334 merged miss-islington, 2020-09-21 08:35
PR 22335 merged miss-islington, 2020-09-21 08:35
Messages (8)
msg377205 - (view) Author: Samuel Marks (samuelmarks) * Date: 2020-09-20 06:10
https://github.com/SamuelMarks/cpython/tree/3.9-compiler-fixes
msg377226 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-09-20 18:31
Can you give more details about what you're fixing: what were the compiler warnings, which compiler (and which version of the compiler), which system?

Also, why did you create the PR against the 3.9 branch rather than master?
msg377239 - (view) Author: Samuel Marks (samuelmarks) * Date: 2020-09-21 02:02
Okay I'll redo it on master, here is my config, on macOS 10.15.6:
```
$ export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
$ export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
$ export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include $CPPFLAGS"
$ export LDFLAGS="-L/usr/local/opt/zlib/lib $LDFLAGS"
$ gcc --version && clang --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ ./configure --enable-optimizations --prefix /opt/python3-master
$ ./configure --enable-optimizations --prefix /opt/python3-master
checking for git... found
checking build system type... x86_64-apple-darwin19.6.0
checking host system type... x86_64-apple-darwin19.6.0
checking for python3.10... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
[… omitted for brevity]
$ make
```

With these warnings being addressed by this bug report and PR:
```
gcc -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal  -I. -I./Include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@1.1/include  -DPy_BUILD_CORE \
		-DPLATLIBDIR='"lib"' \
		-o Python/initconfig.o ./Python/initconfig.c
./Python/initconfig.c:2677:38: warning: format specifies type 'wint_t' (aka 'int') but the argument has type 'unsigned int' [-Wformat]
            PySys_WriteStderr("%lc", ch);
                               ~~~   ^~
                               %c
1 warning generated.
```

Looks like someone else has already picked up the other bug. So opened a new PR for this.
msg377243 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-21 08:35
New changeset c322948892438a387d752ec18d1eb512699a4d67 by Samuel Marks in branch 'master':
bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)
https://github.com/python/cpython/commit/c322948892438a387d752ec18d1eb512699a4d67
msg377244 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-21 08:43
> ./Python/initconfig.c:2677:38: warning: format specifies type 'wint_t' (...)

Is there the only warning that you want to fix? Can we close the issue? Or are there other remaining warnings?
msg377246 - (view) Author: miss-islington (miss-islington) Date: 2020-09-21 08:58
New changeset 7aa534c9567201d896408bc7d5a718b529868540 by Miss Islington (bot) in branch '3.9':
bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)
https://github.com/python/cpython/commit/7aa534c9567201d896408bc7d5a718b529868540
msg378055 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2020-10-05 16:10
New changeset c549527ae2cc4b5934dbe80fea127fb04ff65af5 by Łukasz Langa (Miss Islington (bot)) in branch '3.9':
bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)
https://github.com/python/cpython/commit/c549527ae2cc4b5934dbe80fea127fb04ff65af5
msg379201 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-10-21 08:55
New changeset c756c2b507b088919ac0c1aa8b0d8c8bdbdd75ee by Miss Skeleton (bot) in branch '3.8':
bpo-41819: Fix compiler warning in init_dump_ascii_wstr() (GH-22332)
https://github.com/python/cpython/commit/c756c2b507b088919ac0c1aa8b0d8c8bdbdd75ee
History
Date User Action Args
2020-10-21 08:55:59methanesetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.8
2020-10-21 08:55:42methanesetnosy: + methane
messages: + msg379201
2020-10-05 16:10:20lukasz.langasetnosy: + lukasz.langa
messages: + msg378055
2020-09-21 08:58:55miss-islingtonsetmessages: + msg377246
2020-09-21 08:43:13vstinnersetmessages: + msg377244
2020-09-21 08:35:56miss-islingtonsetpull_requests: + pull_request21380
2020-09-21 08:35:47miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21379
2020-09-21 08:35:33vstinnersetmessages: + msg377243
2020-09-21 06:15:59serhiy.storchakasetnosy: + vstinner
2020-09-21 02:02:26samuelmarkssetmessages: + msg377239
2020-09-21 02:01:46samuelmarkssetkeywords: + patch
stage: patch review
pull_requests: + pull_request21376
2020-09-20 18:31:54iritkatrielsetnosy: + iritkatriel
messages: + msg377226
2020-09-20 06:10:02samuelmarkscreate