eidheim / Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
MIT License
2.62k stars 755 forks source link

Build issue, gcc 7.2 (uninitialized variable in client_http.hpp) #174

Closed SethHamilton closed 6 years ago

SethHamilton commented 6 years ago

I'm seeing the error on on Travis CI using gcc 7.2:

https://travis-ci.org/opset/openset/jobs/303658246

Here is the whole snippet, not sure what to do and I didn't really want to fork your project to test the fix, so I was wondering if you had any insight?

In file included from /home/travis/build/opset/openset/src/http_cli.h:5:0,
                 from /home/travis/build/opset/openset/src/internoderouter.h:6,
                 from /home/travis/build/opset/openset/src/asyncpool.cpp:5:
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp: In instantiation of ‘SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&)::<lambda(const error_code&, std::size_t)> [with socket_type = asio::basic_stream_socket<asio::ip::tcp>; SimpleWeb::error_code = std::error_code; std::size_t = long unsigned int]’:
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:556:123:   required from ‘struct SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]::<lambda(const error_code&, std::size_t)>’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:556:29:   required from ‘void SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:496:19:   required from ‘SimpleWeb::ClientBase<socket_type>::read(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&)::<lambda(const error_code&, std::size_t)> [with socket_type = asio::basic_stream_socket<asio::ip::tcp>; SimpleWeb::error_code = std::error_code; std::size_t = long unsigned int]’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:452:109:   required from ‘struct SimpleWeb::ClientBase<socket_type>::read(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]::<lambda(const error_code&, std::size_t)>’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:452:29:   required from ‘void SimpleWeb::ClientBase<socket_type>::read(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:444:17:   required from ‘SimpleWeb::ClientBase<socket_type>::write(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&)::<lambda(const error_code&, std::size_t)> [with socket_type = asio::basic_stream_socket<asio::ip::tcp>; SimpleWeb::error_code = std::error_code; std::size_t = long unsigned int]’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:438:98:   required from ‘struct SimpleWeb::ClientBase<socket_type>::write(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]::<lambda(const error_code&, std::size_t)>’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:438:24:   required from ‘void SimpleWeb::ClientBase<socket_type>::write(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]’
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:669:36:   required from here
/home/travis/build/opset/openset/vendor/simple-web-server/client_http.hpp:571:25: error: uninitialized variable ‘length’ in ‘constexpr’ function
           unsigned long length;
                         ^~~~~~
In file included from /home/travis/build/opset/openset/vendor/asio/asio/include/asio/read.hpp:945:0,
                 from /home/travis/build/opset/openset/vendor/asio/asio/include/asio.hpp:109,
                 from /home/travis/build/opset/openset/vendor/simple-web-server/server_http.hpp:15,
                 from /home/travis/build/opset/openset/src/http_serve.h:4,
                 from /home/travis/build/opset/openset/src/shuttle.h:8,
                 from /home/travis/build/opset/openset/src/oloop.h:5,
                 from /home/travis/build/opset/openset/src/asyncloop.h:9,
                 from /home/travis/build/opset/openset/src/asyncpool.h:4,
                 from /home/travis/build/opset/openset/src/asyncpool.cpp:2:
/home/travis/build/opset/openset/vendor/asio/asio/include/asio/impl/read.hpp:700:1: error: ‘typename asio::async_result<typename std::decay<WriteHandler>::type, void(std::error_code, long unsigned int)>::return_type asio::async_read(AsyncReadStream&, asio::basic_streambuf<Allocator>&, CompletionCondition, ReadHandler&&) [with AsyncReadStream = asio::basic_stream_socket<asio::ip::tcp>; Allocator = std::allocator<char>; CompletionCondition = asio::detail::transfer_exactly_t; ReadHandler = SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&)::<lambda(const error_code&, std::size_t)> [with socket_type = asio::basic_stream_socket<asio::ip::tcp>; SimpleWeb::error_code = std::error_code; std::size_t = long unsigned int]::<lambda(const error_code&, std::size_t)>; typename asio::async_result<typename std::decay<WriteHandler>::type, void(std::error_code, long unsigned int)>::return_type = void]’, declared using local type ‘SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&)::<lambda(const error_code&, std::size_t)> [with socket_type = asio::basic_stream_socket<asio::ip::tcp>; SimpleWeb::error_code = std::error_code; std::size_t = long unsigned int]::<lambda(const error_code&, std::size_t)>’, is used but never defined [-fpermissive]
 async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
 ^~~~~~~~~~
In file included from /home/travis/build/opset/openset/vendor/asio/asio/include/asio/read_until.hpp:1822:0,
                 from /home/travis/build/opset/openset/vendor/asio/asio/include/asio.hpp:111,
                 from /home/travis/build/opset/openset/vendor/simple-web-server/server_http.hpp:15,
                 from /home/travis/build/opset/openset/src/http_serve.h:4,
                 from /home/travis/build/opset/openset/src/shuttle.h:8,
                 from /home/travis/build/opset/openset/src/oloop.h:5,
                 from /home/travis/build/opset/openset/src/asyncloop.h:9,
                 from /home/travis/build/opset/openset/src/asyncpool.h:4,
                 from /home/travis/build/opset/openset/src/asyncpool.cpp:2:
/home/travis/build/opset/openset/vendor/asio/asio/include/asio/impl/read_until.hpp:1456:1: error: ‘typename asio::async_result<typename std::decay<WriteHandler>::type, void(std::error_code, long unsigned int)>::return_type asio::async_read_until(AsyncReadStream&, asio::basic_streambuf<Allocator>&, std::experimental::fundamentals_v1::string_view, ReadHandler&&) [with AsyncReadStream = asio::basic_stream_socket<asio::ip::tcp>; Allocator = std::allocator<char>; ReadHandler = SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]::<lambda(const error_code&, std::size_t)>; typename asio::async_result<typename std::decay<WriteHandler>::type, void(std::error_code, long unsigned int)>::return_type = void; std::experimental::fundamentals_v1::string_view = std::experimental::fundamentals_v1::basic_string_view<char>]’, declared using local type ‘SimpleWeb::ClientBase<socket_type>::read_chunked(const std::shared_ptr<SimpleWeb::ClientBase<socket_type>::Session>&, const std::shared_ptr<asio::basic_streambuf<> >&) [with socket_type = asio::basic_stream_socket<asio::ip::tcp>]::<lambda(const error_code&, std::size_t)>’, is used but never defined [-fpermissive]
 async_read_until(AsyncReadStream& s,
 ^~~~~~~~~~~~~~~~

It's on this PR of my project https://github.com/opset/openset/pull/13 I'm switching from a custom protocol using libuv to using your excellent project with standalone ASIO. It builds and runs on windows as expected.

Thank you, Seth

eidheim commented 6 years ago

Thank you for reporting this. The easiest thing here was to just initialise the variable, so I did that:)

SethHamilton commented 6 years ago

Thank you, much appreciated. I was going to try that, but I'm still getting used to the git submodules, and last time I messed them up, it was a gong show. 😄

sumanpurani commented 6 years ago

I just want to unsubsribe this

On Sat, Nov 18, 2017 at 10:29 PM, Seth Hamilton notifications@github.com wrote:

Thank you, much appreciated. I was going to try that, but I'm still getting used to the git submodules, and last time I messed them up, it was a gong show. 😄

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eidheim/Simple-Web-Server/issues/174#issuecomment-345455271, or mute the thread https://github.com/notifications/unsubscribe-auth/Aeo9EiGgUeF5jWKbi8DgDEoZ_I9L-KHcks5s3wzsgaJpZM4Qifyo .

314159 commented 6 years ago

@sumanpurani

If you want to unsubscribe to notifications about Simple-Web-Server, then click on the view this on GitHub link, click the Unwatch button and choose Not Watching or Ignoring.

If you want to unsubscribe to comments about this particular issue, then click on the mute the thread link. But it won't be necessary since this thread has been closed.

Both links are at the bottom of the email.