From c19deb1c9fb6d1ecd37db8f4d8148666bbdbb79d Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 5 Jun 2026 15:46:08 +0300 Subject: Remove empty second parameter of static_assert. --- benchmark/bench_actor.cpp | 4 ++-- memprof/memprof.cpp | 4 ++-- memprof/memprof_stat.cpp | 4 ++-- td/telegram/AuthManager.cpp | 3 +-- td/telegram/BotInfoManager.cpp | 3 +-- td/telegram/DeviceTokenManager.cpp | 3 +-- td/telegram/DialogId.cpp | 9 ++++----- td/telegram/DialogManager.cpp | 14 +++++--------- td/telegram/MessageEntity.cpp | 2 +- td/telegram/MessageQueryManager.cpp | 3 +-- td/telegram/MessagesManager.cpp | 12 ++++-------- td/telegram/ReactionManager.cpp | 6 ++---- td/telegram/Requests.cpp | 32 ++++++++++++++------------------ td/telegram/SecretChatActor.cpp | 3 +-- td/telegram/StarManager.cpp | 3 +-- td/telegram/StickersManager.cpp | 33 +++++++++++---------------------- td/telegram/UserManager.cpp | 12 ++++-------- tdutils/td/utils/StealingQueue.h | 2 +- tdutils/td/utils/WaitFreeHashMap.h | 2 +- tdutils/td/utils/WaitFreeHashSet.h | 2 +- tdutils/td/utils/crypto.cpp | 4 ++-- 21 files changed, 62 insertions(+), 98 deletions(-) diff --git a/benchmark/bench_actor.cpp b/benchmark/bench_actor.cpp index dee1d8aac..cd70c59c7 100644 --- a/benchmark/bench_actor.cpp +++ b/benchmark/bench_actor.cpp @@ -87,7 +87,7 @@ class RingBench final : public td::Benchmark { public: td::string get_description() const final { static const char *types[] = {"later", "immediate", "raw", "tail", "lambda"}; - static_assert(0 <= type && type < 5, ""); + static_assert(0 <= type && type < 5); return PSTRING() << "Ring (send_" << types[type] << ") (threads_n = " << thread_n_ << ")"; } @@ -174,7 +174,7 @@ class QueryBench final : public td::Benchmark { public: td::string get_description() const final { static const char *types[] = {"callback", "immediate future", "delayed future", "dummy", "lambda", "lambda_future"}; - static_assert(0 <= type && type < 6, ""); + static_assert(0 <= type && type < 6); return PSTRING() << "QueryBench: " << types[type]; } diff --git a/memprof/memprof.cpp b/memprof/memprof.cpp index bcca13a6d..9925da0da 100644 --- a/memprof/memprof.cpp +++ b/memprof/memprof.cpp @@ -213,8 +213,8 @@ void register_xalloc(malloc_info *info, std::int32_t diff) { extern "C" { static void *malloc_with_frame(std::size_t size, const Backtrace &frame) { - static_assert(RESERVED_SIZE % alignof(std::max_align_t) == 0, "fail"); - static_assert(RESERVED_SIZE >= sizeof(malloc_info), "fail"); + static_assert(RESERVED_SIZE % alignof(std::max_align_t) == 0); + static_assert(RESERVED_SIZE >= sizeof(malloc_info)); #if TD_DARWIN static void *malloc_void = dlsym(RTLD_NEXT, "malloc"); static auto malloc_old = *reinterpret_cast(&malloc_void); diff --git a/memprof/memprof_stat.cpp b/memprof/memprof_stat.cpp index be5fb2664..aada3b92b 100644 --- a/memprof/memprof_stat.cpp +++ b/memprof/memprof_stat.cpp @@ -55,8 +55,8 @@ static constexpr std::size_t RESERVED_SIZE = 16; static constexpr std::int32_t MALLOC_INFO_MAGIC = 0x27138373; static void *do_malloc(std::size_t size) { - static_assert(RESERVED_SIZE % alignof(std::max_align_t) == 0, "fail"); - static_assert(RESERVED_SIZE >= sizeof(malloc_info), "fail"); + static_assert(RESERVED_SIZE % alignof(std::max_align_t) == 0); + static_assert(RESERVED_SIZE >= sizeof(malloc_info)); #if TD_DARWIN static void *malloc_void = dlsym(RTLD_NEXT, "malloc"); static auto malloc_old = *reinterpret_cast(&malloc_void); diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index bcc7c297e..8a99e8c29 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -1086,8 +1086,7 @@ void AuthManager::on_send_code_result(NetQueryPtr &&net_query) { void AuthManager::on_set_premium_purchase_transaction_result(NetQueryPtr &&net_query) { static_assert(std::is_same::value, - ""); + telegram_api::payments_assignPlayMarketTransaction::ReturnType>::value); auto result = fetch_result(std::move(net_query)); if (result.is_error()) { return on_current_query_error(result.move_as_error()); diff --git a/td/telegram/BotInfoManager.cpp b/td/telegram/BotInfoManager.cpp index 4d32c00c6..c33710a29 100644 --- a/td/telegram/BotInfoManager.cpp +++ b/td/telegram/BotInfoManager.cpp @@ -402,8 +402,7 @@ class BotInfoManager::AddPreviewMediaQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::bots_editPreviewMedia::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/DeviceTokenManager.cpp b/td/telegram/DeviceTokenManager.cpp index da5e43dd1..049df2d0d 100644 --- a/td/telegram/DeviceTokenManager.cpp +++ b/td/telegram/DeviceTokenManager.cpp @@ -421,8 +421,7 @@ void DeviceTokenManager::on_result(NetQueryPtr net_query) { CHECK(info.state != TokenInfo::State::Sync); static_assert(std::is_same::value, - ""); + telegram_api::account_unregisterDevice::ReturnType>::value); auto r_flag = fetch_result(std::move(net_query)); if (r_flag.is_ok() && r_flag.ok()) { if (info.promise) { diff --git a/td/telegram/DialogId.cpp b/td/telegram/DialogId.cpp index a83c41a8b..56aebbe4e 100644 --- a/td/telegram/DialogId.cpp +++ b/td/telegram/DialogId.cpp @@ -19,12 +19,11 @@ bool DialogId::is_valid() const { DialogType DialogId::get_type() const { // check that valid ranges are continuous - static_assert(ZERO_CHANNEL_ID + 1 == -ChatId::MAX_CHAT_ID, ""); - static_assert( - ZERO_SECRET_CHAT_ID + std::numeric_limits::max() + 1 == ZERO_CHANNEL_ID - ChannelId::MAX_CHANNEL_ID, ""); + static_assert(ZERO_CHANNEL_ID + 1 == -ChatId::MAX_CHAT_ID); + static_assert(ZERO_SECRET_CHAT_ID + std::numeric_limits::max() + 1 == + ZERO_CHANNEL_ID - ChannelId::MAX_CHANNEL_ID); static_assert(ZERO_CHANNEL_ID - ChannelId::MIN_MONOFORUM_CHANNEL_ID + 1 == - ZERO_SECRET_CHAT_ID + std::numeric_limits::min(), - ""); + ZERO_SECRET_CHAT_ID + std::numeric_limits::min()); if (id < 0) { if (-ChatId::MAX_CHAT_ID <= id) { return DialogType::Chat; diff --git a/td/telegram/DialogManager.cpp b/td/telegram/DialogManager.cpp index 578704380..7de4fb638 100644 --- a/td/telegram/DialogManager.cpp +++ b/td/telegram/DialogManager.cpp @@ -111,8 +111,7 @@ class CheckChannelUsernameQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::channels_checkUsername::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -251,8 +250,7 @@ class EditDialogTitleQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::channels_editTitle::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -316,8 +314,7 @@ class EditDialogPhotoQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::channels_editPhoto::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -665,8 +662,7 @@ class UpdatePeerSettingsQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_hidePeerSettingsBar::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -1068,7 +1064,7 @@ class ToggleDialogIsBlockedQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert( - std::is_same::value, ""); + std::is_same::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index ef422201a..363f0a762 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -59,7 +59,7 @@ int MessageEntity::get_type_priority(Type type) { 99 /*CustomEmoji*/, 0 /*ExpandableBlockQuote*/, 30 /*FormattedDate*/}; - static_assert(sizeof(priorities) / sizeof(priorities[0]) == static_cast(MessageEntity::Type::Size), ""); + static_assert(sizeof(priorities) / sizeof(priorities[0]) == static_cast(MessageEntity::Type::Size)); return priorities[static_cast(type)]; } diff --git a/td/telegram/MessageQueryManager.cpp b/td/telegram/MessageQueryManager.cpp index 110d6095e..549cf8167 100644 --- a/td/telegram/MessageQueryManager.cpp +++ b/td/telegram/MessageQueryManager.cpp @@ -321,8 +321,7 @@ class EditMessageFactCheckQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_editFactCheck::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 05ab5cf51..7265cc787 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -937,17 +937,13 @@ class SearchMessagesQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_search::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::messages_search::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::messages_search::ReturnType>::value); static_assert( - std::is_same::value, - ""); + std::is_same::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/ReactionManager.cpp b/td/telegram/ReactionManager.cpp index 31db79fd9..261e99632 100644 --- a/td/telegram/ReactionManager.cpp +++ b/td/telegram/ReactionManager.cpp @@ -91,11 +91,9 @@ class GetReactionListQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_getTopReactions::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::messages_getDefaultTagReactions::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/Requests.cpp b/td/telegram/Requests.cpp index 509b86c76..d6e28c014 100644 --- a/td/telegram/Requests.cpp +++ b/td/telegram/Requests.cpp @@ -2029,34 +2029,30 @@ Promise Requests::create_sent_email_code_request_promise(uint64 i #define CREATE_REQUEST_PROMISE() auto promise = create_request_promise::ReturnType>(id) -#define CREATE_OK_REQUEST_PROMISE() \ - static_assert(std::is_same::ReturnType, td_api::object_ptr>::value, ""); \ +#define CREATE_OK_REQUEST_PROMISE() \ + static_assert(std::is_same::ReturnType, td_api::object_ptr>::value); \ auto promise = create_ok_request_promise(id) -#define CREATE_TEXT_REQUEST_PROMISE() \ - static_assert(std::is_same::ReturnType, td_api::object_ptr>::value, \ - ""); \ +#define CREATE_TEXT_REQUEST_PROMISE() \ + static_assert(std::is_same::ReturnType, td_api::object_ptr>::value); \ auto promise = create_text_request_promise(id) -#define CREATE_DATA_REQUEST_PROMISE() \ - static_assert(std::is_same::ReturnType, td_api::object_ptr>::value, \ - ""); \ +#define CREATE_DATA_REQUEST_PROMISE() \ + static_assert(std::is_same::ReturnType, td_api::object_ptr>::value); \ auto promise = create_data_request_promise(id) -#define CREATE_HTTP_URL_REQUEST_PROMISE() \ - static_assert(std::is_same::ReturnType, td_api::object_ptr>::value, \ - ""); \ +#define CREATE_HTTP_URL_REQUEST_PROMISE() \ + static_assert( \ + std::is_same::ReturnType, td_api::object_ptr>::value); \ auto promise = create_http_url_request_promise(id) -#define CREATE_COUNT_REQUEST_PROMISE() \ - static_assert(std::is_same::ReturnType, td_api::object_ptr>::value, \ - ""); \ +#define CREATE_COUNT_REQUEST_PROMISE() \ + static_assert(std::is_same::ReturnType, td_api::object_ptr>::value); \ auto promise = create_count_request_promise(id) -#define CREATE_SENT_EMAIL_CODE_REQUEST_PROMISE() \ - static_assert(std::is_same::ReturnType, \ - td_api::object_ptr>::value, \ - ""); \ +#define CREATE_SENT_EMAIL_CODE_REQUEST_PROMISE() \ + static_assert(std::is_same::ReturnType, \ + td_api::object_ptr>::value); \ auto promise = create_sent_email_code_request_promise(id) void Requests::on_request(uint64 id, const td_api::setTdlibParameters &request) { diff --git a/td/telegram/SecretChatActor.cpp b/td/telegram/SecretChatActor.cpp index d24993b8c..0f7e29acb 100644 --- a/td/telegram/SecretChatActor.cpp +++ b/td/telegram/SecretChatActor.cpp @@ -1800,8 +1800,7 @@ Status SecretChatActor::on_update_chat(telegram_api::encryptedChatDiscarded &upd Status SecretChatActor::on_update_chat(NetQueryPtr query) { static_assert(std::is_same::value, - ""); + telegram_api::messages_acceptEncryption::ReturnType>::value); TRY_RESULT(config, fetch_result(std::move(query))); TRY_STATUS(on_update_chat(std::move(config))); if (auth_state_.state == State::WaitRequestResponse) { diff --git a/td/telegram/StarManager.cpp b/td/telegram/StarManager.cpp index cdbf93094..8c09137c5 100644 --- a/td/telegram/StarManager.cpp +++ b/td/telegram/StarManager.cpp @@ -212,8 +212,7 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::payments_getStarsTransactions::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index bd99bf548..45f8a4ee5 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -92,11 +92,9 @@ class GetAllStickersQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_getAllStickers::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::messages_getAllStickers::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -370,8 +368,7 @@ class GetFeaturedStickerSetsQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_getFeaturedEmojiStickers::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -858,8 +855,7 @@ class SearchStickerSetsQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_searchEmojiStickerSets::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -1137,8 +1133,7 @@ class AddStickerToSetQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::stickers_replaceSticker::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -1491,14 +1486,11 @@ class GetEmojiGroupsQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::messages_getEmojiStatusGroups::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::messages_getEmojiProfilePhotoGroups::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::messages_getEmojiStickerGroups::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); @@ -1542,14 +1534,11 @@ class GetDefaultDialogPhotoEmojisQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::account_getDefaultGroupPhotoEmojis::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::account_getDefaultGroupPhotoEmojis::ReturnType>::value); static_assert(std::is_same::value, - ""); + telegram_api::account_getDefaultGroupPhotoEmojis::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/UserManager.cpp b/td/telegram/UserManager.cpp index 5b5d027cb..1b9b12e36 100644 --- a/td/telegram/UserManager.cpp +++ b/td/telegram/UserManager.cpp @@ -549,14 +549,11 @@ class UploadProfilePhotoQuery final : public Td::ResultHandler { only_suggest_ = only_suggest; static_assert(static_cast(telegram_api::photos_uploadProfilePhoto::VIDEO_MASK) == - static_cast(telegram_api::photos_uploadContactProfilePhoto::VIDEO_MASK), - ""); + static_cast(telegram_api::photos_uploadContactProfilePhoto::VIDEO_MASK)); static_assert(static_cast(telegram_api::photos_uploadProfilePhoto::VIDEO_START_TS_MASK) == - static_cast(telegram_api::photos_uploadContactProfilePhoto::VIDEO_START_TS_MASK), - ""); + static_cast(telegram_api::photos_uploadContactProfilePhoto::VIDEO_START_TS_MASK)); static_assert(static_cast(telegram_api::photos_uploadProfilePhoto::FILE_MASK) == - static_cast(telegram_api::photos_uploadContactProfilePhoto::FILE_MASK), - ""); + static_cast(telegram_api::photos_uploadContactProfilePhoto::FILE_MASK)); int32 flags = 0; telegram_api::object_ptr photo_input_file; @@ -636,8 +633,7 @@ class UploadProfilePhotoQuery final : public Td::ResultHandler { void on_result(BufferSlice packet) final { static_assert(std::is_same::value, - ""); + telegram_api::photos_uploadContactProfilePhoto::ReturnType>::value); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/tdutils/td/utils/StealingQueue.h b/tdutils/td/utils/StealingQueue.h index c923cb92e..cbbba4f99 100644 --- a/tdutils/td/utils/StealingQueue.h +++ b/tdutils/td/utils/StealingQueue.h @@ -17,7 +17,7 @@ namespace td { template class StealingQueue { public: - static_assert(N > 0 && (N & (N - 1)) == 0, ""); + static_assert(N > 0 && (N & (N - 1)) == 0); // tries to put a value // returns if succeeded diff --git a/tdutils/td/utils/WaitFreeHashMap.h b/tdutils/td/utils/WaitFreeHashMap.h index 576564c88..6235a2ec7 100644 --- a/tdutils/td/utils/WaitFreeHashMap.h +++ b/tdutils/td/utils/WaitFreeHashMap.h @@ -17,7 +17,7 @@ namespace td { template , class EqT = std::equal_to> class WaitFreeHashMap { static constexpr size_t MAX_STORAGE_COUNT = 1 << 8; - static_assert((MAX_STORAGE_COUNT & (MAX_STORAGE_COUNT - 1)) == 0, ""); + static_assert((MAX_STORAGE_COUNT & (MAX_STORAGE_COUNT - 1)) == 0); static constexpr uint32 DEFAULT_STORAGE_SIZE = 1 << 12; FlatHashMap default_map_; diff --git a/tdutils/td/utils/WaitFreeHashSet.h b/tdutils/td/utils/WaitFreeHashSet.h index 1c21329ff..f90ccbde7 100644 --- a/tdutils/td/utils/WaitFreeHashSet.h +++ b/tdutils/td/utils/WaitFreeHashSet.h @@ -17,7 +17,7 @@ namespace td { template , class EqT = std::equal_to> class WaitFreeHashSet { static constexpr size_t MAX_STORAGE_COUNT = 1 << 8; - static_assert((MAX_STORAGE_COUNT & (MAX_STORAGE_COUNT - 1)) == 0, ""); + static_assert((MAX_STORAGE_COUNT & (MAX_STORAGE_COUNT - 1)) == 0); static constexpr uint32 DEFAULT_STORAGE_SIZE = 1 << 12; FlatHashSet default_set_; diff --git a/tdutils/td/utils/crypto.cpp b/tdutils/td/utils/crypto.cpp index 01fc1ff7a..8b8f85a93 100644 --- a/tdutils/td/utils/crypto.cpp +++ b/tdutils/td/utils/crypto.cpp @@ -312,8 +312,8 @@ struct AesBlock { #endif } }; -static_assert(sizeof(AesBlock) == 16, ""); -static_assert(sizeof(AesBlock) == AES_BLOCK_SIZE, ""); +static_assert(sizeof(AesBlock) == 16); +static_assert(sizeof(AesBlock) == AES_BLOCK_SIZE); class Evp { public: -- cgit v1.2.3