Skip to content

Commit b879aa5

Browse files
include & warning fixes
Closes #12 & #13
1 parent b4f2126 commit b879aa5

File tree

8 files changed

+31
-20
lines changed

8 files changed

+31
-20
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ target_link_libraries(boost_async PUBLIC
126126
Boost::system
127127
Threads::Threads)
128128
target_compile_definitions(boost_async PRIVATE BOOST_ASYNC_SOURCE=1 )
129+
target_compile_definitions(boost_async PUBLIC BOOST_PROCESS_USE_STD_FS=1)
129130

130131
if (BOOST_ASYNC_USE_BOOST_CONTAINER)
131132
target_link_libraries(boost_async PUBLIC Boost::container)

include/boost/async/io/buffers/any_dynamic_buffer.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#include <boost/async/io/buffers/mutable_buffer_span.hpp>
1616
#include <boost/async/io/buffers/range.hpp>
1717
#include <boost/async/io/buffers/concepts.hpp>
18+
19+
#include <boost/asio/detail/socket_types.hpp>
20+
21+
1822
#include <cstdlib>
1923

2024
namespace boost::async::io::buffers {

include/boost/async/io/endpoint.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <boost/static_string.hpp>
1717
#include <boost/system/result.hpp>
1818

19+
#include <span>
20+
1921
namespace boost::async::detail
2022
{
2123

@@ -32,7 +34,7 @@ struct endpoint;
3234
struct stream_socket;
3335

3436

35-
#if __GNUC__
37+
#if __GNUC__ && !defined(__clang__)
3638
#pragma GCC diagnostic push
3739
#pragma GCC diagnostic ignored "-Wsubobject-linkage"
3840
#endif
@@ -185,7 +187,7 @@ struct endpoint
185187
protocol_type::type_t type_ = static_cast<protocol_type::type_t>(0);
186188
};
187189

188-
#if __GNUC__
190+
#if __GNUC__ && !defined(__clang__)
189191
#pragma GCC diagnostic pop
190192
#endif
191193

src/io/popen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ system::result<bool> popen::running()
7171
{
7272
system::error_code ec;
7373
auto res = popen_.running(ec);
74-
return ec ? ec : system::result<bool>(res);
74+
return ec ? system::result<bool>(system::in_place_error, ec) : system::result<bool>(res);
7575
}
7676

7777
system::result<void> popen::close()

src/io/process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ system::result<bool> process::running()
8181
{
8282
system::error_code ec;
8383
auto res = process_.running(ec);
84-
return ec ? ec : system::result<bool>(res);
84+
return ec ? system::result<bool>(system::in_place_error, ec) : system::result<bool>(res);
8585
}
8686

8787
}

src/io/resolver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
#include <boost/async/io/resolver.hpp>
99

10+
#include <boost/asio/deferred.hpp>
11+
#include <boost/system/result.hpp>
12+
1013
namespace boost::async::io
1114
{
1215

src/io/socket.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,22 @@ system::result <std::size_t> socket::bytes_readable()
8686
return ec ? ec : system::result<std::size_t>(opt.get());
8787
}
8888

89-
#define DEFINE_OPTION(Name, Type) \
90-
system::result<void> socket::set_##Name(Type value) \
91-
{ \
92-
system::error_code ec; \
93-
socket_.set_option(asio::socket_base::Name(value), ec); \
94-
return ec ? ec : system::result<void>{}; \
95-
} \
96-
\
97-
system::result<Type> socket::get_##Name() const \
98-
{ \
99-
system::error_code ec; \
100-
asio::socket_base::Name opt; \
101-
socket_.get_option(opt, ec); \
102-
return ec ? ec : system::result<Type>(opt.value()); \
89+
#define DEFINE_OPTION(Name, Type) \
90+
system::result<void> socket::set_##Name(Type value) \
91+
{ \
92+
system::error_code ec; \
93+
socket_.set_option(asio::socket_base::Name(value), ec); \
94+
return ec ? ec : system::result<void>{}; \
95+
} \
96+
\
97+
system::result<Type> socket::get_##Name() const \
98+
{ \
99+
system::error_code ec; \
100+
asio::socket_base::Name opt; \
101+
socket_.get_option(opt, ec); \
102+
return ec \
103+
? system::result<Type>(system::in_place_error, ec) \
104+
: system::result<Type>(system::in_place_value, opt.value()); \
103105
}
104106

105107
DEFINE_OPTION(debug, bool);

test/io/ssl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ CO_TEST_CASE("ssl")
2626
CHECK_MESSAGE(conn, conn.error().message());
2727

2828
CHECK_NOTHROW(co_await ss.async_handshake(async::io::ssl_stream::handshake_type::client).value());
29-
co_await ss;
30-
29+
co_await ss.write_some("GET");
3130
CHECK_NOTHROW(co_await ss.async_shutdown());
3231
}

0 commit comments

Comments
 (0)