diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-11 21:26:16 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-11 21:26:16 +0300 |
commit | 38736928e7980519a5975670fe0f95afff9c667c (patch) | |
tree | f21b2c63167bde5987a899a535ba4875abc4affe /storage | |
parent | 1e1b53ccfd0a09dbb0fe7fb10831669617339f2d (diff) | |
download | mariadb-git-38736928e7980519a5975670fe0f95afff9c667c.tar.gz |
Fix -std=c++98 -Wzero-length-array
This is another follow-up fix to
commit b393e2cb0c079b30563dcc87a62002c9c778643c
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]).
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 9 | ||||
-rw-r--r-- | storage/innobase/row/row0purge.cc | 5 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 6 |
4 files changed, 10 insertions, 12 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a18b6215417..a556b5875df 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -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); diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index dbed637aa0d..c1dcb2273e6 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -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 }; diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 525f8e0c18e..42aa6123cd6 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -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); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 42e026df7e4..2c33496ca52 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -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 |