diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-09-30 14:12:02 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-10-02 17:54:39 +0200 |
commit | 9a3f4afb700bb4fb6c4d26120de71fb61ffab032 (patch) | |
tree | 5d9942baad0301712beb1f462eee6c7c6ca8432f /src | |
parent | a1e7c441de16cb4e8d6bdac39160759116ecd233 (diff) |
Remove checks for features available in C++17
This patch removes most of the checks that are made using C++20
__cpp_* macros for features available in C++17 and earlier.
Library feature check macros (__cpp_lib_*) are unaffected.
Change-Id: I557b2bd0d4ff09b13837555e9880eb28e0355f64
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/concurrent/qtconcurrentfunctionwrappers.h | 2 | ||||
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 12 | ||||
-rw-r--r-- | src/corelib/kernel/qobjectdefs_impl.h | 4 | ||||
-rw-r--r-- | src/corelib/thread/qlocking_p.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qscopeguard.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qset.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qrgba64.h | 4 |
9 files changed, 2 insertions, 32 deletions
diff --git a/src/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h index 1c882d3f19..08966115d6 100644 --- a/src/concurrent/qtconcurrentfunctionwrappers.h +++ b/src/concurrent/qtconcurrentfunctionwrappers.h @@ -129,7 +129,6 @@ struct ReduceResultType<R(*)(A...)> using ResultType = typename std::tuple_element<0, std::tuple<A...>>::type; }; -#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 template <class U, class V> struct ReduceResultType<void(*)(U&,V) noexcept> { @@ -141,7 +140,6 @@ struct ReduceResultType<T(C::*)(U) noexcept> { using ResultType = C; }; -#endif template<class T, class Enable = void> struct hasCallOperator : std::false_type diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 273575c31f..bfa4f89105 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1114,10 +1114,8 @@ # define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]] #endif -#if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411 -# define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED -# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x) -#endif +#define Q_DECL_ENUMERATOR_DEPRECATED Q_DECL_DEPRECATED +#define Q_DECL_ENUMERATOR_DEPRECATED_X(x) Q_DECL_DEPRECATED_X(x) /* * Fallback macros to certain compiler features @@ -1153,12 +1151,6 @@ #ifndef Q_DECL_DEPRECATED_X # define Q_DECL_DEPRECATED_X(text) Q_DECL_DEPRECATED #endif -#ifndef Q_DECL_ENUMERATOR_DEPRECATED -# define Q_DECL_ENUMERATOR_DEPRECATED -#endif -#ifndef Q_DECL_ENUMERATOR_DEPRECATED_X -# define Q_DECL_ENUMERATOR_DEPRECATED_X(x) -#endif #ifndef Q_DECL_EXPORT # define Q_DECL_EXPORT #endif diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index c35d9aa7a7..a3068e1712 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -158,7 +158,6 @@ namespace QtPrivate { (o->*f)((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]); } }; -#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 template <int... II, typename... SignalArgs, typename R, typename... SlotArgs, typename SlotRet, class Obj> struct FunctorCall<IndexesList<II...>, List<SignalArgs...>, R, SlotRet (Obj::*)(SlotArgs...) noexcept> { static void call(SlotRet (Obj::*f)(SlotArgs...) noexcept, Obj *o, void **arg) { @@ -171,7 +170,6 @@ namespace QtPrivate { (o->*f)((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]); } }; -#endif template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...)> { @@ -210,7 +208,6 @@ namespace QtPrivate { } }; -#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510 template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...) noexcept> { typedef Obj Object; @@ -247,7 +244,6 @@ namespace QtPrivate { FunctorCall<typename Indexes<ArgumentCount>::Value, SignalArgs, R, Function>::call(f, arg); } }; -#endif template<typename Function, int N> struct Functor { diff --git a/src/corelib/thread/qlocking_p.h b/src/corelib/thread/qlocking_p.h index 9a796cf7f7..5fb80454df 100644 --- a/src/corelib/thread/qlocking_p.h +++ b/src/corelib/thread/qlocking_p.h @@ -84,15 +84,11 @@ QT_BEGIN_NAMESPACE namespace { template <typename Mutex, typename Lock = -#if defined(__cpp_guaranteed_copy_elision) && __cpp_guaranteed_copy_elision >= 201606L # if defined(__cpp_lib_scoped_lock) && __cpp_lib_scoped_lock >= 201703L std::scoped_lock # else std::lock_guard # endif -#else - std::unique_lock -#endif <typename std::decay<Mutex>::type> > Lock qt_scoped_lock(Mutex &mutex) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 0329dd37da..07e5970faf 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -663,12 +663,10 @@ public: } }; -#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201606 template <typename InputIterator, typename ValueType = typename std::iterator_traits<InputIterator>::value_type, QtPrivate::IfIsInputIterator<InputIterator> = true> QList(InputIterator, InputIterator) -> QList<ValueType>; -#endif template <typename T> inline void QList<T>::resize_internal(qsizetype newSize) diff --git a/src/corelib/tools/qscopeguard.h b/src/corelib/tools/qscopeguard.h index 8270f41a2e..cc9e8db209 100644 --- a/src/corelib/tools/qscopeguard.h +++ b/src/corelib/tools/qscopeguard.h @@ -86,9 +86,7 @@ private: bool m_invoke = true; }; -#ifdef __cpp_deduction_guides template <typename F> QScopeGuard(F(&)()) -> QScopeGuard<F(*)()>; -#endif //! [qScopeGuard] template <typename F> diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 565b8b5691..9aecbff5bc 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -235,12 +235,10 @@ private: Hash q_hash; }; -#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201606 template <typename InputIterator, typename ValueType = typename std::iterator_traits<InputIterator>::value_type, QtPrivate::IfIsInputIterator<InputIterator> = true> QSet(InputIterator, InputIterator) -> QSet<ValueType>; -#endif template <typename T> size_t qHash(const QSet<T> &key, size_t seed = 0) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 3aa5e70114..90be3b3299 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -386,12 +386,10 @@ private: } }; -#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201606 template <typename InputIterator, typename ValueType = typename std::iterator_traits<InputIterator>::value_type, QtPrivate::IfIsInputIterator<InputIterator> = true> QVarLengthArray(InputIterator, InputIterator) -> QVarLengthArray<ValueType>; -#endif template <class T, qsizetype Prealloc> Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(qsizetype asize) diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index 2c644c4cf0..e326c03bfc 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -118,7 +118,6 @@ public: constexpr quint8 alpha8() const { return div_257(alpha()); } constexpr uint toArgb32() const { -#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304 quint64 br = rgba & Q_UINT64_C(0xffff0000ffff); quint64 ag = (rgba >> 16) & Q_UINT64_C(0xffff0000ffff); br += Q_UINT64_C(0x8000000080); @@ -136,9 +135,6 @@ public: | (ag & 0xff00) | ((br >> 32) & 0xff); #endif -#else - return uint((alpha8() << 24) | (red8() << 16) | (green8() << 8) | blue8()); -#endif } constexpr ushort toRgb16() const { |