Commit 55958d6d authored by Davi Arnaut's avatar Davi Arnaut

Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations.

Silence bogus aliasing warning through a pointer indirection. Also,
no need to check the return of a placement new.
parent 8fcaea9a
...@@ -99,22 +99,34 @@ int delegates_init() ...@@ -99,22 +99,34 @@ int delegates_init()
MY_ALIGNOF(long)> relay_io_mem; MY_ALIGNOF(long)> relay_io_mem;
#endif #endif
if (!(transaction_delegate= new (trans_mem.data) Trans_delegate) void *place_trans_mem= trans_mem.data;
|| (!transaction_delegate->is_inited()) void *place_storage_mem= storage_mem.data;
|| !(binlog_storage_delegate=
new (storage_mem.data) Binlog_storage_delegate) transaction_delegate= new (place_trans_mem) Trans_delegate;
|| (!binlog_storage_delegate->is_inited())
if (!transaction_delegate->is_inited())
return 1;
binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate;
if (!binlog_storage_delegate->is_inited())
return 1;
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
|| !(binlog_transmit_delegate= void *place_transmit_mem= transmit_mem.data;
new (transmit_mem.data) Binlog_transmit_delegate) void *place_relay_io_mem= relay_io_mem.data;
|| (!binlog_transmit_delegate->is_inited())
|| !(binlog_relay_io_delegate= binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate;
new (relay_io_mem.data) Binlog_relay_IO_delegate)
|| (!binlog_relay_io_delegate->is_inited()) if (!binlog_transmit_delegate->is_inited())
#endif /* HAVE_REPLICATION */
)
return 1; return 1;
binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate;
if (!binlog_relay_io_delegate->is_inited())
return 1;
#endif
if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL)) if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL))
return 1; return 1;
return 0; return 0;
......
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