From e650859dc9c26b3d411c534286f477d786723a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 28 Nov 2011 15:40:35 +0100 Subject: Improve Q_CONSTRUCTOR_FUNCTION and Q_DESTRUCTOR_FUNCTION macros. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By adding anonymous namespace and static linkage we are reducing visibility of implementation of these macros. This patch also fixes warning about a declared but unused variable which was issued by gcc 4.6 for Q_CONSTRUCTOR_FUNCTION. Change-Id: I2cb70ad4c93f6f77e5518420abcce6fd4cadccfa Reviewed-by: Thiago Macieira Reviewed-by: Friedemann Kleint Reviewed-by: João Abecasis --- tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/auto/corelib/global') diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index b3115e036e..23ec228c68 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -53,6 +53,7 @@ private slots: void qtry(); void checkptr(); void qstaticassert(); + void qConstructorFunction(); }; void tst_QGlobal::qIsNull() @@ -353,5 +354,17 @@ void tst_QGlobal::qstaticassert() QVERIFY(true); // if the test compiles it has passed. } +static int qConstructorFunctionValue; +static void qConstructorFunctionCtor() +{ + qConstructorFunctionValue = 123; +} +Q_CONSTRUCTOR_FUNCTION(qConstructorFunctionCtor); + +void tst_QGlobal::qConstructorFunction() +{ + QCOMPARE(qConstructorFunctionValue, 123); +} + QTEST_MAIN(tst_QGlobal) #include "tst_qglobal.moc" -- cgit v1.2.3