Skip to content

Commit

Permalink
fix clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Nov 8, 2024
1 parent 9e94f75 commit 156b18d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/meta/duplication/meta_duplication_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#include <stdint.h>
#include <cstdint>
#include <functional>
#include <map>
#include <memory>
Expand Down
4 changes: 3 additions & 1 deletion src/meta/test/meta_state/meta_state_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ void provider_basic_test(const service_creator_func &service_creator,
CHECK_EQ(0xdeadbeef, read_value);
})
->wait();
writer = dsn::binary_writer();
}
{
dsn::binary_writer writer;
writer.write(0xbeefdead);
service
->set_data(
Expand Down
4 changes: 4 additions & 0 deletions src/rpc/rpc_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ class rpc_write_stream : public binary_writer
message_ex *_msg;
bool _last_write_next_committed;
int _last_write_next_total_size;

rpc_write_stream() = delete;
};

typedef ::dsn::ref_ptr<rpc_write_stream> rpc_write_stream_ptr;

} // namespace dsn
3 changes: 3 additions & 0 deletions src/utils/binary_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ class binary_writer
int _total_size;
int _reserved_size_per_buffer;
static const int kReservedSizePerBuffer;

DISALLOW_COPY_AND_ASSIGN(binary_writer);
DISALLOW_MOVE_AND_ASSIGN(binary_writer);
};

//--------------- inline implementation -------------------
Expand Down
18 changes: 15 additions & 3 deletions src/utils/ports.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,21 @@
#define dsn_likely(pred) (__builtin_expect((pred), 1))
#define dsn_unlikely(pred) (__builtin_expect((pred), 0))

#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName &) = delete; \
void operator=(const TypeName &) = delete
#define DECLARE_COPY_AND_ASSIGN(type, action) \
type(const type &) = action; \
type &operator=(const type &) = action

#define DECLARE_MOVE_AND_ASSIGN(type, action) \
type(type &&) = action; \
type &operator=(type &&) = action

#define DEFAULT_COPY_AND_ASSIGN(type) DECLARE_COPY_AND_ASSIGN(type, default)

#define DEFAULT_MOVE_AND_ASSIGN(type) DECLARE_MOVE_AND_ASSIGN(type, default)

#define DISALLOW_COPY_AND_ASSIGN(type) DECLARE_COPY_AND_ASSIGN(type, delete)

#define DISALLOW_MOVE_AND_ASSIGN(type) DECLARE_MOVE_AND_ASSIGN(type, delete)

#if defined OS_LINUX || defined OS_CYGWIN

Expand Down

0 comments on commit 156b18d

Please sign in to comment.