Extract header qconstructormacros.h from qglobal.h

Task-number: QTBUG-99313
Change-Id: I3861a3095148c7927aabd8becf6f7b534f214fba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Sona Kurazyan 2022-08-23 17:15:44 +02:00
parent e57d2d7279
commit 4da3350f15
3 changed files with 40 additions and 22 deletions

View File

@ -51,6 +51,7 @@ qt_internal_add_module(Core
global/qcompare_impl.h
global/qcompare.h
global/qcompilerdetection.h
global/qconstructormacros.h
global/qcontainerinfo.h
global/qendian.cpp global/qendian.h global/qendian_p.h
global/qenvironmentvariables.cpp global/qenvironmentvariables.h

View File

@ -0,0 +1,38 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCONSTRUCTORMACROS_H
#define QCONSTRUCTORMACROS_H
#if 0
#pragma qt_class(QtConstructorMacros)
#pragma qt_sync_stop_processing
#endif
#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
#endif // __cplusplus
#endif // QCONSTRUCTORMACROS_H

View File

@ -70,28 +70,6 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT;
#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
/* moc compats (signals/slots) */
#ifndef QT_MOC_COMPAT
# define QT_MOC_COMPAT
@ -240,6 +218,7 @@ QT_END_NAMESPACE
#include <QtCore/qflags.h>
#include <QtCore/qatomic.h>
#include <QtCore/qconstructormacros.h>
#include <QtCore/qenvironmentvariables.h>
#include <QtCore/qexceptionhandling.h>
#include <QtCore/qforeach.h>