From f53a879b95a2644b33637ad3fff472efde3e4de1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 29 Aug 2012 11:25:22 +0200 Subject: 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 Reviewed-by: Lars Knoll --- src/corelib/global/qglobal.h | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index d3e2898a99..c9851d37f4 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -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 struct AlignOfHelper -- cgit v1.2.3