From 46093e33ff8db446faa2852eec07ca43f58a6145 Mon Sep 17 00:00:00 2001 From: Roy Jacobson Date: Sun, 30 Apr 2023 10:32:30 +0300 Subject: [PATCH] chore: Fix errors/warnings in GCC13 (#1155) * chore: Fix errors/warnings in GCC13 * OpResult: Add non const overloads to */-> so we can std::move from the result * Run clang-format on file --- src/core/small_string.h | 1 + src/core/string_map.h | 2 ++ src/core/string_set.h | 2 ++ src/facade/memcache_parser.h | 5 +++-- src/facade/op_status.h | 9 +++++++++ src/server/main_service.cc | 2 +- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/core/small_string.h b/src/core/small_string.h index 045b9fba8..0cc93d625 100644 --- a/src/core/small_string.h +++ b/src/core/small_string.h @@ -3,6 +3,7 @@ // #pragma once +#include #include #include "core/core_types.h" diff --git a/src/core/string_map.h b/src/core/string_map.h index ca2653563..cac452f64 100644 --- a/src/core/string_map.h +++ b/src/core/string_map.h @@ -4,6 +4,8 @@ #pragma once +#include + #include "core/dense_set.h" extern "C" { diff --git a/src/core/string_set.h b/src/core/string_set.h index acd804b86..d996bf814 100644 --- a/src/core/string_set.h +++ b/src/core/string_set.h @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include "core/dense_set.h" diff --git a/src/facade/memcache_parser.h b/src/facade/memcache_parser.h index 39d9daf22..1b433cf8a 100644 --- a/src/facade/memcache_parser.h +++ b/src/facade/memcache_parser.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include @@ -48,7 +49,7 @@ class MemcacheParser { union { uint64_t cas_unique = 0; // for CAS COMMAND - uint64_t delta; // for DECR/INCR commands. + uint64_t delta; // for DECR/INCR commands. }; uint32_t expire_ts = 0; // relative time in seconds. @@ -75,4 +76,4 @@ class MemcacheParser { private: }; -} // namespace dfly +} // namespace facade diff --git a/src/facade/op_status.h b/src/facade/op_status.h index 424dc9a66..685ba1457 100644 --- a/src/facade/op_status.h +++ b/src/facade/op_status.h @@ -4,6 +4,7 @@ #pragma once +#include #include namespace facade { @@ -75,6 +76,14 @@ template class OpResult : public OpResultBase { return status() == OpStatus::OK ? v_ : v; } + V* operator->() { + return &v_; + } + + V& operator*() { + return v_; + } + const V* operator->() const { return &v_; } diff --git a/src/server/main_service.cc b/src/server/main_service.cc index 076ae2b07..702f927d2 100644 --- a/src/server/main_service.cc +++ b/src/server/main_service.cc @@ -1057,7 +1057,7 @@ optional Service::FlushEvalAsyncCmds(ConnectionC info->async_cmds_heap_mem = 0; info->async_cmds.clear(); - auto reply = move(crb.Take()); + auto reply = crb.Take(); return CapturingReplyBuilder::GetError(reply) ? make_optional(move(reply)) : nullopt; }