Move the constructor and destruction function macros to the C++ part

These macros expand to C++ code, so there's no point in having them
defined in the non-C++ part of qglobal.h.

Change-Id: Ic5763196391798e362d33466114969818e7e6793
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Thiago Macieira 2012-08-29 11:25:22 +02:00 committed by Qt by Nokia
parent 8fca1e70e7
commit f53a879b95

View File

@ -151,28 +151,6 @@ namespace QT_NAMESPACE {}
# define QT_LARGEFILE_SUPPORT 64
#endif
#ifndef Q_CONSTRUCTOR_FUNCTION
# define Q_CONSTRUCTOR_FUNCTION0(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) \
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
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@ -223,6 +201,28 @@ typedef quint64 qulonglong;
#if defined(__cplusplus)
#ifndef Q_CONSTRUCTOR_FUNCTION
# define Q_CONSTRUCTOR_FUNCTION0(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) \
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
namespace QtPrivate {
template <class T>
struct AlignOfHelper