Commit 38736928 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix -std=c++98 -Wzero-length-array

This is another follow-up fix to
commit b393e2cb
which turned out to be still broken.

Replace the C++11 keyword 'constexpr' with #define.

debug_sync_t::str: Remove the zero-length array.
Replace sync->str with reinterpret_cast<char*>(&sync[1]).
parent 1e1b53cc
......@@ -19388,7 +19388,7 @@ innobase_debug_sync_callback(srv_slot_t *slot, const void *value)
// One allocatoin for list node object and value.
void *buf = ut_malloc_nokey(sizeof(srv_slot_t::debug_sync_t) + len);
srv_slot_t::debug_sync_t *sync = new(buf) srv_slot_t::debug_sync_t();
strcpy(sync->str, value_str);
strcpy(reinterpret_cast<char*>(&sync[1]), value_str);
rw_lock_x_lock(&slot->debug_sync_lock);
UT_LIST_ADD_LAST(slot->debug_sync, sync);
......
......@@ -615,7 +615,7 @@ extern ulong srv_fatal_semaphore_wait_threshold;
/** Buffer pool dump status frequence in percentages */
extern ulong srv_buf_dump_status_frequency;
constexpr uint srv_max_purge_threads = 32;
#define srv_max_purge_threads 32
# ifdef UNIV_PFS_THREAD
/* Keys to register InnoDB threads with performance schema */
......@@ -1132,12 +1132,9 @@ struct srv_slot_t{
(only used for user threads) */
#ifdef UNIV_DEBUG
struct debug_sync_t {
UT_LIST_NODE_T(debug_sync_t)
debug_sync_list;
char str[0];
UT_LIST_NODE_T(debug_sync_t) debug_sync_list;
};
UT_LIST_BASE_NODE_T(debug_sync_t)
debug_sync;
UT_LIST_BASE_NODE_T(debug_sync_t) debug_sync;
rw_lock_t debug_sync_lock;
#endif
};
......
......@@ -1218,9 +1218,10 @@ row_purge_step(
while (UT_LIST_GET_LEN(slot->debug_sync)) {
srv_slot_t::debug_sync_t *sync =
UT_LIST_GET_FIRST(slot->debug_sync);
const char* sync_str = reinterpret_cast<char*>(&sync[1]);
bool result = debug_sync_set_action(current_thd,
sync->str,
strlen(sync->str));
sync_str,
strlen(sync_str));
ut_a(!result);
UT_LIST_REMOVE(slot->debug_sync, sync);
......
......@@ -663,14 +663,14 @@ char srv_buffer_pool_dump_at_shutdown = TRUE;
char srv_buffer_pool_load_at_startup = TRUE;
/** Slot index in the srv_sys.sys_threads array for the master thread. */
constexpr ulint SRV_MASTER_SLOT = 0;
#define SRV_MASTER_SLOT 0
/** Slot index in the srv_sys.sys_threads array for the purge thread. */
constexpr ulint SRV_PURGE_SLOT = 1;
#define SRV_PURGE_SLOT 1
/** Slot index in the srv_sys.sys_threads array from which purge workers start.
*/
constexpr ulint SRV_WORKER_SLOTS_START = 2;
#define SRV_WORKER_SLOTS_START 2
#ifdef HAVE_PSI_STAGE_INTERFACE
/** Performance schema stage event for monitoring ALTER TABLE progress
......
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