Remove checks for C++ standard versions C++17 and below
Qt requires a compiler that support C++17 thus __cplusplus is always 201703L or higher. This patch removes checks for __cplusplus value that always succeed. Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
79f62380f0
commit
44a7412795
@ -89,21 +89,12 @@ TetrixWindow::TetrixWindow(QWidget *parent)
|
||||
//! [4] //! [5]
|
||||
connect(quitButton , &QPushButton::clicked, qApp, &QCoreApplication::quit);
|
||||
connect(pauseButton, &QPushButton::clicked, board, &TetrixBoard::pause);
|
||||
#if __cplusplus >= 201402L
|
||||
connect(board, &TetrixBoard::scoreChanged,
|
||||
scoreLcd, qOverload<int>(&QLCDNumber::display));
|
||||
connect(board, &TetrixBoard::levelChanged,
|
||||
levelLcd, qOverload<int>(&QLCDNumber::display));
|
||||
connect(board, &TetrixBoard::linesRemovedChanged,
|
||||
linesLcd, qOverload<int>(&QLCDNumber::display));
|
||||
#else
|
||||
connect(board, &TetrixBoard::scoreChanged,
|
||||
scoreLcd, QOverload<int>::of(&QLCDNumber::display));
|
||||
connect(board, &TetrixBoard::levelChanged,
|
||||
levelLcd, QOverload<int>::of(&QLCDNumber::display));
|
||||
connect(board, &TetrixBoard::linesRemovedChanged,
|
||||
linesLcd, QOverload<int>::of(&QLCDNumber::display));
|
||||
#endif
|
||||
//! [5]
|
||||
|
||||
//! [6]
|
||||
|
@ -56,7 +56,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION) && __has_include(<experimental/source_location>) && __cplusplus >= 201703L && !defined(Q_CLANG_QDOC)
|
||||
#if !defined(QT_PROPERTY_COLLECT_BINDING_LOCATION) && __has_include(<experimental/source_location>) && !defined(Q_CLANG_QDOC)
|
||||
#include <experimental/source_location>
|
||||
#if defined(__cpp_lib_experimental_source_location)
|
||||
#define QT_SOURCE_LOCATION_NAMESPACE std::experimental
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||
#if __has_include(<variant>)
|
||||
#include <variant>
|
||||
#elif defined(Q_CLANG_QDOC)
|
||||
namespace std { template<typename...> struct variant; }
|
||||
@ -402,7 +402,7 @@ class Q_CORE_EXPORT QVariant
|
||||
return QVariant(QMetaType::fromType<T>(), std::addressof(value));
|
||||
}
|
||||
|
||||
#if (__has_include(<variant>) && __cplusplus >= 201703L) || defined(Q_CLANG_QDOC)
|
||||
#if __has_include(<variant>) || defined(Q_CLANG_QDOC)
|
||||
template<typename... Types>
|
||||
static inline QVariant fromStdVariant(const std::variant<Types...> &value)
|
||||
{
|
||||
@ -580,7 +580,7 @@ inline QVariant QVariant::fromValue(const QVariant &value)
|
||||
return value;
|
||||
}
|
||||
|
||||
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||
#if __has_include(<variant>)
|
||||
template<>
|
||||
inline QVariant QVariant::fromValue(const std::monostate &)
|
||||
{
|
||||
|
@ -1466,12 +1466,7 @@ inline std::wstring QString::toStdWString() const
|
||||
{
|
||||
std::wstring str;
|
||||
str.resize(length());
|
||||
#if __cplusplus >= 201703L
|
||||
str.resize(toWCharArray(str.data()));
|
||||
#else
|
||||
if (length())
|
||||
str.resize(toWCharArray(&str.front()));
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename, typename> class QStringBuilder;
|
||||
|
||||
#if defined(Q_QDOC) || 1 || (defined(__cpp_range_based_for) && __cpp_range_based_for >= 201603)
|
||||
# define Q_STRINGTOKENIZER_USE_SENTINEL
|
||||
#endif
|
||||
#define Q_STRINGTOKENIZER_USE_SENTINEL
|
||||
|
||||
class QStringTokenizerBaseBase
|
||||
{
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
#if __has_include(<memory_resource>) && __cplusplus > 201402L
|
||||
#if __has_include(<memory_resource>)
|
||||
# include <unordered_set>
|
||||
# include <memory_resource>
|
||||
# include <qhash.h> // for the hashing helpers
|
||||
|
@ -35,7 +35,7 @@
|
||||
#if __has_include(<source_location>) && __cplusplus >= 202002L && !defined(Q_CLANG_QDOC)
|
||||
#include <source_location>
|
||||
#define QT_SOURCE_LOCATION_NAMESPACE std
|
||||
#elif __has_include(<experimental/source_location>) && __cplusplus >= 201703L && !defined(Q_CLANG_QDOC)
|
||||
#elif __has_include(<experimental/source_location>) && !defined(Q_CLANG_QDOC)
|
||||
#include <experimental/source_location>
|
||||
#define QT_SOURCE_LOCATION_NAMESPACE std::experimental
|
||||
#endif
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include <cmath>
|
||||
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||
#if __has_include(<variant>)
|
||||
#include <variant>
|
||||
#endif
|
||||
#include <QRegularExpression>
|
||||
@ -4882,7 +4882,7 @@ void tst_QVariant::shouldDeleteVariantDataWorksForAssociative()
|
||||
|
||||
void tst_QVariant::fromStdVariant()
|
||||
{
|
||||
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||
#if __has_include(<variant>)
|
||||
{
|
||||
typedef std::variant<int, bool> intorbool_t;
|
||||
intorbool_t stdvar = 5;
|
||||
|
@ -30,10 +30,8 @@
|
||||
#include <QTest>
|
||||
#include <mutex>
|
||||
#if __has_include(<shared_mutex>)
|
||||
#if __cplusplus > 201103L
|
||||
#include <shared_mutex>
|
||||
#endif
|
||||
#endif
|
||||
#include <vector>
|
||||
|
||||
// Wrapers that take pointers instead of reference to have the same interface as Qt
|
||||
|
Loading…
x
Reference in New Issue
Block a user