From 9d1e9285129b4c65c978c806bb839798ace61a60 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Wed, 5 Oct 2022 14:39:41 +0200 Subject: [PATCH] Do not include qglobal.h into the new headers Several new headers were extracted from qglobal.h in scope of QTBUG-99313. This commit makes sure that none of them actually includes qglobal.h. As those files are new, it should be safe to introduce this change, as it shouldn't have any impact on the user code. This patch also modifies the autogenerated module exports header to include qglobal.h before the include guard. This is needed to prevent circular dependencies which result in Q__EXPORT being undefined. Task-number: QTBUG-107046 Change-Id: I8d998792fd8129173d9ec811557e7d7604282813 Reviewed-by: Thiago Macieira --- cmake/modulecppexports.h.in | 4 ++-- src/corelib/global/qmalloc.h | 6 +++++- src/corelib/global/qtenvironmentvariables.h | 4 +++- src/corelib/global/qttranslation.h | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cmake/modulecppexports.h.in b/cmake/modulecppexports.h.in index f4e976b540..725d9d79f1 100644 --- a/cmake/modulecppexports.h.in +++ b/cmake/modulecppexports.h.in @@ -1,11 +1,11 @@ // 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 +#include + #ifndef @header_base_name_upper@_H #define @header_base_name_upper@_H -#include - #if defined(QT_SHARED) || !defined(QT_STATIC) # if defined(QT_BUILD_@module_define_infix@_LIB) # define Q_@module_define_infix@_EXPORT Q_DECL_EXPORT diff --git a/src/corelib/global/qmalloc.h b/src/corelib/global/qmalloc.h index c83aecd47c..83dfff358b 100644 --- a/src/corelib/global/qmalloc.h +++ b/src/corelib/global/qmalloc.h @@ -4,7 +4,11 @@ #ifndef QMALLOC_H #define QMALLOC_H -#include +#include +#include +#include + +#include // size_t #if 0 #pragma qt_class(QtMalloc) diff --git a/src/corelib/global/qtenvironmentvariables.h b/src/corelib/global/qtenvironmentvariables.h index 1d26bed316..e7be182677 100644 --- a/src/corelib/global/qtenvironmentvariables.h +++ b/src/corelib/global/qtenvironmentvariables.h @@ -4,7 +4,8 @@ #ifndef QTENVIRONMENTVARIABLES_H #define QTENVIRONMENTVARIABLES_H -#include +#include +#include #include #if 0 @@ -16,6 +17,7 @@ QT_BEGIN_NAMESPACE class QByteArray; class QByteArrayView; +class QString; Q_CORE_EXPORT QByteArray qgetenv(const char *varName); // need it as two functions because QString is only forward-declared here diff --git a/src/corelib/global/qttranslation.h b/src/corelib/global/qttranslation.h index 6e8405789e..fb0a2244cc 100644 --- a/src/corelib/global/qttranslation.h +++ b/src/corelib/global/qttranslation.h @@ -4,7 +4,8 @@ #ifndef QTTRANSLATION_H #define QTTRANSLATION_H -#include +#include // QT_NO_TRANSLATION should be defined here as well +#include #if 0 #pragma qt_class(QtTranslation) @@ -13,6 +14,8 @@ QT_BEGIN_NAMESPACE +class QString; + #define QT_TR_NOOP(x) x #define QT_TR_NOOP_UTF8(x) x #define QT_TRANSLATE_NOOP(scope, x) x