diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-08-29 11:25:22 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-10 00:26:27 +0200 |
commit | f53a879b95a2644b33637ad3fff472efde3e4de1 (patch) | |
tree | 19c314a73178278deba22be798a727c886942507 /src/corelib | |
parent | 8fca1e70e7a8b1dc21a0134b6786e84faff91823 (diff) |
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>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qglobal.h | 44 |
1 files changed, 22 insertions, 22 deletions
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 <class T> struct AlignOfHelper |