Commit 34a104ba authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

MDEV-10229: TokuDB fails to build with CLang

Structure initialization must feature all members present within the
struct.
parent 1bf25092
...@@ -785,7 +785,7 @@ static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) { ...@@ -785,7 +785,7 @@ static int toku_recover_xcommit (struct logtype_xcommit *l, RECOVER_ENV renv) {
assert(txn!=NULL); assert(txn!=NULL);
// commit the transaction // commit the transaction
toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid }; toku_txn_progress_extra extra = { time(NULL), l->lsn, "commit", l->xid, 0 };
int r = toku_txn_commit_with_lsn(txn, true, l->lsn, toku_recover_txn_progress, &extra); int r = toku_txn_commit_with_lsn(txn, true, l->lsn, toku_recover_txn_progress, &extra);
assert(r == 0); assert(r == 0);
...@@ -828,7 +828,7 @@ static int toku_recover_xabort (struct logtype_xabort *l, RECOVER_ENV renv) { ...@@ -828,7 +828,7 @@ static int toku_recover_xabort (struct logtype_xabort *l, RECOVER_ENV renv) {
assert(txn!=NULL); assert(txn!=NULL);
// abort the transaction // abort the transaction
toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid }; toku_txn_progress_extra extra = { time(NULL), l->lsn, "abort", l->xid, 0 };
r = toku_txn_abort_with_lsn(txn, l->lsn, toku_recover_txn_progress, &extra); r = toku_txn_abort_with_lsn(txn, l->lsn, toku_recover_txn_progress, &extra);
assert(r == 0); assert(r == 0);
...@@ -1363,7 +1363,7 @@ static void recover_abort_live_txn(TOKUTXN txn) { ...@@ -1363,7 +1363,7 @@ static void recover_abort_live_txn(TOKUTXN txn) {
// sanity check that the recursive call successfully NULLs out txn->child // sanity check that the recursive call successfully NULLs out txn->child
invariant(txn->child == NULL); invariant(txn->child == NULL);
// abort the transaction // abort the transaction
toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid }; toku_txn_progress_extra extra = { time(NULL), ZERO_LSN, "abort live", txn->txnid, 0 };
int r = toku_txn_abort_txn(txn, toku_recover_txn_progress, &extra); int r = toku_txn_abort_txn(txn, toku_recover_txn_progress, &extra);
assert(r == 0); assert(r == 0);
......
...@@ -643,7 +643,7 @@ serialize_and_compress_in_parallel(FTNODE node, ...@@ -643,7 +643,7 @@ serialize_and_compress_in_parallel(FTNODE node,
struct serialize_compress_work work[npartitions]; struct serialize_compress_work work[npartitions];
workset_lock(&ws); workset_lock(&ws);
for (int i = 0; i < npartitions; i++) { for (int i = 0; i < npartitions; i++) {
work[i] = (struct serialize_compress_work) { .base = {{NULL}}, work[i] = (struct serialize_compress_work) { .base = {{NULL, NULL}},
.node = node, .node = node,
.i = i, .i = i,
.compression_method = compression_method, .compression_method = compression_method,
......
...@@ -333,14 +333,14 @@ static txn_child_manager tcm; ...@@ -333,14 +333,14 @@ static txn_child_manager tcm;
.do_fsync = false, .do_fsync = false,
.force_fsync_on_commit = false, .force_fsync_on_commit = false,
.do_fsync_lsn = ZERO_LSN, .do_fsync_lsn = ZERO_LSN,
.xa_xid = {0}, .xa_xid = {0, 0, 0, {}},
.progress_poll_fun = NULL, .progress_poll_fun = NULL,
.progress_poll_fun_extra = NULL, .progress_poll_fun_extra = NULL,
.txn_lock = ZERO_MUTEX_INITIALIZER, .txn_lock = TOKU_MUTEX_INITIALIZER,
.open_fts = open_fts, .open_fts = open_fts,
.roll_info = roll_info, .roll_info = roll_info,
.state_lock = ZERO_MUTEX_INITIALIZER, .state_lock = TOKU_MUTEX_INITIALIZER,
.state_cond = ZERO_COND_INITIALIZER, .state_cond = TOKU_COND_INITIALIZER,
.state = TOKUTXN_LIVE, .state = TOKUTXN_LIVE,
.num_pin = 0, .num_pin = 0,
.client_id = 0, .client_id = 0,
......
...@@ -125,16 +125,6 @@ typedef struct toku_mutex_aligned { ...@@ -125,16 +125,6 @@ typedef struct toku_mutex_aligned {
toku_mutex_t aligned_mutex __attribute__((__aligned__(64))); toku_mutex_t aligned_mutex __attribute__((__aligned__(64)));
} toku_mutex_aligned_t; } toku_mutex_aligned_t;
// Different OSes implement mutexes as different amounts of nested structs.
// C++ will fill out all missing values with zeroes if you provide at least one zero, but it needs the right amount of nesting.
#if defined(__FreeBSD__)
# define ZERO_MUTEX_INITIALIZER {0}
#elif defined(__APPLE__)
# define ZERO_MUTEX_INITIALIZER {{0}}
#else // __linux__, at least
# define ZERO_MUTEX_INITIALIZER {{{0}}}
#endif
#if TOKU_PTHREAD_DEBUG #if TOKU_PTHREAD_DEBUG
# define TOKU_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true } # define TOKU_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true }
#else #else
...@@ -276,15 +266,6 @@ typedef struct toku_cond { ...@@ -276,15 +266,6 @@ typedef struct toku_cond {
pthread_cond_t pcond; pthread_cond_t pcond;
} toku_cond_t; } toku_cond_t;
// Different OSes implement mutexes as different amounts of nested structs.
// C++ will fill out all missing values with zeroes if you provide at least one zero, but it needs the right amount of nesting.
#if defined(__FreeBSD__)
# define ZERO_COND_INITIALIZER {0}
#elif defined(__APPLE__)
# define ZERO_COND_INITIALIZER {{0}}
#else // __linux__, at least
# define ZERO_COND_INITIALIZER {{{0}}}
#endif
#define TOKU_COND_INITIALIZER {PTHREAD_COND_INITIALIZER} #define TOKU_COND_INITIALIZER {PTHREAD_COND_INITIALIZER}
static inline void static inline void
......
...@@ -1825,7 +1825,7 @@ static int run_workers( ...@@ -1825,7 +1825,7 @@ static int run_workers(
{ {
int r; int r;
const struct perf_formatter *perf_formatter = &perf_formatters[cli_args->perf_output_format]; const struct perf_formatter *perf_formatter = &perf_formatters[cli_args->perf_output_format];
toku_mutex_t mutex = ZERO_MUTEX_INITIALIZER; toku_mutex_t mutex = TOKU_MUTEX_INITIALIZER;
toku_mutex_init(&mutex, nullptr); toku_mutex_init(&mutex, nullptr);
struct rwlock rwlock; struct rwlock rwlock;
rwlock_init(&rwlock); rwlock_init(&rwlock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment