Add Wdeprecated flag.

GitOrigin-RevId: 8aa900d7103efd0207f7f0fcb09e3bd2b7387564
This commit is contained in:
levlam 2018-08-28 01:08:51 +03:00
parent 692bc1f26d
commit f9cbe247cd
6 changed files with 23 additions and 11 deletions

View File

@ -202,6 +202,7 @@ if (NOT MSVC)
add_cxx_compiler_flag("-Wconversion") add_cxx_compiler_flag("-Wconversion")
add_cxx_compiler_flag("-Wno-sign-conversion") add_cxx_compiler_flag("-Wno-sign-conversion")
add_cxx_compiler_flag("-Wc++14-compat-pedantic") add_cxx_compiler_flag("-Wc++14-compat-pedantic")
add_cxx_compiler_flag("-Wdeprecated")
add_cxx_compiler_flag("-Qunused-arguments") add_cxx_compiler_flag("-Qunused-arguments")
add_cxx_compiler_flag("-Wodr") add_cxx_compiler_flag("-Wodr")
add_cxx_compiler_flag("-flto-odr-type-merging") add_cxx_compiler_flag("-flto-odr-type-merging")

View File

@ -72,6 +72,12 @@ class MultiSequenceDispatcher;
// Do not forget to update MessagesManager::update_message_content when one of the inheritors of this class changes // Do not forget to update MessagesManager::update_message_content when one of the inheritors of this class changes
class MessageContent { class MessageContent {
public: public:
MessageContent() = default;
MessageContent(const MessageContent &) = default;
MessageContent &operator=(const MessageContent &) = default;
MessageContent(MessageContent &&) = default;
MessageContent &operator=(MessageContent &&) = default;
virtual int32 get_id() const = 0; virtual int32 get_id() const = 0;
virtual ~MessageContent() = default; virtual ~MessageContent() = default;
}; };

View File

@ -324,9 +324,9 @@ Result<BufferSlice> Encryptor::pread(int64 offset, int64 size) {
} }
Result<EncryptedValue> encrypt_value(const Secret &secret, Slice data) { Result<EncryptedValue> encrypt_value(const Secret &secret, Slice data) {
auto random_prefix_view = BufferSliceDataView(gen_random_prefix(data.size())); BufferSliceDataView random_prefix_view{gen_random_prefix(data.size())};
auto data_view = BufferSliceDataView(BufferSlice(data)); BufferSliceDataView data_view{BufferSlice(data)};
auto full_view = ConcatDataView(random_prefix_view, data_view); ConcatDataView full_view{random_prefix_view, data_view};
TRY_RESULT(hash, calc_value_hash(full_view)); TRY_RESULT(hash, calc_value_hash(full_view));
@ -353,9 +353,9 @@ Result<ValueHash> encrypt_file(const Secret &secret, std::string src, std::strin
TRY_RESULT(dest_file, FileFd::open(dest, FileFd::Flags::Truncate | FileFd::Flags::Write | FileFd::Create)); TRY_RESULT(dest_file, FileFd::open(dest, FileFd::Flags::Truncate | FileFd::Flags::Write | FileFd::Create));
auto src_file_size = src_file.get_size(); auto src_file_size = src_file.get_size();
auto random_prefix_view = BufferSliceDataView(gen_random_prefix(src_file_size)); BufferSliceDataView random_prefix_view(gen_random_prefix(src_file_size));
auto data_view = FileDataView(src_file, src_file_size); FileDataView data_view(src_file, src_file_size);
auto full_view = ConcatDataView(random_prefix_view, data_view); ConcatDataView full_view(random_prefix_view, data_view);
TRY_RESULT(hash, calc_value_hash(full_view)); TRY_RESULT(hash, calc_value_hash(full_view));
@ -371,7 +371,7 @@ Status decrypt_file(const Secret &secret, const ValueHash &hash, std::string src
TRY_RESULT(dest_file, FileFd::open(dest, FileFd::Flags::Truncate | FileFd::Flags::Write | FileFd::Create)); TRY_RESULT(dest_file, FileFd::open(dest, FileFd::Flags::Truncate | FileFd::Flags::Write | FileFd::Create));
auto src_file_size = src_file.get_size(); auto src_file_size = src_file.get_size();
auto src_file_view = FileDataView(src_file, src_file_size); FileDataView src_file_view(src_file, src_file_size);
auto aes_cbc_state = calc_aes_cbc_state_sha512(PSLICE() << secret.as_slice() << hash.as_slice()); auto aes_cbc_state = calc_aes_cbc_state_sha512(PSLICE() << secret.as_slice() << hash.as_slice());
Decryptor decryptor(aes_cbc_state); Decryptor decryptor(aes_cbc_state);

View File

@ -63,6 +63,12 @@ class ValueHash {
class DataView { class DataView {
public: public:
DataView() = default;
DataView(const DataView &) = delete;
DataView &operator=(const DataView &) = delete;
DataView(DataView &&) = delete;
DataView &operator=(DataView &&) = delete;
virtual int64 size() const = 0; virtual int64 size() const = 0;
virtual Result<BufferSlice> pread(int64 offset, int64 size) = 0; virtual Result<BufferSlice> pread(int64 offset, int64 size) = 0;
virtual ~DataView() = default; virtual ~DataView() = default;

View File

@ -16,7 +16,6 @@ namespace td {
class DcId { class DcId {
public: public:
DcId() = default; DcId() = default;
DcId(const DcId &other) = default;
static bool is_valid(int32 dc_id) { static bool is_valid(int32 dc_id) {
return 1 <= dc_id && dc_id <= 1000; return 1 <= dc_id && dc_id <= 1000;

View File

@ -32,10 +32,10 @@ TEST(SecureStorage, simple) {
auto value_secret = Secret::create_new(); auto value_secret = Secret::create_new();
{ {
auto value_view = BufferSliceDataView(value.copy()); BufferSliceDataView value_view(value.copy());
BufferSlice prefix = gen_random_prefix(value_view.size()); BufferSlice prefix = gen_random_prefix(value_view.size());
auto prefix_view = BufferSliceDataView(std::move(prefix)); BufferSliceDataView prefix_view(std::move(prefix));
auto full_value_view = ConcatDataView(prefix_view, value_view); ConcatDataView full_value_view(prefix_view, value_view);
auto hash = calc_value_hash(full_value_view).move_as_ok(); auto hash = calc_value_hash(full_value_view).move_as_ok();
Encryptor encryptor(calc_aes_cbc_state_sha512(PSLICE() << value_secret.as_slice() << hash.as_slice()), Encryptor encryptor(calc_aes_cbc_state_sha512(PSLICE() << value_secret.as_slice() << hash.as_slice()),