Skip to content

Commit 3873692

Browse files
committed
Fix -std=c++98 -Wzero-length-array
This is another follow-up fix to commit b393e2c 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]).
1 parent 1e1b53c commit 3873692

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19388,7 +19388,7 @@ innobase_debug_sync_callback(srv_slot_t *slot, const void *value)
1938819388
// One allocatoin for list node object and value.
1938919389
void *buf = ut_malloc_nokey(sizeof(srv_slot_t::debug_sync_t) + len);
1939019390
srv_slot_t::debug_sync_t *sync = new(buf) srv_slot_t::debug_sync_t();
19391-
strcpy(sync->str, value_str);
19391+
strcpy(reinterpret_cast<char*>(&sync[1]), value_str);
1939219392

1939319393
rw_lock_x_lock(&slot->debug_sync_lock);
1939419394
UT_LIST_ADD_LAST(slot->debug_sync, sync);

storage/innobase/include/srv0srv.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ extern ulong srv_fatal_semaphore_wait_threshold;
615615
/** Buffer pool dump status frequence in percentages */
616616
extern ulong srv_buf_dump_status_frequency;
617617

618-
constexpr uint srv_max_purge_threads = 32;
618+
#define srv_max_purge_threads 32
619619

620620
# ifdef UNIV_PFS_THREAD
621621
/* Keys to register InnoDB threads with performance schema */
@@ -1132,12 +1132,9 @@ struct srv_slot_t{
11321132
(only used for user threads) */
11331133
#ifdef UNIV_DEBUG
11341134
struct debug_sync_t {
1135-
UT_LIST_NODE_T(debug_sync_t)
1136-
debug_sync_list;
1137-
char str[0];
1135+
UT_LIST_NODE_T(debug_sync_t) debug_sync_list;
11381136
};
1139-
UT_LIST_BASE_NODE_T(debug_sync_t)
1140-
debug_sync;
1137+
UT_LIST_BASE_NODE_T(debug_sync_t) debug_sync;
11411138
rw_lock_t debug_sync_lock;
11421139
#endif
11431140
};

storage/innobase/row/row0purge.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,9 +1218,10 @@ row_purge_step(
12181218
while (UT_LIST_GET_LEN(slot->debug_sync)) {
12191219
srv_slot_t::debug_sync_t *sync =
12201220
UT_LIST_GET_FIRST(slot->debug_sync);
1221+
const char* sync_str = reinterpret_cast<char*>(&sync[1]);
12211222
bool result = debug_sync_set_action(current_thd,
1222-
sync->str,
1223-
strlen(sync->str));
1223+
sync_str,
1224+
strlen(sync_str));
12241225
ut_a(!result);
12251226

12261227
UT_LIST_REMOVE(slot->debug_sync, sync);

storage/innobase/srv/srv0srv.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,14 @@ char srv_buffer_pool_dump_at_shutdown = TRUE;
663663
char srv_buffer_pool_load_at_startup = TRUE;
664664

665665
/** Slot index in the srv_sys.sys_threads array for the master thread. */
666-
constexpr ulint SRV_MASTER_SLOT = 0;
666+
#define SRV_MASTER_SLOT 0
667667

668668
/** Slot index in the srv_sys.sys_threads array for the purge thread. */
669-
constexpr ulint SRV_PURGE_SLOT = 1;
669+
#define SRV_PURGE_SLOT 1
670670

671671
/** Slot index in the srv_sys.sys_threads array from which purge workers start.
672672
*/
673-
constexpr ulint SRV_WORKER_SLOTS_START = 2;
673+
#define SRV_WORKER_SLOTS_START 2
674674

675675
#ifdef HAVE_PSI_STAGE_INTERFACE
676676
/** Performance schema stage event for monitoring ALTER TABLE progress

0 commit comments

Comments
 (0)