This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unused parameter warnings in Include/object.h (affecting building third party code)
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: AMDmi3, methane
Priority: normal Keywords: patch

Created on 2019-04-04 16:08 by AMDmi3, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12688 merged python-dev, 2019-04-04 16:15
Messages (2)
msg339452 - (view) Author: Dmitry Marakasov (AMDmi3) * Date: 2019-04-04 16:08
Python 3.8 and nightly introduces unused (in some cases) parameters in object.h header. This makes compilation of third party code which includes the header fail if it's built with -Werror.

Build log excerpt:

---
g++ -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -UNDEBUG -Wall -Wextra -Werror -fPIC -I/usr/include/yajl -I/opt/python/3.8-dev/include/python3.8m -c src/construct_handlers.cc -o build/temp.linux-x86_64-3.8/src/construct_handlers.o -std=c++11 -DJSONSLICER_VERSION="0.1.4" -DUSE_BYTES_INTERNALLY -fno-exceptions -fno-rtti
In file included from /opt/python/3.8-dev/include/python3.8m/pytime.h:6:0,
                 from /opt/python/3.8-dev/include/python3.8m/Python.h:85,
                 from src/pyobjlist.hh:26,
                 from src/jsonslicer.hh:26,
                 from src/construct_handlers.hh:26,
                 from src/construct_handlers.cc:23:
/opt/python/3.8-dev/include/python3.8m/object.h:441:50: error: unused parameter ‘op’ [-Werror=unused-parameter]
 static inline void _Py_ForgetReference(PyObject *op)
                                                  ^
/opt/python/3.8-dev/include/python3.8m/object.h:458:43: error: unused parameter ‘filename’ [-Werror=unused-parameter]
 static inline void _Py_DECREF(const char *filename, int lineno,
                                           ^
/opt/python/3.8-dev/include/python3.8m/object.h:458:57: error: unused parameter ‘lineno’ [-Werror=unused-parameter]
 static inline void _Py_DECREF(const char *filename, int lineno,
                                                         ^
---

Full build log:

https://travis-ci.org/AMDmi3/jsonslicer/jobs/515771366

Possible solutions:
- Add (void)param; to silence the warning as it's already done in Include/internal/pycore_atomic.h
- Make distutils list python include directory with -isystem instead of -I. This way, python include won't generate warnings for third party code.
msg339531 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-04-06 09:04
New changeset a0da131a74acdb147ecd64d729c86d65fecd0cff by Inada Naoki (Dmitry Marakasov) in branch 'master':
bpo-36527: silence -Wunused-parameter warnings in object.h (GH-12688)
https://github.com/python/cpython/commit/a0da131a74acdb147ecd64d729c86d65fecd0cff
History
Date User Action Args
2022-04-11 14:59:13adminsetgithub: 80708
2019-04-07 01:22:39methanesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-04-06 09:04:51methanesetnosy: + methane
messages: + msg339531
2019-04-04 16:15:00python-devsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12615
2019-04-04 16:08:41AMDmi3create