List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:July 15 2010 7:29pm
Subject:bzr commit into mysql-trunk-merge branch (davi:3124) Bug#42733
View as plain text  
# At a local mysql-trunk-merge repository of davi

 3124 Davi Arnaut	2010-07-15
      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.

    modified:
      sql/rpl_handler.cc
=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc	2010-07-15 13:47:50 +0000
+++ b/sql/rpl_handler.cc	2010-07-15 19:29:25 +0000
@@ -99,21 +99,33 @@ int delegates_init()
                             MY_ALIGNOF(long)> relay_io_mem;
 #endif
 
-  if (!(transaction_delegate= new (trans_mem.data) Trans_delegate)
-      || (!transaction_delegate->is_inited())
-      || !(binlog_storage_delegate=
-           new (storage_mem.data) Binlog_storage_delegate)
-      || (!binlog_storage_delegate->is_inited())
+  void *place_trans_mem= trans_mem.data;
+  void *place_storage_mem= storage_mem.data;
+
+  transaction_delegate= new (place_trans_mem) Trans_delegate;
+
+  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
-      || !(binlog_transmit_delegate=
-           new (transmit_mem.data) Binlog_transmit_delegate)
-      || (!binlog_transmit_delegate->is_inited())
-      || !(binlog_relay_io_delegate=
-           new (relay_io_mem.data) Binlog_relay_IO_delegate)
-      || (!binlog_relay_io_delegate->is_inited())
-#endif /* HAVE_REPLICATION */
-      )
+  void *place_transmit_mem= transmit_mem.data;
+  void *place_relay_io_mem= relay_io_mem.data;
+
+  binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate;
+
+  if (!binlog_transmit_delegate->is_inited())
+    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))
     return 1;


Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20100715192925-u34pclaispq66jld.bundle
Thread
bzr commit into mysql-trunk-merge branch (davi:3124) Bug#42733Davi Arnaut15 Jul