summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-07 23:54:16 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-07 23:54:16 (GMT)
commit0766bf2fa4a89e629bbdad185e4919fd49c033a1 (patch)
tree623aa822f43c0a7cef6495cb5780af8b648178ed /src/corelib/global
parent238833271bf1792c0906b632b165bedf106b5f92 (diff)
parent55dbdc58122da56d9a2b869164f980dde3f91fb3 (diff)
downloadQt-0766bf2fa4a89e629bbdad185e4919fd49c033a1.zip
Qt-0766bf2fa4a89e629bbdad185e4919fd49c033a1.tar.gz
Qt-0766bf2fa4a89e629bbdad185e4919fd49c033a1.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging: Fix a typo in an EXPECT_FAIL dataset name. Fix a test naming issue. Improve Q_GLOBAL_STATIC macors. Tests build fix. Refactor qscriptjstestsuite to make it more maintainable Refactor qscriptv8testsuite to make it more maintainable
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.h124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 1879537..9c03dc3 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1828,32 +1828,32 @@ public:
inline ~QGlobalStatic() { pointer = 0; }
};
-#define Q_GLOBAL_STATIC(TYPE, NAME) \
- static TYPE *NAME() \
- { \
- static TYPE this_##NAME; \
- static QGlobalStatic<TYPE > global_##NAME(&this_##NAME); \
- return global_##NAME.pointer; \
+#define Q_GLOBAL_STATIC(TYPE, NAME) \
+ static TYPE *NAME() \
+ { \
+ static TYPE thisVariable; \
+ static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \
+ return thisGlobalStatic.pointer; \
}
-#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
- static TYPE *NAME() \
- { \
- static TYPE this_##NAME ARGS; \
- static QGlobalStatic<TYPE > global_##NAME(&this_##NAME); \
- return global_##NAME.pointer; \
+#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
+ static TYPE *NAME() \
+ { \
+ static TYPE thisVariable ARGS; \
+ static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \
+ return thisGlobalStatic.pointer; \
}
-#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \
- static TYPE *NAME() \
- { \
- static TYPE this_##NAME; \
- static QGlobalStatic<TYPE > global_##NAME(0); \
- if (!global_##NAME.pointer) { \
- TYPE *x = global_##NAME.pointer = &this_##NAME; \
- INITIALIZER; \
- } \
- return global_##NAME.pointer; \
+#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \
+ static TYPE *NAME() \
+ { \
+ static TYPE thisVariable; \
+ static QGlobalStatic<TYPE > thisGlobalStatic(0); \
+ if (!thisGlobalStatic.pointer) { \
+ TYPE *x = thisGlobalStatic.pointer = &thisVariable; \
+ INITIALIZER; \
+ } \
+ return thisGlobalStatic.pointer; \
}
#else
@@ -1888,50 +1888,50 @@ public:
}
};
-#define Q_GLOBAL_STATIC_INIT(TYPE, NAME) \
- static QGlobalStatic<TYPE > this_##NAME = { Q_BASIC_ATOMIC_INITIALIZER(0), false }
-
-#define Q_GLOBAL_STATIC(TYPE, NAME) \
- Q_GLOBAL_STATIC_INIT(TYPE, NAME); \
- static TYPE *NAME() \
- { \
- if (!this_##NAME.pointer && !this_##NAME.destroyed) { \
- TYPE *x = new TYPE; \
- if (!this_##NAME.pointer.testAndSetOrdered(0, x)) \
- delete x; \
- else \
- static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \
- } \
- return this_##NAME.pointer; \
+#define Q_GLOBAL_STATIC(TYPE, NAME) \
+ static TYPE *NAME() \
+ { \
+ static QGlobalStatic<TYPE > thisGlobalStatic \
+ = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \
+ if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \
+ TYPE *x = new TYPE; \
+ if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \
+ delete x; \
+ else \
+ static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
+ } \
+ return thisGlobalStatic.pointer; \
}
-#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
- Q_GLOBAL_STATIC_INIT(TYPE, NAME); \
- static TYPE *NAME() \
- { \
- if (!this_##NAME.pointer && !this_##NAME.destroyed) { \
- TYPE *x = new TYPE ARGS; \
- if (!this_##NAME.pointer.testAndSetOrdered(0, x)) \
- delete x; \
- else \
- static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \
- } \
- return this_##NAME.pointer; \
+#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
+ static TYPE *NAME() \
+ { \
+ static QGlobalStatic<TYPE > thisGlobalStatic \
+ = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \
+ if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \
+ TYPE *x = new TYPE ARGS; \
+ if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \
+ delete x; \
+ else \
+ static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
+ } \
+ return thisGlobalStatic.pointer; \
}
-#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \
- Q_GLOBAL_STATIC_INIT(TYPE, NAME); \
- static TYPE *NAME() \
- { \
- if (!this_##NAME.pointer && !this_##NAME.destroyed) { \
- QScopedPointer<TYPE > x(new TYPE); \
- INITIALIZER; \
- if (this_##NAME.pointer.testAndSetOrdered(0, x.data())) { \
- static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \
- x.take(); \
- } \
- } \
- return this_##NAME.pointer; \
+#define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \
+ static TYPE *NAME() \
+ { \
+ static QGlobalStatic<TYPE > thisGlobalStatic \
+ = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \
+ if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \
+ QScopedPointer<TYPE > x(new TYPE); \
+ INITIALIZER; \
+ if (thisGlobalStatic.pointer.testAndSetOrdered(0, x.data())) { \
+ static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
+ x.take(); \
+ } \
+ } \
+ return thisGlobalStatic.pointer; \
}
#endif