Fix some PVS-Studio warnings

This commit is contained in:
Alexey Milovidov 2021-05-09 01:09:16 +03:00
parent ce9eda6a87
commit 903c306e04
6 changed files with 10 additions and 18 deletions

View File

@ -303,7 +303,7 @@ namespace VolnitskyTraits
{ {
/// ngram for Ul /// ngram for Ul
chars.c0 = c0u; chars.c0 = c0u;
chars.c1 = c1l; chars.c1 = c1l; //-V1048
putNGramBase(n, offset); putNGramBase(n, offset);
} }

View File

@ -4,9 +4,7 @@
#ifdef __linux__ #ifdef __linux__
#include <linux/version.h> #include <linux/version.h>
#endif
#ifdef __linux__
/// Detect does epoll_wait with nested epoll fds works correctly. /// Detect does epoll_wait with nested epoll fds works correctly.
/// Polling nested epoll fds from epoll_wait is required for async_socket_for_remote and use_hedged_requests. /// Polling nested epoll fds from epoll_wait is required for async_socket_for_remote and use_hedged_requests.
/// ///
@ -16,21 +14,15 @@
/// [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c54a6a44bf3 /// [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c54a6a44bf3
bool nestedEpollWorks(Poco::Logger * log) bool nestedEpollWorks(Poco::Logger * log)
{ {
bool nested_epoll_works =
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 13)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 13))
/// the check is correct since there will be no more 5.5.x releases. /// the check is correct since there will be no more 5.5.x releases.
false
#else
true
#endif
;
if (!nested_epoll_works)
{
if (log) if (log)
LOG_WARNING(log, "Nested epoll_wait has some issues on kernels [5.5.0, 5.6.13). You should upgrade it to avoid possible issues."); LOG_WARNING(log, "Nested epoll_wait has some issues on kernels [5.5.0, 5.6.13). You should upgrade it to avoid possible issues.");
} return false;
return nested_epoll_works; #else
(void)log;
return true;
#endif
} }
#else #else
bool nestedEpollWorks(Poco::Logger *) { return true; } bool nestedEpollWorks(Poco::Logger *) { return true; }

View File

@ -63,7 +63,7 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
// Do not deduplicate insertions into MV if the main insertion is Ok // Do not deduplicate insertions into MV if the main insertion is Ok
if (disable_deduplication_for_children) if (disable_deduplication_for_children)
insert_context->setSetting("insert_deduplicate", false); insert_context->setSetting("insert_deduplicate", Field{false});
// Separate min_insert_block_size_rows/min_insert_block_size_bytes for children // Separate min_insert_block_size_rows/min_insert_block_size_bytes for children
if (insert_settings.min_insert_block_size_rows_for_materialized_views) if (insert_settings.min_insert_block_size_rows_for_materialized_views)

View File

@ -160,7 +160,7 @@ struct IndexesSerializationType
return std::make_shared<DataTypeUInt16>(); return std::make_shared<DataTypeUInt16>();
if (type == TUInt32) if (type == TUInt32)
return std::make_shared<DataTypeUInt32>(); return std::make_shared<DataTypeUInt32>();
if (type == TUInt64) if (type == TUInt64) //-V547
return std::make_shared<DataTypeUInt64>(); return std::make_shared<DataTypeUInt64>();
throw Exception("Can't create DataType from IndexesSerializationType.", ErrorCodes::LOGICAL_ERROR); throw Exception("Can't create DataType from IndexesSerializationType.", ErrorCodes::LOGICAL_ERROR);

View File

@ -207,7 +207,7 @@ static Block createBlockFromAST(const ASTPtr & node, const DataTypes & types, Co
assert(tuple || func); assert(tuple || func);
size_t tuple_size = tuple ? tuple->size() : func->arguments->children.size(); size_t tuple_size = tuple ? tuple->size() : func->arguments->children.size(); //-V1004
if (tuple_size != num_columns) if (tuple_size != num_columns)
throw Exception("Incorrect size of tuple in set: " + toString(tuple_size) + " instead of " + toString(num_columns), throw Exception("Incorrect size of tuple in set: " + toString(tuple_size) + " instead of " + toString(num_columns),
ErrorCodes::INCORRECT_ELEMENT_OF_SET); ErrorCodes::INCORRECT_ELEMENT_OF_SET);

View File

@ -276,7 +276,7 @@ protected:
/// List of queries /// List of queries
Container processes; Container processes;
size_t max_size; /// 0 means no limit. Otherwise, when limit exceeded, an exception is thrown. size_t max_size = 0; /// 0 means no limit. Otherwise, when limit exceeded, an exception is thrown.
/// Stores per-user info: queries, statistics and limits /// Stores per-user info: queries, statistics and limits
UserToQueries user_to_queries; UserToQueries user_to_queries;