mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx-test: mdbx: avoid gcc-anylyzer false-positive warnings.
This commit is contained in:
parent
175c361018
commit
8c29c3711d
@ -450,18 +450,14 @@ using namespace config;
|
|||||||
|
|
||||||
actor_config::actor_config(actor_testcase testcase, const actor_params ¶ms,
|
actor_config::actor_config(actor_testcase testcase, const actor_params ¶ms,
|
||||||
unsigned space_id, unsigned wait4id)
|
unsigned space_id, unsigned wait4id)
|
||||||
: params(params) {
|
: actor_config_pod(1 + unsigned(global::actors.size()), testcase, space_id,
|
||||||
this->space_id = space_id;
|
wait4id),
|
||||||
this->actor_id = 1 + (unsigned)global::actors.size();
|
params(params) {}
|
||||||
this->testcase = testcase;
|
|
||||||
this->wait4id = wait4id;
|
|
||||||
signal_nops = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string actor_config::serialize(const char *prefix) const {
|
const std::string actor_config::serialize(const char *prefix) const {
|
||||||
simple_checksum checksum;
|
simple_checksum checksum;
|
||||||
|
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
result.append(prefix);
|
result.append(prefix);
|
||||||
|
|
||||||
@ -473,13 +469,13 @@ const std::string actor_config::serialize(const char *prefix) const {
|
|||||||
result.append(params.pathname_log);
|
result.append(params.pathname_log);
|
||||||
result.push_back('|');
|
result.push_back('|');
|
||||||
|
|
||||||
static_assert(std::is_pod<actor_params_pod>::value,
|
static_assert(std::is_trivially_copyable<actor_params_pod>::value,
|
||||||
"actor_params_pod should by POD");
|
"actor_params_pod should by POD");
|
||||||
result.append(data2hex(static_cast<const actor_params_pod *>(¶ms),
|
result.append(data2hex(static_cast<const actor_params_pod *>(¶ms),
|
||||||
sizeof(actor_params_pod), checksum));
|
sizeof(actor_params_pod), checksum));
|
||||||
result.push_back('|');
|
result.push_back('|');
|
||||||
|
|
||||||
static_assert(std::is_pod<actor_config_pod>::value,
|
static_assert(std::is_trivially_copyable<actor_config_pod>::value,
|
||||||
"actor_config_pod should by POD");
|
"actor_config_pod should by POD");
|
||||||
result.append(data2hex(static_cast<const actor_config_pod *>(this),
|
result.append(data2hex(static_cast<const actor_config_pod *>(this),
|
||||||
sizeof(actor_config_pod), checksum));
|
sizeof(actor_config_pod), checksum));
|
||||||
@ -525,7 +521,7 @@ bool actor_config::deserialize(const char *str, actor_config &config) {
|
|||||||
TRACE("<< actor_config::deserialize: slash-3\n");
|
TRACE("<< actor_config::deserialize: slash-3\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
static_assert(std::is_pod<actor_params_pod>::value,
|
static_assert(std::is_trivially_copyable<actor_params_pod>::value,
|
||||||
"actor_params_pod should by POD");
|
"actor_params_pod should by POD");
|
||||||
if (!hex2data(str, slash, static_cast<actor_params_pod *>(&config.params),
|
if (!hex2data(str, slash, static_cast<actor_params_pod *>(&config.params),
|
||||||
sizeof(actor_params_pod), checksum)) {
|
sizeof(actor_params_pod), checksum)) {
|
||||||
@ -540,7 +536,7 @@ bool actor_config::deserialize(const char *str, actor_config &config) {
|
|||||||
TRACE("<< actor_config::deserialize: slash-4\n");
|
TRACE("<< actor_config::deserialize: slash-4\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
static_assert(std::is_pod<actor_config_pod>::value,
|
static_assert(std::is_trivially_copyable<actor_config_pod>::value,
|
||||||
"actor_config_pod should by POD");
|
"actor_config_pod should by POD");
|
||||||
if (!hex2data(str, slash, static_cast<actor_config_pod *>(&config),
|
if (!hex2data(str, slash, static_cast<actor_config_pod *>(&config),
|
||||||
sizeof(actor_config_pod), checksum)) {
|
sizeof(actor_config_pod), checksum)) {
|
||||||
|
@ -224,55 +224,61 @@ struct keygen_params_pod {
|
|||||||
* номера будет отрезано для генерации значения.
|
* номера будет отрезано для генерации значения.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t width;
|
uint8_t width{0};
|
||||||
uint8_t mesh;
|
uint8_t mesh{0};
|
||||||
uint8_t rotate;
|
uint8_t rotate{0};
|
||||||
uint8_t split;
|
uint8_t split{0};
|
||||||
uint32_t seed;
|
uint32_t seed{0};
|
||||||
uint64_t offset;
|
uint64_t offset{0};
|
||||||
keygen_case keycase;
|
keygen_case keycase{kc_random};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct actor_params_pod {
|
struct actor_params_pod {
|
||||||
unsigned mode_flags;
|
unsigned mode_flags{0};
|
||||||
unsigned table_flags;
|
unsigned table_flags{0};
|
||||||
intptr_t size_lower;
|
intptr_t size_lower{0};
|
||||||
intptr_t size_now;
|
intptr_t size_now{0};
|
||||||
intptr_t size_upper;
|
intptr_t size_upper{0};
|
||||||
int shrink_threshold;
|
int shrink_threshold{0};
|
||||||
int growth_step;
|
int growth_step{0};
|
||||||
int pagesize;
|
int pagesize{0};
|
||||||
|
|
||||||
unsigned test_duration;
|
unsigned test_duration{0};
|
||||||
unsigned test_nops;
|
unsigned test_nops{0};
|
||||||
unsigned nrepeat;
|
unsigned nrepeat{0};
|
||||||
unsigned nthreads;
|
unsigned nthreads{0};
|
||||||
|
|
||||||
unsigned keylen_min, keylen_max;
|
unsigned keylen_min{0}, keylen_max{0};
|
||||||
unsigned datalen_min, datalen_max;
|
unsigned datalen_min{0}, datalen_max{0};
|
||||||
|
|
||||||
unsigned batch_read;
|
unsigned batch_read{0};
|
||||||
unsigned batch_write;
|
unsigned batch_write{0};
|
||||||
|
|
||||||
unsigned delaystart;
|
unsigned delaystart{0};
|
||||||
unsigned waitfor_nops;
|
unsigned waitfor_nops{0};
|
||||||
unsigned inject_writefaultn;
|
unsigned inject_writefaultn{0};
|
||||||
|
|
||||||
unsigned max_readers;
|
unsigned max_readers{0};
|
||||||
unsigned max_tables;
|
unsigned max_tables{0};
|
||||||
keygen_params_pod keygen;
|
keygen_params_pod keygen;
|
||||||
|
|
||||||
uint8_t loglevel;
|
uint8_t loglevel{0};
|
||||||
bool drop_table;
|
bool drop_table{0};
|
||||||
bool ignore_dbfull;
|
bool ignore_dbfull{0};
|
||||||
bool speculum;
|
bool speculum{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct actor_config_pod {
|
struct actor_config_pod {
|
||||||
unsigned actor_id, space_id;
|
unsigned actor_id{0}, space_id{0};
|
||||||
actor_testcase testcase;
|
actor_testcase testcase{ac_none};
|
||||||
unsigned wait4id;
|
unsigned wait4id{0};
|
||||||
unsigned signal_nops;
|
unsigned signal_nops{0};
|
||||||
|
|
||||||
|
actor_config_pod() = default;
|
||||||
|
actor_config_pod(unsigned actor_id, actor_testcase testcase,
|
||||||
|
unsigned space_id, unsigned wait4id)
|
||||||
|
: actor_id(actor_id), space_id(space_id), testcase(testcase),
|
||||||
|
wait4id(wait4id) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
@ -286,8 +292,9 @@ void dump(const char *title = "config-dump: ");
|
|||||||
struct actor_params : public config::actor_params_pod {
|
struct actor_params : public config::actor_params_pod {
|
||||||
std::string pathname_log;
|
std::string pathname_log;
|
||||||
std::string pathname_db;
|
std::string pathname_db;
|
||||||
void set_defaults(const std::string &tmpdir);
|
actor_params() = default;
|
||||||
|
|
||||||
|
void set_defaults(const std::string &tmpdir);
|
||||||
unsigned mdbx_keylen_min() const;
|
unsigned mdbx_keylen_min() const;
|
||||||
unsigned mdbx_keylen_max() const;
|
unsigned mdbx_keylen_max() const;
|
||||||
unsigned mdbx_datalen_min() const;
|
unsigned mdbx_datalen_min() const;
|
||||||
@ -299,10 +306,11 @@ struct actor_config : public config::actor_config_pod {
|
|||||||
|
|
||||||
bool wanna_event4signalling() const { return true /* TODO ? */; }
|
bool wanna_event4signalling() const { return true /* TODO ? */; }
|
||||||
|
|
||||||
|
actor_config() = default;
|
||||||
actor_config(actor_testcase testcase, const actor_params ¶ms,
|
actor_config(actor_testcase testcase, const actor_params ¶ms,
|
||||||
unsigned space_id, unsigned wait4id);
|
unsigned space_id, unsigned wait4id);
|
||||||
|
|
||||||
actor_config(const char *str) {
|
actor_config(const char *str) : actor_config() {
|
||||||
if (!deserialize(str, *this))
|
if (!deserialize(str, *this))
|
||||||
failure("Invalid internal parameter '%s'\n", str);
|
failure("Invalid internal parameter '%s'\n", str);
|
||||||
}
|
}
|
||||||
|
@ -103,13 +103,13 @@ buffer alloc(size_t limit);
|
|||||||
|
|
||||||
class maker {
|
class maker {
|
||||||
config::keygen_params_pod mapping;
|
config::keygen_params_pod mapping;
|
||||||
serial_t base;
|
serial_t base{0};
|
||||||
serial_t salt;
|
serial_t salt{0};
|
||||||
|
|
||||||
struct essentials {
|
struct essentials {
|
||||||
uint16_t minlen;
|
uint16_t minlen{0};
|
||||||
uint16_t flags;
|
uint16_t flags{0};
|
||||||
uint32_t maxlen;
|
uint32_t maxlen{0};
|
||||||
} key_essentials, value_essentials;
|
} key_essentials, value_essentials;
|
||||||
|
|
||||||
static void mk_begin(const serial_t serial, const essentials ¶ms,
|
static void mk_begin(const serial_t serial, const essentials ¶ms,
|
||||||
@ -122,8 +122,6 @@ class maker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
maker() { memset(this, 0, sizeof(*this)); }
|
|
||||||
|
|
||||||
void pair(serial_t serial, const buffer &key, buffer &value,
|
void pair(serial_t serial, const buffer &key, buffer &value,
|
||||||
serial_t value_age, const bool keylen_changeable);
|
serial_t value_age, const bool keylen_changeable);
|
||||||
void setup(const config::actor_params_pod &actor, unsigned actor_id,
|
void setup(const config::actor_params_pod &actor, unsigned actor_id,
|
||||||
|
@ -243,9 +243,9 @@ static __inline void cpu_relax() {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct simple_checksum {
|
struct simple_checksum {
|
||||||
uint64_t value;
|
uint64_t value{0};
|
||||||
|
|
||||||
simple_checksum() : value(0) {}
|
simple_checksum() = default;
|
||||||
|
|
||||||
void push(const uint32_t &data) {
|
void push(const uint32_t &data) {
|
||||||
value += data * UINT64_C(9386433910765580089) + 1;
|
value += data * UINT64_C(9386433910765580089) + 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user