msghub
msghub copied to clipboard
Fix compilation warnings
There are many warnings (with -Wall -Wextra -pedantic). Some of these are already bugs (leading to immediate segfaults), some of them simply invite bugs. Others may prevent correct compilation on standard conforming compilers.
|| [ 14%] Building CXX object CMakeFiles/client.dir/msghub/src/hubclient.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubclient.h:6,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| [ 21%] Building CXX object CMakeFiles/client.dir/msghub/src/hubconnection.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h:5,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.cpp:1:
|| /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h: In constructor ‘hubconnection::hubconnection(boost::asio::io_service&, hub&)’:
msghub/src/hubconnection.h|45 col 18| warning: ‘hubconnection::socket_’ will be initialized after [-Wreorder]
|| 45 | tcp::socket socket_;
|| | ^~~~~~~
msghub/src/hubconnection.h|43 col 12| warning: ‘hub& hubconnection::courier_’ [-Wreorder]
|| 43 | hub& courier_;
|| | ^~~~~~~~
msghub/src/hubconnection.cpp|24 col 1| warning: when initialized here [-Wreorder]
|| 24 | hubconnection::hubconnection(boost::asio::io_service& io_service, hub& courier)
|| | ^~~~~~~~~~~~~
|| [ 28%] Building CXX object CMakeFiles/client.dir/msghub/src/hubmessage.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubmessage.cpp:1:
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| [ 35%] Building CXX object CMakeFiles/client.dir/msghub/src/msghub.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h:5,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| [ 42%] Building CXX object CMakeFiles/client.dir/msghub/src/msghub_impl.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h:5,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp:1:
|| /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.h: In constructor ‘msghub_impl::msghub_impl(boost::asio::io_service&)’:
msghub/src/msghub_impl.h|47 col 35| warning: ‘msghub_impl::publisher_’ will be initialized after [-Wreorder]
|| 47 | boost::shared_ptr<hubconnection> publisher_;
|| | ^~~~~~~~~~
msghub/src/msghub_impl.h|45 col 16| warning: ‘boost::asio::ip::tcp::acceptor msghub_impl::acceptor_’ [-Wreorder]
|| 45 | tcp::acceptor acceptor_;
|| | ^~~~~~~~~
msghub/src/msghub_impl.cpp|46 col 1| warning: when initialized here [-Wreorder]
|| 46 | msghub_impl::msghub_impl(boost::asio::io_service& io_service)
|| | ^~~~~~~~~~~
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp:1:
msghub/src/msghub_impl.h|45 col 16| warning: ‘msghub_impl::acceptor_’ will be initialized after [-Wreorder]
|| 45 | tcp::acceptor acceptor_;
|| | ^~~~~~~~~
msghub/src/msghub_impl.h|44 col 27| warning: ‘boost::asio::io_service& msghub_impl::io_service_’ [-Wreorder]
|| 44 | boost::asio::io_service& io_service_;
|| | ^~~~~~~~~~~
msghub/src/msghub_impl.cpp|46 col 1| warning: when initialized here [-Wreorder]
|| 46 | msghub_impl::msghub_impl(boost::asio::io_service& io_service)
|| | ^~~~~~~~~~~
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp:1:
msghub/src/msghub_impl.h|44 col 27| warning: ‘msghub_impl::io_service_’ will be initialized after [-Wreorder]
|| 44 | boost::asio::io_service& io_service_;
|| | ^~~~~~~~~~~
msghub/src/msghub_impl.h|42 col 8| warning: ‘bool msghub_impl::initok_’ [-Wreorder]
|| 42 | bool initok_;
|| | ^~~~~~~
msghub/src/msghub_impl.cpp|46 col 1| warning: when initialized here [-Wreorder]
|| 46 | msghub_impl::msghub_impl(boost::asio::io_service& io_service)
|| | ^~~~~~~~~~~
|| /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp: In member function ‘virtual void msghub_impl::deliver(boost::shared_ptr<hubconnection>, hubmessage&)’:
msghub/src/msghub_impl.cpp|203 col 60| warning: unused parameter ‘publisher’ [-Wunused-parameter]
|| 203 | void msghub_impl::deliver(boost::shared_ptr<hubconnection> publisher, hubmessage& msg)
|| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
|| /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp: In member function ‘void msghub_impl::handle_accept(boost::shared_ptr<hubclient>, const boost::system::error_code&)’:
msghub/src/msghub_impl.cpp|233 col 7| warning: unused variable ‘e’ [-Wunused-variable]
|| 233 | int e = error.value();
|| | ^
|| [ 50%] Linking CXX executable client
|| [ 50%] Built target client
|| [ 57%] Building CXX object CMakeFiles/server.dir/test.cpp.o
|| [ 64%] Building CXX object CMakeFiles/server.dir/msghub/src/hubclient.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubclient.h:6,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| [ 71%] Building CXX object CMakeFiles/server.dir/msghub/src/hubconnection.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h:5,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.cpp:1:
|| /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h: In constructor ‘hubconnection::hubconnection(boost::asio::io_service&, hub&)’:
msghub/src/hubconnection.h|45 col 18| warning: ‘hubconnection::socket_’ will be initialized after [-Wreorder]
|| 45 | tcp::socket socket_;
|| | ^~~~~~~
msghub/src/hubconnection.h|43 col 12| warning: ‘hub& hubconnection::courier_’ [-Wreorder]
|| 43 | hub& courier_;
|| | ^~~~~~~~
msghub/src/hubconnection.cpp|24 col 1| warning: when initialized here [-Wreorder]
|| 24 | hubconnection::hubconnection(boost::asio::io_service& io_service, hub& courier)
|| | ^~~~~~~~~~~~~
|| [ 78%] Building CXX object CMakeFiles/server.dir/msghub/src/hubmessage.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubmessage.cpp:1:
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| [ 85%] Building CXX object CMakeFiles/server.dir/msghub/src/msghub.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h:5,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| [ 92%] Building CXX object CMakeFiles/server.dir/msghub/src/msghub_impl.cpp.o
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/hubconnection.h:5,
msghub/src/hubmessage.h|31 col 3| warning: ISO C++ prohibits anonymous structs [-Wpedantic]
|| 31 | {
|| | ^
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp:1:
|| /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.h: In constructor ‘msghub_impl::msghub_impl(boost::asio::io_service&)’:
msghub/src/msghub_impl.h|47 col 35| warning: ‘msghub_impl::publisher_’ will be initialized after [-Wreorder]
|| 47 | boost::shared_ptr<hubconnection> publisher_;
|| | ^~~~~~~~~~
msghub/src/msghub_impl.h|45 col 16| warning: ‘boost::asio::ip::tcp::acceptor msghub_impl::acceptor_’ [-Wreorder]
|| 45 | tcp::acceptor acceptor_;
|| | ^~~~~~~~~
msghub/src/msghub_impl.cpp|46 col 1| warning: when initialized here [-Wreorder]
|| 46 | msghub_impl::msghub_impl(boost::asio::io_service& io_service)
|| | ^~~~~~~~~~~
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp:1:
msghub/src/msghub_impl.h|45 col 16| warning: ‘msghub_impl::acceptor_’ will be initialized after [-Wreorder]
|| 45 | tcp::acceptor acceptor_;
|| | ^~~~~~~~~
msghub/src/msghub_impl.h|44 col 27| warning: ‘boost::asio::io_service& msghub_impl::io_service_’ [-Wreorder]
|| 44 | boost::asio::io_service& io_service_;
|| | ^~~~~~~~~~~
msghub/src/msghub_impl.cpp|46 col 1| warning: when initialized here [-Wreorder]
|| 46 | msghub_impl::msghub_impl(boost::asio::io_service& io_service)
|| | ^~~~~~~~~~~
|| In file included from /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp:1:
msghub/src/msghub_impl.h|44 col 27| warning: ‘msghub_impl::io_service_’ will be initialized after [-Wreorder]
|| 44 | boost::asio::io_service& io_service_;
|| | ^~~~~~~~~~~
msghub/src/msghub_impl.h|42 col 8| warning: ‘bool msghub_impl::initok_’ [-Wreorder]
|| 42 | bool initok_;
|| | ^~~~~~~
msghub/src/msghub_impl.cpp|46 col 1| warning: when initialized here [-Wreorder]
|| 46 | msghub_impl::msghub_impl(boost::asio::io_service& io_service)
|| | ^~~~~~~~~~~
|| /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp: In member function ‘virtual void msghub_impl::deliver(boost::shared_ptr<hubconnection>, hubmessage&)’:
msghub/src/msghub_impl.cpp|203 col 60| warning: unused parameter ‘publisher’ [-Wunused-parameter]
|| 203 | void msghub_impl::deliver(boost::shared_ptr<hubconnection> publisher, hubmessage& msg)
|| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
|| /home/sehe/Projects/stackoverflow/msghub/src/msghub_impl.cpp: In member function ‘void msghub_impl::handle_accept(boost::shared_ptr<hubclient>, const boost::system::error_code&)’:
msghub/src/msghub_impl.cpp|233 col 7| warning: unused variable ‘e’ [-Wunused-variable]
|| 233 | int e = error.value();
|| | ^
|| [100%] Linking CXX executable server
|| [100%] Built target server