Fix build failures on CentOS 6

The older C++ compiler doesn't support struct initialization with explicit
values. In addition to this, fixed a few other warnings that caused
errors.
This commit is contained in:
Markus Mäkelä 2017-05-05 19:28:44 +03:00
parent 6c4a4a3ee0
commit 5dc49a59be
3 changed files with 11 additions and 8 deletions

View File

@ -94,7 +94,7 @@ void atomic_store_int32(int *variable, int value)
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
(void)__sync_lock_test_and_set(variable, value);
#endif
}
@ -103,7 +103,7 @@ void atomic_store_int64(int64_t *variable, int64_t value)
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
(void)__sync_lock_test_and_set(variable, value);
#endif
}
@ -112,7 +112,7 @@ void atomic_store_uint64(uint64_t *variable, uint64_t value)
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
(void)__sync_lock_test_and_set(variable, value);
#endif
}
@ -121,6 +121,6 @@ void atomic_store_ptr(void **variable, void *value)
#ifdef MXS_USE_ATOMIC_BUILTINS
__atomic_store_n(variable, value, __ATOMIC_SEQ_CST);
#else
__sync_lock_test_and_set(variable, value);
(void)__sync_lock_test_and_set(variable, value);
#endif
}

View File

@ -25,7 +25,7 @@
namespace
{
struct
static struct
{
bool initialized;
int pipe_flags;

View File

@ -43,7 +43,8 @@ int test_validity()
{MXS_END_MODULE_PARAMS}
};
CONFIG_CONTEXT ctx = {.object = (char*)""};
CONFIG_CONTEXT ctx = {};
ctx.object = (char*)"";
/** Int parameter */
TEST(config_param_is_valid(params, "p1", "1", &ctx));
@ -90,7 +91,8 @@ int test_validity()
TEST(!config_param_is_valid(params, "p6", "This is not a valid path", &ctx));
/** Service parameter */
CONFIG_CONTEXT svc = {.object = (char*)"test-service"};
CONFIG_CONTEXT svc = {};
svc.object = (char*)"test-service";
ctx.next = &svc;
config_add_param(&svc, "type", "service");
TEST(config_param_is_valid(params, "p7", "test-service", &ctx));
@ -193,7 +195,8 @@ int test_required_parameters()
{MXS_END_MODULE_PARAMS}
};
CONFIG_CONTEXT ctx = {.object = (char*)""};
CONFIG_CONTEXT ctx = {};
ctx.object = (char*)"";
TEST(missing_required_parameters(params, ctx.parameters));
config_add_defaults(&ctx, params);