mdbx: support for building by GCC 4.8

Change-Id: I4ad5c5be60233ae68936e0cbca1a0f01ec786bad
This commit is contained in:
Leonid Yuriev
2020-09-13 19:50:53 +03:00
parent 1bc49f680d
commit 17d9ed31f9
6 changed files with 28 additions and 8 deletions

View File

@@ -475,14 +475,24 @@ const std::string actor_config::serialize(const char *prefix) const {
result.append(params.pathname_log);
result.push_back('|');
#if __cplusplus > 201400
static_assert(std::is_trivially_copyable<actor_params_pod>::value,
"actor_params_pod should by POD");
#else
static_assert(std::is_standard_layout<actor_params_pod>::value,
"actor_params_pod should by POD");
#endif
result.append(data2hex(static_cast<const actor_params_pod *>(&params),
sizeof(actor_params_pod), checksum));
result.push_back('|');
#if __cplusplus > 201400
static_assert(std::is_trivially_copyable<actor_config_pod>::value,
"actor_config_pod should by POD");
#else
static_assert(std::is_standard_layout<actor_config_pod>::value,
"actor_config_pod should by POD");
#endif
result.append(data2hex(static_cast<const actor_config_pod *>(this),
sizeof(actor_config_pod), checksum));
result.push_back('|');
@@ -527,8 +537,13 @@ bool actor_config::deserialize(const char *str, actor_config &config) {
TRACE("<< actor_config::deserialize: slash-3\n");
return false;
}
#if __cplusplus > 201400
static_assert(std::is_trivially_copyable<actor_params_pod>::value,
"actor_params_pod should by POD");
#else
static_assert(std::is_standard_layout<actor_params_pod>::value,
"actor_params_pod should by POD");
#endif
if (!hex2data(str, slash, static_cast<actor_params_pod *>(&config.params),
sizeof(actor_params_pod), checksum)) {
TRACE("<< actor_config::deserialize: actor_params_pod(%.*s)\n",
@@ -542,8 +557,13 @@ bool actor_config::deserialize(const char *str, actor_config &config) {
TRACE("<< actor_config::deserialize: slash-4\n");
return false;
}
#if __cplusplus > 201400
static_assert(std::is_trivially_copyable<actor_config_pod>::value,
"actor_config_pod should by POD");
#else
static_assert(std::is_standard_layout<actor_config_pod>::value,
"actor_config_pod should by POD");
#endif
if (!hex2data(str, slash, static_cast<actor_config_pod *>(&config),
sizeof(actor_config_pod), checksum)) {
TRACE("<< actor_config::deserialize: actor_config_pod(%.*s)\n",

View File

@@ -198,7 +198,7 @@ void __hot maker::pair(serial_t serial, const buffer &key, buffer &value,
void maker::setup(const config::actor_params_pod &actor, unsigned actor_id,
unsigned thread_number) {
#if !defined(_MSC_VER) || _MSC_VER > 1900
#if defined(__cpp_constexpr)
static_assert(unsigned(MDBX_INTEGERKEY | MDBX_REVERSEKEY | MDBX_DUPSORT |
MDBX_INTEGERDUP | MDBX_REVERSEDUP) < UINT16_MAX,
"WTF?");
@@ -317,7 +317,7 @@ void __hot maker::mk_begin(const serial_t serial, const essentials &params,
void __hot maker::mk_continue(const serial_t serial, const essentials &params,
result &out) {
#if !defined(_MSC_VER) || _MSC_VER > 1900
#if defined(__cpp_constexpr)
static_assert(
(essentials::prng_fill_flag &
unsigned(MDBX_DUPSORT | MDBX_DUPFIXED | MDBX_INTEGERKEY |