diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-04-28 13:25:50 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-05-10 11:32:47 +0000 |
commit | a225bddf67f4786c845193630d4ab20b99a2fc3a (patch) | |
tree | 032b2bed9711778d2e5fbab954844c6a18db9b0a /src/qml/qtqmlglobal_p.h | |
parent | 9921b48c83490b450241d6c172f1375ab4efb6b1 (diff) |
Update the alloca() support in QtQml
qv4alloca_p.h dates from April 2013 and contained just the #includes,
whereas the code in qtqmlglobal_p.h was introduced earlier this year in
commit 87f016ea9eddc874d5cba7d79d0a487d5ef61761. This commit moves the
macros to qv4alloca_p.h and centralizes the support there.
This also updates the #include detection mechanism, by using
QT_CONFIG(alloca_h) to determine which #include to use. See commit
98c1d516b7f7624f7fcd7b9046783e3903a6a42b in qtbase for more details.
Task-number: QTBUG-59700
Started-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b4b38005ce2ecb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qtqmlglobal_p.h')
-rw-r--r-- | src/qml/qtqmlglobal_p.h | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/qml/qtqmlglobal_p.h b/src/qml/qtqmlglobal_p.h index 6547274d09..e9834ffc4c 100644 --- a/src/qml/qtqmlglobal_p.h +++ b/src/qml/qtqmlglobal_p.h @@ -55,46 +55,6 @@ #include <QtQml/private/qtqml-config_p.h> #include <QtQml/qtqmlglobal.h> -// Define Q_ALLOCA_VAR macro to be used instead of #ifdeffing -// the occurrences of alloca() in case it's not supported. -// Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macros separate -// memory allocation from the declaration and RAII. -#define Q_ALLOCA_VAR(type, name, size) \ - Q_ALLOCA_DECLARE(type, name); \ - Q_ALLOCA_ASSIGN(type, name, size) - -#if defined(QT_BOOTSTRAPPED) || QT_CONFIG(alloca) - -#define Q_ALLOCA_DECLARE(type, name) \ - type *name = 0 - -#define Q_ALLOCA_ASSIGN(type, name, size) \ - name = static_cast<type*>(alloca(size)) - -#else -QT_BEGIN_NAMESPACE -class Qt_AllocaWrapper -{ -public: - Qt_AllocaWrapper() { m_data = 0; } - ~Qt_AllocaWrapper() { free(m_data); } - void *data() { return m_data; } - void allocate(int size) { m_data = malloc(size); } -private: - void *m_data; -}; -QT_END_NAMESPACE - -#define Q_ALLOCA_DECLARE(type, name) \ - Qt_AllocaWrapper _qt_alloca_##name; \ - type *name = 0 - -#define Q_ALLOCA_ASSIGN(type, name, size) \ - _qt_alloca_##name.allocate(size); \ - name = static_cast<type*>(_qt_alloca_##name.data()) - -#endif - #define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT #endif // QTQMLGLOBAL_P_H |