Fix warnings by PVS-Studio

This commit is contained in:
Alexey Milovidov 2021-05-08 23:50:12 +03:00
parent 3b767b4a64
commit 367f7fe6c9
7 changed files with 12 additions and 14 deletions

View File

@ -1,9 +1,6 @@
#ifndef _LIBM_H
#define _LIBM_H
// Disable warnings by PVS-Studio
//-V::GA
#include <stdint.h>
#include <float.h>
#include <math.h>
@ -158,7 +155,7 @@ static inline long double fp_barrierl(long double x)
static inline void fp_force_evalf(float x)
{
volatile float y;
y = x;
y = x; //-V1001
}
#endif
@ -167,7 +164,7 @@ static inline void fp_force_evalf(float x)
static inline void fp_force_eval(double x)
{
volatile double y;
y = x;
y = x; //-V1001
}
#endif
@ -176,7 +173,7 @@ static inline void fp_force_eval(double x)
static inline void fp_force_evall(long double x)
{
volatile long double y;
y = x;
y = x; //-V1001
}
#endif

View File

@ -355,8 +355,9 @@ String DiskAccessStorage::getStorageParamsJSON() const
std::lock_guard lock{mutex};
Poco::JSON::Object json;
json.set("path", directory_path);
if (readonly)
json.set("readonly", readonly.load());
bool readonly_loaded = readonly;
if (readonly_loaded)
json.set("readonly", Poco::Dynamic::Var{true});
std::ostringstream oss; // STYLE_CHECK_ALLOW_STD_STRING_STREAM
oss.exceptions(std::ios::failbit);
Poco::JSON::Stringifier::stringify(json, oss);

View File

@ -305,7 +305,7 @@ template <bool need_zero_value_storage, typename Cell>
struct ZeroValueStorage;
template <typename Cell>
struct ZeroValueStorage<true, Cell> //-V308
struct ZeroValueStorage<true, Cell> //-V730
{
private:
bool has_zero = false;

View File

@ -32,7 +32,7 @@ struct ChangelogRecordHeader
ChangelogVersion version = CURRENT_CHANGELOG_VERSION;
uint64_t index = 0; /// entry log number
uint64_t term = 0;
nuraft::log_val_type value_type;
nuraft::log_val_type value_type{};
uint64_t blob_size = 0;
};

View File

@ -134,7 +134,7 @@ ColumnPtr FunctionHasColumnInTable::executeImpl(const ColumnsWithTypeAndName & a
has_column = remote_columns.hasPhysical(column_name);
}
return DataTypeUInt8().createColumnConst(input_rows_count, Field(has_column));
return DataTypeUInt8().createColumnConst(input_rows_count, Field{UInt64(has_column)});
}
}

View File

@ -85,7 +85,7 @@ public:
auto result_column = ColumnUInt8::create();
auto call = [&](const auto & types) -> bool //-V567
auto call = [&](const auto & types) -> bool //-V657
{
using Types = std::decay_t<decltype(types)>;
using Type = typename Types::RightType;

View File

@ -402,7 +402,7 @@ void StorageRabbitMQ::bindExchange()
}
}
while (!binding_created) //-V1044
while (!binding_created) //-V776
{
event_handler->iterateLoop();
}
@ -463,7 +463,7 @@ void StorageRabbitMQ::bindQueue(size_t queue_id)
const String queue_name = !hash_exchange ? queue_base : std::to_string(queue_id) + "_" + queue_base;
setup_channel->declareQueue(queue_name, AMQP::durable, queue_settings).onSuccess(success_callback).onError(error_callback);
while (!binding_created) //-V1044
while (!binding_created) //-V776
{
event_handler->iterateLoop();
}