List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:August 27 2010 12:35pm
Subject:bzr commit into mysql-5.1-telco-6.3 branch (jonas:3267)
View as plain text  
#At file:///home/jonas/src/telco-6.3/ based on revid:jonas@stripped

 3267 Jonas Oreland	2010-08-27
      ndb - use configure to check for __is_pod and similar (instead of #defines), fix problems found

    modified:
      config/ac-macros/ha_ndbcluster.m4
      storage/ndb/include/kernel/AttributeList.hpp
      storage/ndb/include/kernel/signaldata/BackupSignalData.hpp
      storage/ndb/include/kernel/signaldata/CreateEvnt.hpp
      storage/ndb/include/ndb_global.h.in
      storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
      storage/ndb/src/mgmsrv/MgmtSrvr.cpp
      storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
=== modified file 'config/ac-macros/ha_ndbcluster.m4'
--- a/config/ac-macros/ha_ndbcluster.m4	2009-10-09 13:09:38 +0000
+++ b/config/ac-macros/ha_ndbcluster.m4	2010-08-27 12:35:32 +0000
@@ -85,6 +85,27 @@ then
 fi
 ])
 
+AC_DEFUN([NDB_COMPILER_FEATURES],
+[
+  AC_LANG_PUSH([C++])
+  AC_MSG_CHECKING([checking __is_pod(typename)])
+  AC_TRY_COMPILE([struct A{};],[ int a = __is_pod(A)],
+    [ AC_MSG_RESULT([yes])
+      AC_DEFINE([HAVE___IS_POD], [1],
+              [Compiler supports __is_pod(typename)])],
+    AC_MSG_RESULT([no])
+  )
+
+  AC_MSG_CHECKING([checking __has_trivial_constructor(typename)])
+  AC_TRY_COMPILE([struct A{};], [ int a = __has_trivial_constructor(A)],
+    [ AC_MSG_RESULT([yes])
+      AC_DEFINE([HAVE___HAS_TRIVIAL_CONSTRUCTOR], [1],
+              [Compiler supports __has_trivial_constructor(typename)])],
+    AC_MSG_RESULT([no])
+  )
+  AC_LANG_POP([C++])
+])
+
 AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
   AC_ARG_WITH([ndb-sci],
               AC_HELP_STRING([--with-ndb-sci=DIR],
@@ -300,6 +321,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
 
   MYSQL_CHECK_NDB_OPTIONS
   NDBCLUSTER_WORKAROUNDS
+  NDB_COMPILER_FEATURES
 
   MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster"
 

=== modified file 'storage/ndb/include/kernel/AttributeList.hpp'
--- a/storage/ndb/include/kernel/AttributeList.hpp	2009-05-26 18:53:34 +0000
+++ b/storage/ndb/include/kernel/AttributeList.hpp	2010-08-27 12:35:32 +0000
@@ -27,6 +27,7 @@
  */
 
 typedef Bitmask<MAXNROFATTRIBUTESINWORDS> AttributeMask;
+typedef BitmaskPOD<MAXNROFATTRIBUTESINWORDS> AttributeMaskPOD;
 
 template <Uint32 SZ>
 struct Id_array

=== modified file 'storage/ndb/include/kernel/signaldata/BackupSignalData.hpp'
--- a/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp	2009-05-27 12:11:46 +0000
+++ b/storage/ndb/include/kernel/signaldata/BackupSignalData.hpp	2010-08-27 12:35:32 +0000
@@ -161,7 +161,7 @@ public:
 private:
   Uint32 senderData;
   Uint32 backupId;
-  NdbNodeBitmask nodes;
+  NdbNodeBitmaskPOD nodes;
 };
 
 /**
@@ -214,7 +214,7 @@ private:
   Uint32 noOfRecordsLow;
   Uint32 noOfLogBytes;
   Uint32 noOfLogRecords;
-  NdbNodeBitmask nodes;
+  NdbNodeBitmaskPOD nodes;
   Uint32 noOfBytesHigh;
   Uint32 noOfRecordsHigh;
 };

=== modified file 'storage/ndb/include/kernel/signaldata/CreateEvnt.hpp'
--- a/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp	2010-05-27 08:51:31 +0000
+++ b/storage/ndb/include/kernel/signaldata/CreateEvnt.hpp	2010-08-27 12:35:32 +0000
@@ -322,7 +322,7 @@ public:
   Uint32 m_requestInfo;
   Uint32 m_tableId;
   Uint32 m_tableVersion;        // table version
-  AttributeMask m_attrListBitmask;
+  AttributeMaskPOD m_attrListBitmask;
   Uint32 m_eventType;
   Uint32 m_eventId;
   Uint32 m_eventKey;
@@ -357,7 +357,7 @@ public:
   void setTableVersion(Uint32 val) {
     m_tableVersion = val;
   }
-  AttributeMask getAttrListBitmask() const {
+  AttributeMaskPOD getAttrListBitmask() const {
     return m_attrListBitmask;
   }
   void setAttrListBitmask(const AttributeMask & val) {

=== modified file 'storage/ndb/include/ndb_global.h.in'
--- a/storage/ndb/include/ndb_global.h.in	2010-08-20 10:18:47 +0000
+++ b/storage/ndb/include/ndb_global.h.in	2010-08-27 12:35:32 +0000
@@ -175,25 +175,20 @@ extern "C" {
 
 /*
   Fallback to use home grown solution
+  (i.e use mysys version)
 */
 
-#define STR_CONCAT_(x, y) x##y
-#define STR_CONCAT(x, y) STR_CONCAT_(x, y)
-
-#define NDB_STATIC_ASSERT(expr) \
-  enum {STR_CONCAT(static_assert_, __LINE__) = 1 / (!!(expr)) }
-
-#undef STR_CONCAT_
-#undef STR_CONCAT
+#define NDB_STATIC_ASSERT(expr) compile_time_assert(expr)
 
 #endif
 
 
-#if (_MSC_VER > 1500) || (defined __GXX_EXPERIMENTAL_CXX0X__)
-#define HAVE_COMPILER_TYPE_TRAITS
+#if (_MSC_VER > 1500)
+#define HAVE___HAS_TRIVIAL_CONSTRUCTOR
+#define HAVE___IS_POD
 #endif
 
-#ifdef HAVE_COMPILER_TYPE_TRAITS
+#ifdef HAVE___HAS_TRIVIAL_CONSTRUCTOR
 #define ASSERT_TYPE_HAS_CONSTRUCTOR(x)     \
   NDB_STATIC_ASSERT(!__has_trivial_constructor(x))
 #else
@@ -204,13 +199,12 @@ extern "C" {
 /**
  * visual studio is stricter than gcc for __is_pod, settle for __has_trivial_constructor
  *  until we really really made all signal data classes POD
+ *
+ * UPDATE: also gcc fails to compile our code with gcc4.4.3
  */
-#if (_MSC_VER > 1500)
+#ifdef HAVE___HAS_TRIVIAL_CONSTRUCTOR
 #define NDB_ASSERT_POD(x) \
   NDB_STATIC_ASSERT(__has_trivial_constructor(x))
-#elif defined __GXX_EXPERIMENTAL_CXX0X__
-#define NDB_ASSERT_POD(x) \
-  NDB_STATIC_ASSERT(__is_pod(x))
 #else
 #define NDB_ASSERT_POD(x)
 #endif

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2010-03-25 14:30:29 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2010-08-27 12:35:32 +0000
@@ -1385,6 +1385,8 @@ public:
    *              configurable.                                               
    */
   struct LogFileRecord {
+    LogFileRecord() {}
+
     enum FileChangeState {
       NOT_ONGOING = 0,
       BOTH_WRITES_ONGOING = 1,
@@ -2976,6 +2978,7 @@ private:
    */
   struct RedoCacheLogPageRecord
   {
+    RedoCacheLogPageRecord() {}
     /**
      * NOTE: These numbers must match page-header definition
      */

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2010-06-10 07:00:44 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2010-08-27 12:35:32 +0000
@@ -2748,7 +2748,7 @@ MgmtSrvr::startBackup(Uint32& backupId, 
 	CAST_CONSTPTR(BackupConf, signal->getDataPtr());
       event.Event = BackupEvent::BackupStarted;
       event.Started.BackupId = conf->backupId;
-      event.Nodes = conf->nodes;
+      event.Nodes.assign(conf->nodes);
 #ifdef VM_TRACE
       ndbout_c("Backup(%d) master is %d", conf->backupId,
 	       refToNode(signal->header.theSendersBlockRef));
@@ -2774,7 +2774,7 @@ MgmtSrvr::startBackup(Uint32& backupId, 
       event.Completed.NoOfLogRecords = rep->noOfLogRecords;
       event.Completed.stopGCP = rep->stopGCP;
       event.Completed.startGCP = rep->startGCP;
-      event.Nodes = rep->nodes;
+      event.Nodes.assign(rep->nodes);
 
       if (signal->header.theLength >= BackupCompleteRep::SignalLength)
       {

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2010-07-26 11:10:10 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2010-08-27 12:35:32 +0000
@@ -4356,7 +4356,7 @@ NdbDictInterface::createEvent(class Ndb 
   evnt.m_table_version = evntConf->getTableVersion();
 
   if (getFlag) {
-    evnt.m_attrListBitmask = evntConf->getAttrListBitmask();
+    evnt.m_attrListBitmask.assign(evntConf->getAttrListBitmask());
     evnt.mi_type           = evntConf->getEventType();
     evnt.setTable(dataPtr);
   } else {


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20100827123532-4qcysbbn15jn32fh.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (jonas:3267) Jonas Oreland27 Aug