Pavel Solodovnikov
<pavel.al.solodovnikov@gmail.com>unread,Apr 8, 2019, 12:09:49 PM4/8/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
to seastar-dev@googlegroups.com, Pavel Solodovnikov
Tested with Clang 7.0.1.
* Place `operator <<` for `compat::optional<net::inet_address::family>` prior to the call site in `logger::stringer_for`
* Fixed `-Wunused-lambda-capture` in `reactor.cc`
---
src/core/reactor.cc | 2 +-
src/net/dns.cc | 30 +++++++++++++++++++++---------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/src/core/reactor.cc b/src/core/reactor.cc
index 360a54e8..95f5a2eb 100644
--- a/src/core/reactor.cc
+++ b/src/core/reactor.cc
@@ -3017,7 +3017,7 @@ reactor::file_accessible(sstring pathname, access_flags flags) {
auto aflags = std::underlying_type_t<access_flags>(flags);
auto ret = ::access(pathname.c_str(), aflags);
return wrap_syscall(ret);
- }).then([this, pathname, flags] (syscall_result<int> sr) {
+ }).then([pathname, flags] (syscall_result<int> sr) {
if (sr.result < 0) {
if ((sr.error == ENOENT && flags == access_flags::exists) ||
(sr.error == EACCES && flags != access_flags::exists)) {
diff --git a/src/net/dns.cc b/src/net/dns.cc
index 9a7d0409..abffc99e 100644
--- a/src/net/dns.cc
+++ b/src/net/dns.cc
@@ -25,19 +25,17 @@
#include <ares.h>
#include <boost/lexical_cast.hpp>
-#include <seastar/net/ip.hh>
-#include <seastar/net/api.hh>
-#include <seastar/net/dns.hh>
-#include <seastar/core/sstring.hh>
-#include <seastar/core/timer.hh>
-#include <seastar/core/reactor.hh>
-#include <seastar/core/gate.hh>
-#include <seastar/core/print.hh>
-#include <seastar/util/log.hh>
+#include <ostream>
#include <seastar/util/std-compat.hh>
+#include <seastar/net/inet_address.hh>
namespace seastar {
+// NOTE: Should be prior to <seastar/util/log.hh> include because
+// logger::stringer_for<T> needs to see the corresponding `operator <<`
+// declaration at the call site
+//
+// This doesn't need to be in the public API, so leave it there instead of placing into `inet_address.hh`
std::ostream& operator<<(std::ostream& os, const compat::optional<net::inet_address::family>& f) {
if (f) {
return os << *f;
@@ -46,6 +44,20 @@ std::ostream& operator<<(std::ostream& os, const compat::optional<net::inet_addr
}
}
+}
+
+#include <seastar/net/ip.hh>
+#include <seastar/net/api.hh>
+#include <seastar/net/dns.hh>
+#include <seastar/core/sstring.hh>
+#include <seastar/core/timer.hh>
+#include <seastar/core/reactor.hh>
+#include <seastar/core/gate.hh>
+#include <seastar/core/print.hh>
+#include <seastar/util/log.hh>
+
+namespace seastar {
+
static logger dns_log("dns_resolver");
class ares_error_category : public std::error_category {
--
2.17.1