Move qVersion() into it's own header

Partially reverts 50b05e3e2a.

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 <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
bb10
Marc Mutz 2022-12-05 22:29:08 +01:00
parent 4673f00277
commit e4851fedd4
6 changed files with 44 additions and 16 deletions

View File

@ -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}

View File

@ -100,7 +100,8 @@ using namespace Qt::StringLiterals;
\row \li \l <QtTranslation> \li Qt translation helpers
\row \li \l <QtTypeTraits> \li Qt type traits
\row \li \l <QtTypes> \li Qt fundamental type declarations
\row \li \l <QtVersionChecks> \li Qt Version related checks
\row \li \l <QtVersionChecks> \li QT_VERSION_CHECK and related checks
\row \li \l <QtVersion> \li QT_VERSION_STR and qVersion()
\endtable
*/

View File

@ -37,6 +37,7 @@
#include <QtCore/qtypes.h>
#include <QtCore/qtclasshelpermacros.h>
#include <QtCore/qtversion.h>
#ifndef __ASSEMBLER__
#if defined(__cplusplus)

View File

@ -661,7 +661,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
/*!
\macro QT_VERSION_STR
\relates <QLibraryInfo>
\relates <QtVersion>
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 <QLibraryInfo>
\relates <QtVersion>
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,

View File

@ -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

View File

@ -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 <QtCore/qcompilerdetection.h>
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qtcoreexports.h>
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