pycapnp icon indicating copy to clipboard operation
pycapnp copied to clipboard

Get rid of deprecation warnings

Open thedrow opened this issue 10 years ago • 4 comments

It seems that pycapnp is using deprecated methods according to the build logs. We should replace their usage with their up to date alternatives.

thedrow avatar Feb 02 '15 05:02 thedrow

Are you talking about the C++ deprecation warnings? It's definitely on my todo list, but thanks for adding an issue to track it/remind me

jparyani avatar Feb 02 '15 05:02 jparyani

Yes, exactly.

thedrow avatar Feb 02 '15 06:02 thedrow

I've been working on this. Most of them have been removed but some still remain.

Linux

building 'capnp.lib.capnp' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/capnp
creating build/temp.linux-x86_64-3.7/capnp/lib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I. -I/opt/hostedtoolcache/Python/3.7.5/x64/include/python3.7m -Ibuild64/include -c capnp/lib/capnp.cpp -o build/temp.linux-x86_64-3.7/capnp/lib/capnp.o --std=c++14
capnp/lib/capnp.cpp: In function ‘PyObject* __pyx_f_5capnp_3lib_5capnp_12SchemaParser__parse_disk_file(__pyx_obj_5capnp_3lib_5capnp_SchemaParser*, PyObject*, PyObject*, PyObject*, int)’:
capnp/lib/capnp.cpp:72239:209: warning: ‘capnp::ParsedSchema capnp::SchemaParser::parseDiskFile(kj::StringPtr, kj::StringPtr, kj::ArrayPtr<const kj::StringPtr>) const’ is deprecated [-Wdeprecated-declarations]
   __pyx_t_1 = ((struct __pyx_vtabstruct_5capnp_3lib_5capnp__ParsedSchema *)__pyx_v_ret->__pyx_base.__pyx_vtab)->_init_child(__pyx_v_ret, __pyx_v_self->thisptr->parseDiskFile(__pyx_t_12, __pyx_t_15, __pyx_t_16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3131, __pyx_L1_error)
                                                                                                                                                                                                                 ^
In file included from capnp/lib/capnp.cpp:677:0:
build64/include/capnp/schema-parser.h:103:16: note: declared here
   ParsedSchema parseDiskFile(kj::StringPtr displayName, kj::StringPtr diskPath,
                ^~~~~~~~~~~~~
g++ -pthread -shared -Wl,--rpath=/opt/hostedtoolcache/Python/3.7.5/x64/lib -Wl,--rpath=/opt/hostedtoolcache/Python/3.7.5/x64/lib build/temp.linux-x86_64-3.7/capnp/lib/capnp.o -L/opt/hostedtoolcache/Python/3.7.5/x64/lib -Lbuild64/lib -lcapnpc -lcapnp-rpc -lcapnp -lkj-async -lkj -lpython3.7m -o build/lib.linux-x86_64-3.7/capnp/lib/capnp.cpython-37m-x86_64-linux-gnu.so
Processing /home/runner/work/pycapnp/pycapnp

macOS

creating build/temp.macosx-10.13-x86_64-3.7/capnp/lib
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I. -I/Users/runner/hostedtoolcache/Python/3.7.5/x64/include/python3.7m -Ibuild64/include -c capnp/lib/capnp.cpp -o build/temp.macosx-10.13-x86_64-3.7/capnp/lib/capnp.o --std=c++14
capnp/lib/capnp.cpp:46895:3: warning: code will never be executed [-Wunreachable-code]
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  ^~~~~~~~~~~~~~~~~~~~~~~
capnp/lib/capnp.cpp:55495:3: warning: code will never be executed [-Wunreachable-code]
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  ^~~~~~~~~~~~~~~~~~~~~~~
capnp/lib/capnp.cpp:57769:3: warning: code will never be executed [-Wunreachable-code]
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  ^~~~~~~~~~~~~~~~~~~~~~~
capnp/lib/capnp.cpp:58700:3: warning: code will never be executed [-Wunreachable-code]
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  ^~~~~~~~~~~~~~~~~~~~~~~
capnp/lib/capnp.cpp:72239:161: warning: 'parseDiskFile' is deprecated: Use parseFromDirectory() instead. [-Wdeprecated-declarations]
  __pyx_t_1 = ((struct __pyx_vtabstruct_5capnp_3lib_5capnp__ParsedSchema *)__pyx_v_ret->__pyx_base.__pyx_vtab)->_init_child(__pyx_v_ret, __pyx_v_self->thisptr->parseDiskFile(__pyx_t_12, __pyx_t_15, __pyx_t_16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3131, __pyx_L1_error)
                                                                                                                                                                ^
build64/include/capnp/common.h:57:26: note: expanded from macro 'CAPNP_DEPRECATED'
#define CAPNP_DEPRECATED KJ_DEPRECATED
                         ^
build64/include/kj/common.h:186:20: note: expanded from macro 'KJ_DEPRECATED'
    __attribute__((deprecated(reason)))
                   ^
capnp/lib/capnp.cpp:334:5: warning: destructor called on non-final 'ErrorHandler' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
    x.~T();
    ^
capnp/lib/capnp.cpp:96529:3: note: in instantiation of function template specialization '__Pyx_call_destructor<ErrorHandler>' requested here
  __Pyx_call_destructor(p->_error_handler);
  ^
capnp/lib/capnp.cpp:334:8: note: qualify call to silence this warning
    x.~T();
       ^
       ErrorHandler::
6 warnings generated.
g++ -bundle -undefined dynamic_lookup build/temp.macosx-10.13-x86_64-3.7/capnp/lib/capnp.o -Lbuild64/lib -lcapnpc -lcapnp-rpc -lcapnp -lkj-async -lkj -o build/lib.macosx-10.13-x86_64-3.7/capnp/lib/capnp.cpython-37m-darwin.so

Windows

2019-12-12T07:11:47.0212180Z creating build\temp.win-amd64-3.7\Release\capnp\lib
2019-12-12T07:11:47.0214118Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I. -IC:\hostedtoolcache\windows\Python\3.7.5\x64\include -IC:\hostedtoolcache\windows\Python\3.7.5\x64\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -Ibuild64\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tpcapnp/lib\capnp.cpp /Fobuild\temp.win-amd64-3.7\Release\capnp/lib\capnp.obj /std:c++14 /MD
2019-12-12T07:11:47.0285903Z capnp.cpp
2019-12-12T07:11:47.8205112Z D:\a\pycapnp\pycapnp\build64\include\capnp\common.h(718): warning C4244: 'initializing': conversion from 'unsigned __int64' to 'const capnp::uint', possible loss of data
2019-12-12T07:11:47.9108160Z D:\a\pycapnp\pycapnp\build64\include\capnp\layout.h(595): warning C4267: 'initializing': conversion from 'size_t' to 'capnp::StructDataBitCount', possible loss of data
2019-12-12T07:11:48.7084891Z D:\a\pycapnp\pycapnp\build64\include\capnp\rpc.h(458): warning C4068: unknown pragma
2019-12-12T07:11:48.7085245Z D:\a\pycapnp\pycapnp\build64\include\capnp\rpc.h(459): warning C4068: unknown pragma
2019-12-12T07:11:48.7085831Z D:\a\pycapnp\pycapnp\build64\include\capnp\rpc.h(461): warning C4068: unknown pragma
2019-12-12T07:11:49.0654238Z capnp/lib\capnp.cpp(12403): warning C4244: 'argument': conversion from 'int64_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.0991187Z capnp/lib\capnp.cpp(14891): warning C4244: 'argument': conversion from 'int64_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.1918023Z capnp/lib\capnp.cpp(18789): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.1923712Z capnp/lib\capnp.cpp(18843): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.2100525Z capnp/lib\capnp.cpp(19678): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.2106692Z capnp/lib\capnp.cpp(19732): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.2302113Z capnp/lib\capnp.cpp(20577): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:49.2477746Z capnp/lib\capnp.cpp(21414): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'capnp::uint', possible loss of data
2019-12-12T07:11:50.8415876Z build64\include\kj/hash.h(98): warning C4244: 'return': conversion from 'unsigned __int64' to 'kj::uint', possible loss of data
2019-12-12T07:11:50.8419110Z build64\include\kj/hash.h(130): note: see reference to function template instantiation 'kj::uint kj::_::HashCoder::operator *<const capnp::_::RawBrandedSchema>(T *) const' being compiled
2019-12-12T07:11:50.8419536Z         with
2019-12-12T07:11:50.8419933Z         [
2019-12-12T07:11:50.8420330Z             T=const capnp::_::RawBrandedSchema
2019-12-12T07:11:50.8420667Z         ]
2019-12-12T07:11:50.8420950Z D:\a\pycapnp\pycapnp\build64\include\capnp\schema.h(133): note: see reference to function template instantiation 'kj::uint kj::hashCode<const capnp::_::RawBrandedSchema*const &>(T)' being compiled
2019-12-12T07:11:50.8421198Z         with
2019-12-12T07:11:50.8421408Z         [
2019-12-12T07:11:50.8421635Z             T=const capnp::_::RawBrandedSchema *const &
2019-12-12T07:11:50.8421838Z         ]
2019-12-12T07:11:50.8723191Z build64\include\kj/hash.h(156): warning C4267: 'initializing': conversion from 'size_t' to 'kj::uint', possible loss of data
2019-12-12T07:11:50.8724244Z build64\include\kj/hash.h(130): note: see reference to function template instantiation 'kj::uint kj::_::HashCoder::operator *<const T,kj::uint>(kj::ArrayPtr<const T>) const' being compiled
2019-12-12T07:11:50.8724489Z         with
2019-12-12T07:11:50.8725106Z         [
2019-12-12T07:11:50.8725284Z             T=kj::String
2019-12-12T07:11:50.8725445Z         ]
2019-12-12T07:11:50.8725951Z build64\include\kj/filesystem.h(1029): note: see reference to function template instantiation 'kj::uint kj::hashCode<const kj::ArrayPtr<const T>&>(const kj::ArrayPtr<const T>&)' being compiled
2019-12-12T07:11:50.8726231Z         with
2019-12-12T07:11:50.8726447Z         [
2019-12-12T07:11:50.8726682Z             T=kj::String
2019-12-12T07:11:50.8726987Z         ]
2019-12-12T07:11:50.8727275Z D:\a\pycapnp\pycapnp\build64\include\kj\time.h(59): note: see reference to class template instantiation 'kj::Absolute<kj::Duration,kj::_::DateLabel>' being compiled
2019-12-12T07:11:50.8727581Z D:\a\pycapnp\pycapnp\build64\include\kj\time.h(44): note: see reference to class template instantiation 'kj::Quantity<int64_t,kj::_::NanosecondLabel>' being compiled
2019-12-12T07:11:51.5034804Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\hostedtoolcache\windows\Python\3.7.5\x64\libs /LIBPATH:C:\hostedtoolcache\windows\Python\3.7.5\x64\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" /LIBPATH:build64\lib "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.23.28105\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64" capnpc.lib capnp-rpc.lib capnp.lib kj-async.lib kj.lib /EXPORT:PyInit_capnp build\temp.win-amd64-3.7\Release\capnp/lib\capnp.obj /OUT:build\lib.win-amd64-3.7\capnp\lib\capnp.cp37-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.7\Release\capnp/lib\capnp.cp37-win_amd64.lib /MANIFEST
2019-12-12T07:11:52.3548118Z    Creating library build\temp.win-amd64-3.7\Release\capnp/lib\capnp.cp37-win_amd64.lib and object build\temp.win-amd64-3.7\Release\capnp/lib\capnp.cp37-win_amd64.exp
2019-12-12T07:11:52.3878914Z Generating code
2019-12-12T07:12:17.0773714Z Finished generating code
2019-12-12T07:12:18.5133673Z Processing d:\a\pycapnp\pycapnp

haata avatar Dec 12 '19 08:12 haata

There are now a bunch of tp_print warnings on Python 3.8, caused by https://github.com/cython/cython/issues/3474 . Seems there is no much which can be done about that.

The first mac unreachable CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); is in _RemotePromise.a_wait , and it appears to be unfixable, and caused by Cython.

When I building using Cython 3.0a6, I get the following warning from Cython.

warning: capnp/includes/capnp_cpp.pxd:356:18: Rvalue-reference as function argument not supported

That line originates from 1df115d359 by @jparyani

RpcSystem(RpcSystem&&)

But the tests all seem to pass.

There is also a lot of the following compiler warning

capnp/lib/capnp.cpp:21799:59: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
  __pyx_t_2 = __pyx_f_5capnp_3lib_5capnp_to_python_reader(__PYX_STD_MOVE_IF_SUPPORTED((( ::capnp::DynamicValue::Reader)__pyx_t_7)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
                                                          ^
capnp/lib/capnp.cpp:4250:42: note: expanded from macro '__PYX_STD_MOVE_IF_SUPPORTED'
  #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
                                         ^

jayvdb avatar May 03 '21 02:05 jayvdb