Should be sorted most to least authoritative.
*/
-#if defined(__ghs)
-# define Q_OUTOFLINE_TEMPLATE inline
-
-/* the following are necessary because the GHS C++ name mangling relies on __*/
-# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
- static const int AFUNC ## _init_variable_ = AFUNC();
-# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
-# define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
- class AFUNC ## _dest_class_ { \
- public: \
- inline AFUNC ## _dest_class_() { } \
- inline ~ AFUNC ## _dest_class_() { AFUNC(); } \
- } AFUNC ## _dest_instance_;
-# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
-
-#endif
-
/* Symantec C++ is now Digital Mars */
#if defined(__DMC__) || defined(__SC__)
# define Q_CC_SYM
#ifndef Q_CONSTRUCTOR_FUNCTION
# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
- static const int AFUNC ## __init_variable__ = AFUNC();
+ namespace { \
+ static const struct AFUNC ## _ctor_class_ { \
+ inline AFUNC ## _ctor_class_() { AFUNC(); } \
+ } AFUNC ## _ctor_instance_; \
+ }
+
# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
#endif
#ifndef Q_DESTRUCTOR_FUNCTION
# define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
- class AFUNC ## __dest_class__ { \
- public: \
- inline AFUNC ## __dest_class__() { } \
- inline ~ AFUNC ## __dest_class__() { AFUNC(); } \
- } AFUNC ## __dest_instance__;
+ namespace { \
+ static const struct AFUNC ## _dtor_class_ { \
+ inline AFUNC ## _dtor_class_() { } \
+ inline ~ AFUNC ## _dtor_class_() { AFUNC(); } \
+ } AFUNC ## _dtor_instance_; \
+ }
# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
#endif
protected:
friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
- friend int qRegisterGuiVariant();
- friend int qUnregisterGuiVariant();
+ friend void qRegisterGuiVariant();
+ friend void qUnregisterGuiVariant();
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
QFont *QGuiApplicationPrivate::app_font = 0;
-extern int qRegisterGuiVariant();
-extern int qUnregisterGuiVariant();
+extern void qRegisterGuiVariant();
+extern void qUnregisterGuiVariant();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
#undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES
static const QVariant::Handler *qt_guivariant_last_handler = 0;
-int qRegisterGuiVariant()
+void qRegisterGuiVariant()
{
qt_guivariant_last_handler = QVariant::handler;
QVariant::handler = &qt_gui_variant_handler;
qMetaTypeGuiHelper = qVariantGuiHelper;
- return 1;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
-int qUnregisterGuiVariant()
+void qUnregisterGuiVariant()
{
QVariant::handler = qt_guivariant_last_handler;
qMetaTypeGuiHelper = 0;
- return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant)
return stream >> entry.bits;
}
-static int qRegisterPaintBufferMetaTypes()
+static void qRegisterPaintBufferMetaTypes()
{
qRegisterMetaType<QPaintBufferCacheEntry>();
qRegisterMetaTypeStreamOperators<QPaintBufferCacheEntry>("QPaintBufferCacheEntry");
qRegisterMetaType<QPaintBufferCacheEntryV2>();
qRegisterMetaTypeStreamOperators<QPaintBufferCacheEntryV2>("QPaintBufferCacheEntryV2");
-
- return 0; // something
}
Q_CONSTRUCTOR_FUNCTION(qRegisterPaintBufferMetaTypes)
return QQuaternion::slerp(f, t, progress);
}
-static int qRegisterGuiGetInterpolator()
+static void qRegisterGuiGetInterpolator()
{
qRegisterAnimationInterpolator<QColor>(_q_interpolateVariant<QColor>);
qRegisterAnimationInterpolator<QVector2D>(_q_interpolateVariant<QVector2D>);
qRegisterAnimationInterpolator<QVector3D>(_q_interpolateVariant<QVector3D>);
qRegisterAnimationInterpolator<QVector4D>(_q_interpolateVariant<QVector4D>);
qRegisterAnimationInterpolator<QQuaternion>(_q_interpolateVariant<QQuaternion>);
- return 1;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiGetInterpolator)
-static int qUnregisterGuiGetInterpolator()
+static void qUnregisterGuiGetInterpolator()
{
// casts required by Sun CC 5.5
qRegisterAnimationInterpolator<QColor>(
(QVariant (*)(const QVector4D &, const QVector4D &, qreal))0);
qRegisterAnimationInterpolator<QQuaternion>(
(QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0);
-
- return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator)
#endif // Q_WS_X11
#ifndef QT_NO_STATEMACHINE
-extern int qRegisterGuiStateMachine();
-extern int qUnregisterGuiStateMachine();
+void qRegisterGuiStateMachine();
+void qUnregisterGuiStateMachine();
#endif
/*!
extern Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler;
-int qRegisterWidgetsVariant()
+void qRegisterWidgetsVariant()
{
qt_widgets_variant_handler = &widgets_handler;
qMetaTypeWidgetsHelper = qVariantWidgetsHelper;
- return 1;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant)
-int qUnregisterWidgetsVariant()
+void qUnregisterWidgetsVariant()
{
qt_widgets_variant_handler = 0;
qMetaTypeWidgetsHelper = 0;
- return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant)
};
static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = 0;
-int qRegisterGuiStateMachine()
+void qRegisterGuiStateMachine()
{
qt_guistatemachine_last_handler = QStateMachinePrivate::handler;
QStateMachinePrivate::handler = &qt_gui_statemachine_handler;
- return 1;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiStateMachine)
-int qUnregisterGuiStateMachine()
+void qUnregisterGuiStateMachine()
{
QStateMachinePrivate::handler = qt_guistatemachine_last_handler;
- return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
void qtry();
void checkptr();
void qstaticassert();
+ void qConstructorFunction();
};
void tst_QGlobal::qIsNull()
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"