#At file:///home/msvensson/mysql/bug46113/6.2/ based on revid:frazer@strippedrg5b743sj1zft5
3021 Magnus Blåudd 2009-10-08
Bug#46113 ndbd fails to start when built with gcc-4.4.0 (e.g Fedora 11)
- Add macro for checking that type T does have a user defined constructor.
- Use macro in DLList.hpp, DLFifoList.hpp and DLHashTable.hpp
- Add empty constructors to the structs that are put in the above lists
(that the compiler now detects if using -std=c++0x)
modified:
storage/ndb/include/ndb_global.h.in
storage/ndb/src/kernel/blocks/backup/Backup.hpp
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp
storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
storage/ndb/src/kernel/blocks/suma/Suma.hpp
storage/ndb/src/kernel/blocks/trix/Trix.hpp
storage/ndb/src/kernel/vm/DLFifoList.hpp
storage/ndb/src/kernel/vm/DLHashTable.hpp
storage/ndb/src/kernel/vm/DLList.hpp
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
=== modified file 'storage/ndb/include/ndb_global.h.in'
--- a/storage/ndb/include/ndb_global.h.in 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/include/ndb_global.h.in 2009-10-08 09:55:36 +0000
@@ -151,4 +151,49 @@ extern "C" {
#define NDB_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
+/*
+ NDB_STATIC_ASSERT(expr)
+ - Check coding assumptions during compile time
+ by laying out code that will generate a compiler error
+ if the expression is false.
+*/
+
+#if (_MSC_VER > 1500) || (defined __GXX_EXPERIMENTAL_CXX0X__)
+
+/*
+ Prefer to use the 'static_assert' function from C++0x
+ to get best error message
+*/
+#define NDB_STATIC_ASSERT(expr) static_assert(expr, #expr)
+
+#else
+
+/*
+ Fallback to use home grown solution
+*/
+
+#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
+
+#endif
+
+
+#if (_MSC_VER > 1500) || (defined __GXX_EXPERIMENTAL_CXX0X__)
+#define HAVE_COMPILER_TYPE_TRAITS
+#endif
+
+#ifdef HAVE_COMPILER_TYPE_TRAITS
+#define ASSERT_TYPE_HAS_CONSTRUCTOR(x) \
+ NDB_STATIC_ASSERT(!__has_trivial_constructor(x))
+#else
+#define ASSERT_TYPE_HAS_CONSTRUCTOR(x)
+#endif
+
#endif
=== modified file 'storage/ndb/src/kernel/blocks/backup/Backup.hpp'
--- a/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/Backup.hpp 2009-10-08 09:55:36 +0000
@@ -175,6 +175,7 @@ public:
typedef Ptr<Page32> Page32Ptr;
struct Attribute {
+ Attribute() {}
enum Flags {
COL_NULLABLE = 0x1,
COL_FIXED = 0x2,
=== modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp'
--- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2009-08-21 09:35:23 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp 2009-10-08 09:55:36 +0000
@@ -2122,6 +2122,7 @@ private:
friend struct DictLockRecord;
struct DictLockRecord {
+ DictLockRecord() {}
DictLockReq req;
const DictLockType* lt;
bool locked;
=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2009-09-01 12:27:40 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp 2009-10-08 09:55:36 +0000
@@ -488,6 +488,8 @@ public:
/* WHEN THE INDEX IS DROPPED. */
/* **************************************** */
struct TcIndexData {
+ TcIndexData() {}
+
/**
* IndexState
*/
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2009-09-04 10:15:28 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2009-10-08 09:55:36 +0000
@@ -472,6 +472,7 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
// Scan Lock
struct ScanLock {
+ ScanLock() {}
Uint32 m_accLockOp;
union {
Uint32 nextPool;
@@ -568,6 +569,7 @@ typedef Ptr<Fragoperrec> FragoperrecPtr;
struct Page_request
{
+ Page_request() {}
Local_key m_key;
Uint32 m_frag_ptr_i;
Uint32 m_extent_info_ptr;
@@ -1307,6 +1309,7 @@ typedef Ptr<HostBuffer> HostBufferPtr;
* Build index operation record.
*/
struct BuildIndexRec {
+ BuildIndexRec() {}
// request cannot use signal class due to extra members
Uint32 m_request[BuildIndxReq::SignalLength];
Uint8 m_build_vs; // varsize pages
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp 2009-10-08 09:55:36 +0000
@@ -24,6 +24,7 @@
struct Tup_page
{
+ Tup_page() {}
struct File_formats::Page_header m_page_header;
Uint32 m_restart_seq;
Uint32 page_state;
=== modified file 'storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp 2009-06-01 08:52:20 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp 2009-10-08 09:55:36 +0000
@@ -356,6 +356,7 @@ private:
// ScanLock
struct ScanLock {
+ ScanLock() {}
Uint32 m_accLockOp;
union {
Uint32 nextPool;
=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp 2009-10-08 09:55:36 +0000
@@ -425,6 +425,7 @@ public:
* Lock manager
*/
struct LockQueueElement {
+ LockQueueElement() {}
Uint32 m_senderData;
Uint32 m_senderRef;
union {
=== modified file 'storage/ndb/src/kernel/blocks/suma/Suma.hpp'
--- a/storage/ndb/src/kernel/blocks/suma/Suma.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/suma/Suma.hpp 2009-10-08 09:55:36 +0000
@@ -135,6 +135,7 @@ public:
};
struct Subscriber {
+ Subscriber() {}
Uint32 m_senderRef;
Uint32 m_senderData;
Uint32 nextList;
@@ -197,6 +198,8 @@ public:
struct SubOpRecord
{
+ SubOpRecord() {}
+
enum OpType
{
R_SUB_START_REQ,
=== modified file 'storage/ndb/src/kernel/blocks/trix/Trix.hpp'
--- a/storage/ndb/src/kernel/blocks/trix/Trix.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/blocks/trix/Trix.hpp 2009-10-08 09:55:36 +0000
@@ -71,6 +71,7 @@ private:
// Node data needed when communicating with remote TRIX:es
struct NodeRecord {
+ NodeRecord() {}
bool alive;
BlockReference trixRef;
union {
=== modified file 'storage/ndb/src/kernel/vm/DLFifoList.hpp'
--- a/storage/ndb/src/kernel/vm/DLFifoList.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/DLFifoList.hpp 2009-10-08 09:55:36 +0000
@@ -177,11 +177,16 @@ template <typename P, typename T, typena
inline
DLFifoListImpl<P,T,U>::Head::Head()
{
+ // Require user defined constructor on T since we fiddle
+ // with T's members
+ ASSERT_TYPE_HAS_CONSTRUCTOR(T);
+
firstItem = RNIL;
lastItem = RNIL;
#ifdef VM_TRACE
in_use = false;
#endif
+
}
template <typename P, typename T, typename U>
=== modified file 'storage/ndb/src/kernel/vm/DLHashTable.hpp'
--- a/storage/ndb/src/kernel/vm/DLHashTable.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/DLHashTable.hpp 2009-10-08 09:55:36 +0000
@@ -158,6 +158,10 @@ inline
DLHashTableImpl<P, T, U>::DLHashTableImpl(P & _pool)
: thePool(_pool)
{
+ // Require user defined constructor on T since we fiddle
+ // with T's members
+ ASSERT_TYPE_HAS_CONSTRUCTOR(T);
+
mask = 0;
hashValues = 0;
}
=== modified file 'storage/ndb/src/kernel/vm/DLList.hpp'
--- a/storage/ndb/src/kernel/vm/DLList.hpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/src/kernel/vm/DLList.hpp 2009-10-08 09:55:36 +0000
@@ -183,6 +183,9 @@ inline
DLListImpl<P,T,U>::DLListImpl(P & _pool)
: thePool(_pool)
{
+ // Require user defined constructor on T since we fiddle
+ // with T's members
+ ASSERT_TYPE_HAS_CONSTRUCTOR(T);
}
template <typename P, typename T, typename U>
=== modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp'
--- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2009-09-25 11:07:16 +0000
+++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2009-10-08 09:55:36 +0000
@@ -484,6 +484,7 @@ public:
* core interface
*/
struct ActiveMutex {
+ ActiveMutex() {}
Uint32 m_gsn; // state
Uint32 m_mutexId;
Uint32 m_mutexKey;
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20091008095536-4vhhwp4m5alb3j0m.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.2 branch (magnus.blaudd:3021)Bug#46113 | Magnus Blåudd | 8 Oct |