mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
Get DragonDB to compile with clang.
While at it, fix some compile warnings, 2 of them are actual bugs (missing virtual d'tor). Signed-off-by: chakaz <chakaz@chakaz>
This commit is contained in:
parent
bb78c6eae3
commit
9add31e20f
11 changed files with 10 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,7 @@
|
|||
build/*
|
||||
build-*
|
||||
clang/*
|
||||
clang-*
|
||||
.vscode/*.db
|
||||
.vscode/settings.json
|
||||
third_party
|
||||
|
|
|
@ -172,7 +172,6 @@ RedisReplyBuilderTest::ParsingResults RedisReplyBuilderTest::Parse() {
|
|||
auto* ptr = parser_buffer_.get();
|
||||
memcpy(ptr, str().data(), SinkSize());
|
||||
RedisParser parser(false); // client side
|
||||
std::string_view tmp_view{str()};
|
||||
result.result =
|
||||
parser.Parse(RedisParser::Buffer{ptr, SinkSize()}, &result.consumed, &result.args);
|
||||
return result;
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace {
|
|||
|
||||
constexpr auto kPrimeSegmentSize = PrimeTable::kSegBytes;
|
||||
constexpr auto kExpireSegmentSize = ExpireTable::kSegBytes;
|
||||
constexpr auto kTaxSize = PrimeTable::kTaxAmount;
|
||||
|
||||
// mi_malloc good size is 32768. i.e. we have malloc waste of 1.5%.
|
||||
static_assert(kPrimeSegmentSize == 32288);
|
||||
|
|
|
@ -412,7 +412,7 @@ OpStatus DflyCmd::StartStableSyncInThread(FlowInfo* flow, Context* cntx, EngineS
|
|||
}
|
||||
|
||||
// Register cleanup.
|
||||
flow->cleanup = [this, flow]() {
|
||||
flow->cleanup = [flow]() {
|
||||
flow->TryShutdownSocket();
|
||||
if (flow->streamer) {
|
||||
flow->streamer->Cancel();
|
||||
|
@ -626,7 +626,7 @@ void DflyCmd::Shutdown() {
|
|||
void DflyCmd::FlowInfo::TryShutdownSocket() {
|
||||
// Close socket for clean disconnect.
|
||||
if (conn->socket()->IsOpen()) {
|
||||
conn->socket()->Shutdown(SHUT_RDWR);
|
||||
(void)conn->socket()->Shutdown(SHUT_RDWR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,13 +38,10 @@ constexpr unsigned kPoolThreadCount = 4;
|
|||
|
||||
const char kKey1[] = "x";
|
||||
const char kKey2[] = "b";
|
||||
const char kKey3[] = "c";
|
||||
const char kKey4[] = "y";
|
||||
|
||||
const char kKeySid0[] = "x";
|
||||
const char kKeySid1[] = "c";
|
||||
const char kKeySid2[] = "b";
|
||||
const char kKey2Sid0[] = "y";
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ std::string MallocStats(bool backing, unsigned tid) {
|
|||
|
||||
} // namespace
|
||||
|
||||
MemoryCmd::MemoryCmd(ServerFamily* owner, ConnectionContext* cntx) : sf_(*owner), cntx_(cntx) {
|
||||
MemoryCmd::MemoryCmd(ServerFamily* owner, ConnectionContext* cntx) : cntx_(cntx) {
|
||||
}
|
||||
|
||||
void MemoryCmd::Run(CmdArgList args) {
|
||||
|
|
|
@ -17,7 +17,6 @@ class MemoryCmd {
|
|||
void Run(CmdArgList args);
|
||||
|
||||
private:
|
||||
ServerFamily& sf_;
|
||||
ConnectionContext* cntx_;
|
||||
};
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ class DecompressImpl {
|
|||
public:
|
||||
DecompressImpl() : uncompressed_mem_buf_{16_KB} {
|
||||
}
|
||||
~DecompressImpl() {
|
||||
virtual ~DecompressImpl() {
|
||||
}
|
||||
virtual io::Result<base::IoBuf*> Decompress(std::string_view str) = 0;
|
||||
|
||||
|
@ -1955,7 +1955,6 @@ error_code RdbLoaderBase::HandleCompressedBlob(int op_type) {
|
|||
// Decompress blob and switch membuf pointer
|
||||
// Last type in the compressed blob is RDB_OPCODE_COMPRESSED_BLOB_END
|
||||
// in which we will switch back to the origin membuf (HandleCompressedBlobFinish)
|
||||
string_view uncompressed_blob;
|
||||
SET_OR_RETURN(decompress_impl_->Decompress(res), mem_buf_);
|
||||
|
||||
return kOk;
|
||||
|
|
|
@ -148,7 +148,7 @@ class CompressorImpl {
|
|||
CompressorImpl() {
|
||||
compression_level_ = absl::GetFlag(FLAGS_compression_level);
|
||||
}
|
||||
~CompressorImpl() {
|
||||
virtual ~CompressorImpl() {
|
||||
VLOG(1) << "compressed size: " << compressed_size_total_;
|
||||
VLOG(1) << "uncompressed size: " << uncompressed_size_total_;
|
||||
}
|
||||
|
@ -1241,7 +1241,7 @@ void RdbSerializer::AllocateCompressorOnce() {
|
|||
|
||||
void RdbSerializer::CompressBlob() {
|
||||
if (!compression_stats_) {
|
||||
compression_stats_.emplace();
|
||||
compression_stats_.emplace(CompressionStats{});
|
||||
}
|
||||
Bytes blob_to_compress = mem_buf_.InputBuffer();
|
||||
size_t blob_size = blob_to_compress.size();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace dfly {
|
|||
class Service;
|
||||
class ConnectionContext;
|
||||
class JournalExecutor;
|
||||
class JournalReader;
|
||||
struct JournalReader;
|
||||
|
||||
class Replica {
|
||||
private:
|
||||
|
|
|
@ -496,7 +496,7 @@ fibers::future<std::error_code> ServerFamily::Load(const std::string& load_path)
|
|||
// Check all paths are valid.
|
||||
for (const auto& path : paths) {
|
||||
error_code ec;
|
||||
fs::canonical(path, ec);
|
||||
(void)fs::canonical(path, ec);
|
||||
if (ec) {
|
||||
LOG(ERROR) << "Error loading " << load_path << " " << ec.message();
|
||||
fibers::promise<std::error_code> ec_promise;
|
||||
|
|
Loading…
Reference in a new issue