Issue 36527: unused parameter warnings in Include/object.h (affecting building third party code)
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.