Move qVersion() from qglobal.h to qlibraryinfo.h
Since qVersion() might be called also from C code, disable the parts of qlibraryinfo.h that are relevant only for C++ code if __cplusplus is not defined. [ChangeLog][Potentially Source-Incompatible Changes] qVersion() is moved from qglobal.h to qlibraryinfo.h, '#include <QtCore/QLibraryInfo>' needs to be added where it's used. Task-number: QTBUG-99313 Change-Id: I3363ef3fa4073114e5151cb3a2a1e8282ad42a4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
b077c419ea
commit
50b05e3e2a
@ -16,6 +16,7 @@
|
||||
#include <qdebug.h>
|
||||
#include <qbuffer.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qlibraryinfo.h>
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
#include <unistd.h>
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <qfile.h>
|
||||
#include <qdir.h>
|
||||
#include <qdebug.h>
|
||||
#include <qlibraryinfo.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <tuple>
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <qmakelibraryinfo.h>
|
||||
#include <qlibraryinfo.h>
|
||||
#include <private/qlibraryinfo_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <qdir.h>
|
||||
#include <qsettings.h>
|
||||
#include <qlibraryinfo.h>
|
||||
#include <qmakelibraryinfo.h>
|
||||
#include <qstringlist.h>
|
||||
#include <stdio.h>
|
||||
|
@ -792,21 +792,6 @@ using namespace Qt::StringLiterals;
|
||||
\sa qVersion(), QT_VERSION
|
||||
*/
|
||||
|
||||
/*!
|
||||
\relates <QtGlobal>
|
||||
|
||||
Returns the version number of Qt at runtime as a string (for example,
|
||||
"6.1.2"). This may be a different version than the version the application
|
||||
was \e compiled with.
|
||||
|
||||
\sa QT_VERSION_STR, QLibraryInfo::version()
|
||||
*/
|
||||
|
||||
const char *qVersion() noexcept
|
||||
{
|
||||
return QT_VERSION_STR;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
System detection routines
|
||||
*****************************************************************************/
|
||||
|
@ -48,19 +48,6 @@ inline void qt_noop(void) {}
|
||||
#ifndef __ASSEMBLER__
|
||||
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
|
||||
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#if 0
|
||||
|
@ -659,6 +659,21 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
|
||||
\deprecated Use LibraryPath with QLibraryInfo::path() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\relates <QLibraryInfo>
|
||||
|
||||
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,
|
||||
which need not be the version the application was \e compiled with.
|
||||
|
||||
\sa QT_VERSION_STR, QLibraryInfo::version()
|
||||
*/
|
||||
|
||||
const char *qVersion() noexcept
|
||||
{
|
||||
return QT_VERSION_STR;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(6, 9)
|
||||
|
||||
bool qSharedBuild() noexcept
|
||||
|
@ -4,12 +4,18 @@
|
||||
#ifndef QLIBRARYINFO_H
|
||||
#define QLIBRARYINFO_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <QtCore/qversionnumber.h>
|
||||
#else
|
||||
#include <QtCore/qglobal.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
class Q_CORE_EXPORT QLibraryInfo
|
||||
{
|
||||
public:
|
||||
@ -61,6 +67,21 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept;
|
||||
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <qclipboard.h>
|
||||
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtCore/qlibraryinfo.h>
|
||||
|
||||
#if QT_CONFIG(accessibility)
|
||||
#include "socket_interface.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qlibraryinfo.h>
|
||||
|
||||
#ifdef Q_COMPILER_THREAD_LOCAL
|
||||
# include <threads.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QSysInfo>
|
||||
#include <QLatin1String>
|
||||
#include <QString>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (C) 2020 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QtCore/qlibraryinfo.h>
|
||||
#include <QtGui/qpa/qplatformscreen.h>
|
||||
#include <QtGui/qpa/qplatformwindow.h>
|
||||
#include <QtGui/private/qhighdpiscaling_p.h>
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QDebug>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
class ShortcutTester : public QWidget
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user