From e4851fedd429cfe00de061e81596856fdd22d2c8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 5 Dec 2022 22:29:08 +0100 Subject: [PATCH] Move qVersion() into it's own header Partially reverts 50b05e3e2ad969abf4b939d5db2253380e47d775. The move of qVersion() from qglobal.h into qlibraryinfo.h, a header not included by qglobal.h, was a conscious, documented, QUIP-0006- allowed, but stetching the SiC Type A definition, and therefore unwarranted, SiC. Fix by moving qVersion() into its own header file, qtversion.h, included from qglobal.h. [ChangeLog][Editorial] Remove the entry for qVersion() being moved to qlibraryinfo.h. Fixes: QTBUG-108818 Change-Id: I3524802348635512a63fbbb55ddc28ad28f331e8 Reviewed-by: Thiago Macieira Reviewed-by: Ivan Solovev --- src/corelib/CMakeLists.txt | 1 + src/corelib/global/qglobal.cpp | 3 ++- src/corelib/global/qglobal.h | 1 + src/corelib/global/qlibraryinfo.cpp | 4 +-- src/corelib/global/qlibraryinfo.h | 13 ---------- src/corelib/global/qtversion.h | 38 +++++++++++++++++++++++++++++ 6 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 src/corelib/global/qtversion.h diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 1d758a7482..fdaef27e5f 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -95,6 +95,7 @@ qt_internal_add_module(Core global/qttranslation.h global/qttypetraits.h global/qtversionchecks.h + global/qtversion.h global/qtypeinfo.h global/qtypes.cpp global/qtypes.h ${core_version_tagging_files} diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 238b9cf4b4..cddf446392 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -100,7 +100,8 @@ using namespace Qt::StringLiterals; \row \li \l \li Qt translation helpers \row \li \l \li Qt type traits \row \li \l \li Qt fundamental type declarations - \row \li \l \li Qt Version related checks + \row \li \l \li QT_VERSION_CHECK and related checks + \row \li \l \li QT_VERSION_STR and qVersion() \endtable */ diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index f78d7e9445..fe3403fc60 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -37,6 +37,7 @@ #include #include +#include #ifndef __ASSEMBLER__ #if defined(__cplusplus) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 64fc9fff01..715bda488c 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -661,7 +661,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) /*! \macro QT_VERSION_STR - \relates + \relates This macro expands to a string that specifies Qt's version number (for example, "6.1.2"). This is the version with which the application is @@ -672,7 +672,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) */ /*! - \relates + \relates Returns the version number of Qt at runtime as a string (for example, "6.1.2"). This is the version of the Qt library in use at \e runtime, diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 71d9a01308..dae050f9cc 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -69,19 +69,6 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept; #endif // __cplusplus -/* - * If we're compiling C++ code: - * - and this is a non-namespace build, declare qVersion as extern "C" - * - and this is a namespace build, declare it as a regular function - * (we're already inside QT_BEGIN_NAMESPACE / QT_END_NAMESPACE) - * If we're compiling C code, simply declare the function. If Qt was compiled - * in a namespace, qVersion isn't callable anyway. - */ -#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) -extern "C" -#endif -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT; - QT_END_NAMESPACE #endif // QLIBRARYINFO_H diff --git a/src/corelib/global/qtversion.h b/src/corelib/global/qtversion.h new file mode 100644 index 0000000000..775f2479a9 --- /dev/null +++ b/src/corelib/global/qtversion.h @@ -0,0 +1,38 @@ +// Copyright (C) 2016 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 QTVERSION_H +#define QTVERSION_H + +#if 0 +#pragma qt_class(QtVersion) +#pragma qt_sync_stop_processing +#endif + +#ifndef __ASSEMBLER__ + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/* + * If we're compiling C++ code: + * - and this is a non-namespace build, declare qVersion as extern "C" + * - and this is a namespace build, declare it as a regular function + * (we're already inside QT_BEGIN_NAMESPACE / QT_END_NAMESPACE) + * If we're compiling C code, simply declare the function. If Qt was compiled + * in a namespace, qVersion isn't callable anyway. + */ +#if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) +extern "C" +#endif +/* defined in qlibraryinfo.cpp */ +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT; + +QT_END_NAMESPACE + +#endif // __ASSEMBLER__ + +#endif // QTVERSION_H