Don't wrap feature detection macros with QT_HAS_FOO() variants
Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
191ac31598
commit
c3bd5ffdc8
@ -505,6 +505,39 @@
|
|||||||
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
|
# error "Qt has not been tested with this compiler - see http://www.qt-project.org/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SG10's SD-6 feature detection and some useful extensions from Clang and GCC
|
||||||
|
* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
|
||||||
|
* http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros
|
||||||
|
* Not using wrapper macros, per http://eel.is/c++draft/cpp.cond#7.sentence-2
|
||||||
|
*/
|
||||||
|
#ifndef __has_builtin
|
||||||
|
# define __has_builtin(x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_feature
|
||||||
|
# define __has_feature(x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_attribute
|
||||||
|
# define __has_attribute(x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_cpp_attribute
|
||||||
|
# define __has_cpp_attribute(x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_include
|
||||||
|
# define __has_include(x) 0
|
||||||
|
#endif
|
||||||
|
#ifndef __has_include_next
|
||||||
|
# define __has_include_next(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Kept around until all submodules have transitioned
|
||||||
|
#define QT_HAS_BUILTIN(x) __has_builtin(x)
|
||||||
|
#define QT_HAS_FEATURE(x) __has_feature(x)
|
||||||
|
#define QT_HAS_ATTRIBUTE(x) __has_attribute(x)
|
||||||
|
#define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
|
||||||
|
#define QT_HAS_INCLUDE(x) __has_include(x)
|
||||||
|
#define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C++11 support
|
* C++11 support
|
||||||
*
|
*
|
||||||
@ -1031,37 +1064,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* SG10's SD-6 feature detection and some useful extensions from Clang and GCC
|
|
||||||
* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
|
|
||||||
* http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros
|
|
||||||
*/
|
|
||||||
#ifdef __has_builtin
|
|
||||||
# define QT_HAS_BUILTIN(x) __has_builtin(x)
|
|
||||||
#else
|
|
||||||
# define QT_HAS_BUILTIN(x) 0
|
|
||||||
#endif
|
|
||||||
#ifdef __has_attribute
|
|
||||||
# define QT_HAS_ATTRIBUTE(x) __has_attribute(x)
|
|
||||||
#else
|
|
||||||
# define QT_HAS_ATTRIBUTE(x) 0
|
|
||||||
#endif
|
|
||||||
#ifdef __has_cpp_attribute
|
|
||||||
# define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
|
|
||||||
#else
|
|
||||||
# define QT_HAS_CPP_ATTRIBUTE(x) 0
|
|
||||||
#endif
|
|
||||||
#ifdef __has_include
|
|
||||||
# define QT_HAS_INCLUDE(x) __has_include(x)
|
|
||||||
#else
|
|
||||||
# define QT_HAS_INCLUDE(x) 0
|
|
||||||
#endif
|
|
||||||
#ifdef __has_include_next
|
|
||||||
# define QT_HAS_INCLUDE_NEXT(x) __has_include_next(x)
|
|
||||||
#else
|
|
||||||
# define QT_HAS_INCLUDE_NEXT(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C++11 keywords and expressions
|
* C++11 keywords and expressions
|
||||||
*/
|
*/
|
||||||
@ -1138,7 +1140,7 @@
|
|||||||
# define Q_DECL_ALIGN(n) alignas(n)
|
# define Q_DECL_ALIGN(n) alignas(n)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_HAS_CPP_ATTRIBUTE(nodiscard) && !defined(Q_CC_CLANG) // P0188R1
|
#if __has_cpp_attribute(nodiscard) && !defined(Q_CC_CLANG) // P0188R1
|
||||||
// Can't use [[nodiscard]] with Clang, see https://bugs.llvm.org/show_bug.cgi?id=33518
|
// Can't use [[nodiscard]] with Clang, see https://bugs.llvm.org/show_bug.cgi?id=33518
|
||||||
# undef Q_REQUIRED_RESULT
|
# undef Q_REQUIRED_RESULT
|
||||||
# define Q_REQUIRED_RESULT [[nodiscard]]
|
# define Q_REQUIRED_RESULT [[nodiscard]]
|
||||||
@ -1240,11 +1242,6 @@
|
|||||||
#ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR
|
#ifndef QT_MAKE_CHECKED_ARRAY_ITERATOR
|
||||||
# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x)
|
# define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) (x)
|
||||||
#endif
|
#endif
|
||||||
#ifdef __has_feature
|
|
||||||
# define QT_HAS_FEATURE(x) __has_feature(x)
|
|
||||||
#else
|
|
||||||
# define QT_HAS_FEATURE(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Warning/diagnostic handling
|
* Warning/diagnostic handling
|
||||||
@ -1335,11 +1332,11 @@
|
|||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
#if __has_cpp_attribute(clang::fallthrough)
|
||||||
# define Q_FALLTHROUGH() [[clang::fallthrough]]
|
# define Q_FALLTHROUGH() [[clang::fallthrough]]
|
||||||
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
|
#elif __has_cpp_attribute(gnu::fallthrough)
|
||||||
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
||||||
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
#elif __has_cpp_attribute(fallthrough)
|
||||||
# define Q_FALLTHROUGH() [[fallthrough]]
|
# define Q_FALLTHROUGH() [[fallthrough]]
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,13 +75,13 @@
|
|||||||
# define QT_FEATURE_alloca_malloc_h -1
|
# define QT_FEATURE_alloca_malloc_h -1
|
||||||
#endif
|
#endif
|
||||||
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
|
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
|
||||||
#define QT_FEATURE_cxx11_random (QT_HAS_INCLUDE(<random>) ? 1 : -1)
|
#define QT_FEATURE_cxx11_random (__has_include(<random>) ? 1 : -1)
|
||||||
#define QT_NO_DATASTREAM
|
#define QT_NO_DATASTREAM
|
||||||
#define QT_FEATURE_datestring 1
|
#define QT_FEATURE_datestring 1
|
||||||
#define QT_FEATURE_datetimeparser -1
|
#define QT_FEATURE_datetimeparser -1
|
||||||
#define QT_FEATURE_easingcurve -1
|
#define QT_FEATURE_easingcurve -1
|
||||||
#define QT_FEATURE_etw -1
|
#define QT_FEATURE_etw -1
|
||||||
#define QT_FEATURE_getauxval (QT_HAS_INCLUDE(<sys/auxv.h>) ? 1 : -1)
|
#define QT_FEATURE_getauxval (__has_include(<sys/auxv.h>) ? 1 : -1)
|
||||||
#define QT_FEATURE_getentropy -1
|
#define QT_FEATURE_getentropy -1
|
||||||
#define QT_NO_GEOM_VARIANT
|
#define QT_NO_GEOM_VARIANT
|
||||||
#define QT_FEATURE_hijricalendar -1
|
#define QT_FEATURE_hijricalendar -1
|
||||||
|
@ -66,7 +66,7 @@ template <typename T> Q_ALWAYS_INLINE void qToUnaligned(const T src, void *dest)
|
|||||||
// Using sizeof(T) inside memcpy function produces internal compiler error with
|
// Using sizeof(T) inside memcpy function produces internal compiler error with
|
||||||
// MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
|
// MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
|
||||||
const size_t size = sizeof(T);
|
const size_t size = sizeof(T);
|
||||||
#if QT_HAS_BUILTIN(__builtin_memcpy)
|
#if __has_builtin(__builtin_memcpy)
|
||||||
__builtin_memcpy
|
__builtin_memcpy
|
||||||
#else
|
#else
|
||||||
memcpy
|
memcpy
|
||||||
@ -78,7 +78,7 @@ template <typename T> Q_ALWAYS_INLINE T qFromUnaligned(const void *src)
|
|||||||
{
|
{
|
||||||
T dest;
|
T dest;
|
||||||
const size_t size = sizeof(T);
|
const size_t size = sizeof(T);
|
||||||
#if QT_HAS_BUILTIN(__builtin_memcpy)
|
#if __has_builtin(__builtin_memcpy)
|
||||||
__builtin_memcpy
|
__builtin_memcpy
|
||||||
#else
|
#else
|
||||||
memcpy
|
memcpy
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
# include <sys/systeminfo.h>
|
# include <sys/systeminfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE(<IOKit/IOKitLib.h>)
|
#if defined(Q_OS_DARWIN) && __has_include(<IOKit/IOKitLib.h>)
|
||||||
# include <IOKit/IOKitLib.h>
|
# include <IOKit/IOKitLib.h>
|
||||||
# include <private/qcore_mac_p.h>
|
# include <private/qcore_mac_p.h>
|
||||||
#endif
|
#endif
|
||||||
@ -3041,7 +3041,7 @@ enum {
|
|||||||
*/
|
*/
|
||||||
QByteArray QSysInfo::machineUniqueId()
|
QByteArray QSysInfo::machineUniqueId()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE(<IOKit/IOKitLib.h>)
|
#if defined(Q_OS_DARWIN) && __has_include(<IOKit/IOKitLib.h>)
|
||||||
char uuid[UuidStringLen + 1];
|
char uuid[UuidStringLen + 1];
|
||||||
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
|
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
|
||||||
QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
|
QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
|
||||||
|
@ -769,7 +769,7 @@ inline void qt_noop(void) {}
|
|||||||
|
|
||||||
#if !defined(QT_NO_EXCEPTIONS)
|
#if !defined(QT_NO_EXCEPTIONS)
|
||||||
# if !defined(Q_MOC_RUN)
|
# if !defined(Q_MOC_RUN)
|
||||||
# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_FEATURE(cxx_exceptions)) || \
|
# if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !__has_feature(cxx_exceptions)) || \
|
||||||
(defined(Q_CC_GNU) && !defined(__EXCEPTIONS))
|
(defined(Q_CC_GNU) && !defined(__EXCEPTIONS))
|
||||||
# define QT_NO_EXCEPTIONS
|
# define QT_NO_EXCEPTIONS
|
||||||
# endif
|
# endif
|
||||||
|
@ -74,7 +74,7 @@ Q_CORE_EXPORT time_t qMkTime(struct tm *when);
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#if !QT_HAS_BUILTIN(__builtin_available)
|
#if !__has_builtin(__builtin_available)
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <QtCore/qoperatingsystemversion.h>
|
#include <QtCore/qoperatingsystemversion.h>
|
||||||
#include <QtCore/qversionnumber.h>
|
#include <QtCore/qversionnumber.h>
|
||||||
@ -142,7 +142,7 @@ QT_END_NAMESPACE
|
|||||||
QT_BUILTIN_AVAILABLE1, \
|
QT_BUILTIN_AVAILABLE1, \
|
||||||
QT_BUILTIN_AVAILABLE0, )
|
QT_BUILTIN_AVAILABLE0, )
|
||||||
#define __builtin_available(...) QT_BUILTIN_AVAILABLE_CHOOSER(__VA_ARGS__)(__VA_ARGS__)
|
#define __builtin_available(...) QT_BUILTIN_AVAILABLE_CHOOSER(__VA_ARGS__)(__VA_ARGS__)
|
||||||
#endif // !QT_HAS_BUILTIN(__builtin_available)
|
#endif // !__has_builtin(__builtin_available)
|
||||||
#endif // defined(__cplusplus)
|
#endif // defined(__cplusplus)
|
||||||
|
|
||||||
#endif // QGLOBAL_P_H
|
#endif // QGLOBAL_P_H
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
#if QT_CONFIG(slog2)
|
#if QT_CONFIG(slog2)
|
||||||
#include <sys/slog2.h>
|
#include <sys/slog2.h>
|
||||||
#endif
|
#endif
|
||||||
#if QT_HAS_INCLUDE(<paths.h>)
|
#if __has_include(<paths.h>)
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -106,7 +106,7 @@
|
|||||||
# if __UCLIBC_HAS_BACKTRACE__
|
# if __UCLIBC_HAS_BACKTRACE__
|
||||||
# define QLOGGING_HAVE_BACKTRACE
|
# define QLOGGING_HAVE_BACKTRACE
|
||||||
# endif
|
# endif
|
||||||
# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (QT_HAS_INCLUDE(<cxxabi.h>) && QT_HAS_INCLUDE(<execinfo.h>))
|
# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include(<cxxabi.h>) && __has_include(<execinfo.h>))
|
||||||
# define QLOGGING_HAVE_BACKTRACE
|
# define QLOGGING_HAVE_BACKTRACE
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@ -116,7 +116,7 @@ extern char *__progname;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QT_BOOTSTRAPPED
|
#ifndef QT_BOOTSTRAPPED
|
||||||
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || QT_HAS_INCLUDE(<sys/syscall.h>))
|
#if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include(<sys/syscall.h>))
|
||||||
# include <sys/syscall.h>
|
# include <sys/syscall.h>
|
||||||
|
|
||||||
# if defined(Q_OS_ANDROID) && !defined(SYS_gettid)
|
# if defined(Q_OS_ANDROID) && !defined(SYS_gettid)
|
||||||
@ -1276,7 +1276,7 @@ void QMessagePattern::setPattern(const QString &pattern)
|
|||||||
#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
|
#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
|
||||||
// make sure the function has "Message" in the name so the function is removed
|
// make sure the function has "Message" in the name so the function is removed
|
||||||
|
|
||||||
#if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)) \
|
#if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || __has_attribute(optimize)) \
|
||||||
&& !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
|
&& !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG)
|
||||||
// force skipping the frame pointer, to save the backtrace() function some work
|
// force skipping the frame pointer, to save the backtrace() function some work
|
||||||
__attribute__((optimize("omit-frame-pointer")))
|
__attribute__((optimize("omit-frame-pointer")))
|
||||||
|
@ -249,7 +249,7 @@ QT_WARNING_POP
|
|||||||
// size_t. Implementations for 8- and 16-bit types will work but may not be as
|
// size_t. Implementations for 8- and 16-bit types will work but may not be as
|
||||||
// efficient. Implementations for 64-bit may be missing on 32-bit platforms.
|
// efficient. Implementations for 64-bit may be missing on 32-bit platforms.
|
||||||
|
|
||||||
#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || QT_HAS_BUILTIN(__builtin_add_overflow)
|
#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || __has_builtin(__builtin_add_overflow)
|
||||||
// GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows
|
// GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows
|
||||||
|
|
||||||
template <typename T> inline
|
template <typename T> inline
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<paths.h>)
|
#if __has_include(<paths.h>)
|
||||||
# include <paths.h>
|
# include <paths.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _PATH_TMP // from <paths.h>
|
#ifndef _PATH_TMP // from <paths.h>
|
||||||
|
@ -100,7 +100,7 @@ QT_END_NAMESPACE
|
|||||||
#include <private/qcore_unix_p.h>
|
#include <private/qcore_unix_p.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<paths.h>)
|
#if __has_include(<paths.h>)
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
#include <qcoreapplication.h>
|
#include <qcoreapplication.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<paths.h>)
|
#if __has_include(<paths.h>)
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
# endif // QT_LARGEFILE_SUPPORT
|
# endif // QT_LARGEFILE_SUPPORT
|
||||||
#endif // Q_OS_BSD4
|
#endif // Q_OS_BSD4
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<paths.h>)
|
#if __has_include(<paths.h>)
|
||||||
# include <paths.h>
|
# include <paths.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _PATH_MOUNTED
|
#ifndef _PATH_MOUNTED
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ public:
|
|||||||
QDeadlineTimer &operator-=(qint64 msecs)
|
QDeadlineTimer &operator-=(qint64 msecs)
|
||||||
{ *this = *this + (-msecs); return *this; }
|
{ *this = *this + (-msecs); return *this; }
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>) || defined(Q_CLANG_QDOC)
|
#if __has_include(<chrono>) || defined(Q_CLANG_QDOC)
|
||||||
template <class Clock, class Duration>
|
template <class Clock, class Duration>
|
||||||
QDeadlineTimer(std::chrono::time_point<Clock, Duration> deadline_,
|
QDeadlineTimer(std::chrono::time_point<Clock, Duration> deadline_,
|
||||||
Qt::TimerType type_ = Qt::CoarseTimer) : t2(0)
|
Qt::TimerType type_ = Qt::CoarseTimer) : t2(0)
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qobject_impl.h>
|
#include <QtCore/qobject_impl.h>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ public:
|
|||||||
void moveToThread(QThread *thread);
|
void moveToThread(QThread *thread);
|
||||||
|
|
||||||
int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
|
int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
Q_ALWAYS_INLINE
|
Q_ALWAYS_INLINE
|
||||||
int startTimer(std::chrono::milliseconds time, Qt::TimerType timerType = Qt::CoarseTimer)
|
int startTimer(std::chrono::milliseconds time, Qt::TimerType timerType = Qt::CoarseTimer)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include <QtCore/qbasictimer.h> // conceptual inheritance
|
#include <QtCore/qbasictimer.h> // conceptual inheritance
|
||||||
#include <QtCore/qobject.h>
|
#include <QtCore/qobject.h>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ Q_SIGNALS:
|
|||||||
void timeout(QPrivateSignal);
|
void timeout(QPrivateSignal);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC)
|
#if __has_include(<chrono>) || defined(Q_QDOC)
|
||||||
void setInterval(std::chrono::milliseconds value)
|
void setInterval(std::chrono::milliseconds value)
|
||||||
{
|
{
|
||||||
setInterval(int(value.count()));
|
setInterval(int(value.count()));
|
||||||
@ -223,7 +223,7 @@ private:
|
|||||||
static void singleShotImpl(int msec, Qt::TimerType timerType,
|
static void singleShotImpl(int msec, Qt::TimerType timerType,
|
||||||
const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj);
|
const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj);
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
static Qt::TimerType defaultTypeFor(std::chrono::milliseconds interval)
|
static Qt::TimerType defaultTypeFor(std::chrono::milliseconds interval)
|
||||||
{ return defaultTypeFor(int(interval.count())); }
|
{ return defaultTypeFor(int(interval.count())); }
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#include <QtCore/qbytearraylist.h>
|
#include <QtCore/qbytearraylist.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#elif defined(Q_CLANG_QDOC)
|
#elif defined(Q_CLANG_QDOC)
|
||||||
namespace std { template<typename...> struct variant; }
|
namespace std { template<typename...> struct variant; }
|
||||||
@ -370,7 +370,7 @@ class Q_CORE_EXPORT QVariant
|
|||||||
static inline QVariant fromValue(const T &value)
|
static inline QVariant fromValue(const T &value)
|
||||||
{ return QVariant(qMetaTypeId<T>(), &value, QTypeInfo<T>::isPointer); }
|
{ return QVariant(qMetaTypeId<T>(), &value, QTypeInfo<T>::isPointer); }
|
||||||
|
|
||||||
#if (QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L) || defined(Q_CLANG_QDOC)
|
#if (__has_include(<variant>) && __cplusplus >= 201703L) || defined(Q_CLANG_QDOC)
|
||||||
template<typename... Types>
|
template<typename... Types>
|
||||||
static inline QVariant fromStdVariant(const std::variant<Types...> &value)
|
static inline QVariant fromStdVariant(const std::variant<Types...> &value)
|
||||||
{
|
{
|
||||||
@ -544,7 +544,7 @@ inline QVariant QVariant::fromValue(const QVariant &value)
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||||
template<>
|
template<>
|
||||||
inline QVariant QVariant::fromValue(const std::monostate &)
|
inline QVariant QVariant::fromValue(const std::monostate &)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ public:
|
|||||||
bool contains(const QCborValue &value) const;
|
bool contains(const QCborValue &value) const;
|
||||||
|
|
||||||
int compare(const QCborArray &other) const noexcept Q_DECL_PURE_FUNCTION;
|
int compare(const QCborArray &other) const noexcept Q_DECL_PURE_FUNCTION;
|
||||||
#if 0 && QT_HAS_INCLUDE(<compare>)
|
#if 0 && __has_include(<compare>)
|
||||||
std::strong_ordering operator<=>(const QCborArray &other) const
|
std::strong_ordering operator<=>(const QCborArray &other) const
|
||||||
{
|
{
|
||||||
int c = compare(other);
|
int c = compare(other);
|
||||||
|
@ -245,7 +245,7 @@ public:
|
|||||||
{ const_iterator it = find(key); return it != end(); }
|
{ const_iterator it = find(key); return it != end(); }
|
||||||
|
|
||||||
int compare(const QCborMap &other) const noexcept Q_DECL_PURE_FUNCTION;
|
int compare(const QCborMap &other) const noexcept Q_DECL_PURE_FUNCTION;
|
||||||
#if 0 && QT_HAS_INCLUDE(<compare>)
|
#if 0 && __has_include(<compare>)
|
||||||
std::strong_ordering operator<=>(const QCborMap &other) const
|
std::strong_ordering operator<=>(const QCborMap &other) const
|
||||||
{
|
{
|
||||||
int c = compare(other);
|
int c = compare(other);
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
# undef False
|
# undef False
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 && QT_HAS_INCLUDE(<compare>)
|
#if 0 && __has_include(<compare>)
|
||||||
# include <compare>
|
# include <compare>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ public:
|
|||||||
QCborValueRef operator[](const QString & key);
|
QCborValueRef operator[](const QString & key);
|
||||||
|
|
||||||
int compare(const QCborValue &other) const;
|
int compare(const QCborValue &other) const;
|
||||||
#if 0 && QT_HAS_INCLUDE(<compare>)
|
#if 0 && __has_include(<compare>)
|
||||||
std::strong_ordering operator<=>(const QCborValue &other) const
|
std::strong_ordering operator<=>(const QCborValue &other) const
|
||||||
{
|
{
|
||||||
int c = compare(other);
|
int c = compare(other);
|
||||||
@ -411,7 +411,7 @@ public:
|
|||||||
|
|
||||||
int compare(const QCborValue &other) const
|
int compare(const QCborValue &other) const
|
||||||
{ return concrete().compare(other); }
|
{ return concrete().compare(other); }
|
||||||
#if 0 && QT_HAS_INCLUDE(<compare>)
|
#if 0 && __has_include(<compare>)
|
||||||
std::strong_ordering operator<=>(const QCborValue &other) const
|
std::strong_ordering operator<=>(const QCborValue &other) const
|
||||||
{
|
{
|
||||||
int c = compare(other);
|
int c = compare(other);
|
||||||
|
@ -332,7 +332,7 @@ int qstricmp(const char *str1, const char *str2)
|
|||||||
return int(Incomplete);
|
return int(Incomplete);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__SSE4_1__) && !(defined(__SANITIZE_ADDRESS__) || QT_HAS_FEATURE(address_sanitizer))
|
#if defined(__SSE4_1__) && !(defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer))
|
||||||
enum { PageSize = 4096, PageMask = PageSize - 1 };
|
enum { PageSize = 4096, PageMask = PageSize - 1 };
|
||||||
const __m128i zero = _mm_setzero_si128();
|
const __m128i zero = _mm_setzero_si128();
|
||||||
forever {
|
forever {
|
||||||
|
@ -254,7 +254,7 @@ public:
|
|||||||
void chop(int n);
|
void chop(int n);
|
||||||
|
|
||||||
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
|
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
|
||||||
# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_CPP_ATTRIBUTE(nodiscard)
|
# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !__has_cpp_attribute(nodiscard)
|
||||||
// required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941
|
// required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941
|
||||||
# pragma push_macro("Q_REQUIRED_RESULT")
|
# pragma push_macro("Q_REQUIRED_RESULT")
|
||||||
# undef Q_REQUIRED_RESULT
|
# undef Q_REQUIRED_RESULT
|
||||||
|
@ -487,7 +487,7 @@ public:
|
|||||||
Q_REQUIRED_RESULT QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const;
|
Q_REQUIRED_RESULT QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const;
|
||||||
|
|
||||||
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
|
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC)
|
||||||
# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !QT_HAS_CPP_ATTRIBUTE(nodiscard)
|
# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !__has_cpp_attribute(nodiscard)
|
||||||
// required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941
|
// required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941
|
||||||
# pragma push_macro("Q_REQUIRED_RESULT")
|
# pragma push_macro("Q_REQUIRED_RESULT")
|
||||||
# undef Q_REQUIRED_RESULT
|
# undef Q_REQUIRED_RESULT
|
||||||
|
@ -81,7 +81,7 @@ QT_END_NAMESPACE
|
|||||||
// if not defined in linux/futex.h
|
// if not defined in linux/futex.h
|
||||||
# define FUTEX_PRIVATE_FLAG 128 // added in v2.6.22
|
# define FUTEX_PRIVATE_FLAG 128 // added in v2.6.22
|
||||||
|
|
||||||
# if QT_HAS_FEATURE(thread_sanitizer) || defined(__SANITIZE_THREAD__)
|
# if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)
|
||||||
# include <sanitizer/tsan_interface.h>
|
# include <sanitizer/tsan_interface.h>
|
||||||
inline void _q_tsan_acquire(void *addr, void *addr2)
|
inline void _q_tsan_acquire(void *addr, void *addr2)
|
||||||
{
|
{
|
||||||
@ -98,7 +98,7 @@ inline void _q_tsan_release(void *addr, void *addr2)
|
|||||||
# else
|
# else
|
||||||
inline void _q_tsan_acquire(void *, void *) {}
|
inline void _q_tsan_acquire(void *, void *) {}
|
||||||
inline void _q_tsan_release(void *, void *) {}
|
inline void _q_tsan_release(void *, void *) {}
|
||||||
# endif // QT_HAS_FEATURE(thread_sanitizer) || defined(__SANITIZE_THREAD__)
|
# endif // __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__)
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace QtLinuxFutex {
|
namespace QtLinuxFutex {
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include <QtCore/qatomic.h>
|
#include <QtCore/qatomic.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
# include <limits>
|
# include <limits>
|
||||||
#endif
|
#endif
|
||||||
@ -147,7 +147,7 @@ public:
|
|||||||
// Lockable concept
|
// Lockable concept
|
||||||
bool try_lock() QT_MUTEX_LOCK_NOEXCEPT { return tryLock(); }
|
bool try_lock() QT_MUTEX_LOCK_NOEXCEPT { return tryLock(); }
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>) || defined(Q_CLANG_QDOC)
|
#if __has_include(<chrono>) || defined(Q_CLANG_QDOC)
|
||||||
// TimedLockable concept
|
// TimedLockable concept
|
||||||
template <class Rep, class Period>
|
template <class Rep, class Period>
|
||||||
bool try_lock_for(std::chrono::duration<Rep, Period> duration)
|
bool try_lock_for(std::chrono::duration<Rep, Period> duration)
|
||||||
@ -175,7 +175,7 @@ private:
|
|||||||
friend class QRecursiveMutex;
|
friend class QRecursiveMutex;
|
||||||
friend class ::tst_QMutex;
|
friend class ::tst_QMutex;
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
template<class Rep, class Period>
|
template<class Rep, class Period>
|
||||||
static int convertToMilliseconds(std::chrono::duration<Rep, Period> duration)
|
static int convertToMilliseconds(std::chrono::duration<Rep, Period> duration)
|
||||||
{
|
{
|
||||||
@ -213,7 +213,7 @@ public:
|
|||||||
using QMutex::tryLock;
|
using QMutex::tryLock;
|
||||||
using QMutex::unlock;
|
using QMutex::unlock;
|
||||||
using QMutex::try_lock;
|
using QMutex::try_lock;
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
using QMutex::try_lock_for;
|
using QMutex::try_lock_for;
|
||||||
using QMutex::try_lock_until;
|
using QMutex::try_lock_until;
|
||||||
#endif
|
#endif
|
||||||
@ -295,7 +295,7 @@ public:
|
|||||||
inline void unlock() noexcept {}
|
inline void unlock() noexcept {}
|
||||||
inline bool isRecursive() const noexcept { return true; }
|
inline bool isRecursive() const noexcept { return true; }
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
template <class Rep, class Period>
|
template <class Rep, class Period>
|
||||||
inline bool try_lock_for(std::chrono::duration<Rep, Period> duration) noexcept
|
inline bool try_lock_for(std::chrono::duration<Rep, Period> duration) noexcept
|
||||||
{
|
{
|
||||||
|
@ -535,7 +535,7 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
|
|||||||
# define QT_HAS_BUILTIN_CTZS
|
# define QT_HAS_BUILTIN_CTZS
|
||||||
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
|
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
|
||||||
{
|
{
|
||||||
# if QT_HAS_BUILTIN(__builtin_ctzs)
|
# if __has_builtin(__builtin_ctzs)
|
||||||
return __builtin_ctzs(v);
|
return __builtin_ctzs(v);
|
||||||
# else
|
# else
|
||||||
return __builtin_ctz(v);
|
return __builtin_ctz(v);
|
||||||
@ -544,7 +544,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept
|
|||||||
#define QT_HAS_BUILTIN_CLZS
|
#define QT_HAS_BUILTIN_CLZS
|
||||||
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
|
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept
|
||||||
{
|
{
|
||||||
# if QT_HAS_BUILTIN(__builtin_clzs)
|
# if __has_builtin(__builtin_clzs)
|
||||||
return __builtin_clzs(v);
|
return __builtin_clzs(v);
|
||||||
# else
|
# else
|
||||||
return __builtin_clz(v) - 16U;
|
return __builtin_clz(v) - 16U;
|
||||||
|
@ -51,7 +51,7 @@ template <typename F> QScopeGuard<F> qScopeGuard(F f);
|
|||||||
|
|
||||||
template <typename F>
|
template <typename F>
|
||||||
class
|
class
|
||||||
#if QT_HAS_CPP_ATTRIBUTE(nodiscard)
|
#if __has_cpp_attribute(nodiscard)
|
||||||
// Q_REQUIRED_RESULT can be defined as __warn_unused_result__ or as [[nodiscard]]
|
// Q_REQUIRED_RESULT can be defined as __warn_unused_result__ or as [[nodiscard]]
|
||||||
// but the 1st one has some limitations for example can be placed only on functions.
|
// but the 1st one has some limitations for example can be placed only on functions.
|
||||||
Q_REQUIRED_RESULT
|
Q_REQUIRED_RESULT
|
||||||
@ -91,7 +91,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
template <typename F>
|
template <typename F>
|
||||||
#if QT_HAS_CPP_ATTRIBUTE(nodiscard)
|
#if __has_cpp_attribute(nodiscard)
|
||||||
Q_REQUIRED_RESULT
|
Q_REQUIRED_RESULT
|
||||||
#endif
|
#endif
|
||||||
QScopeGuard<F> qScopeGuard(F f)
|
QScopeGuard<F> qScopeGuard(F f)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<stdbool.h>) || __STDC_VERSION__ >= 199901L
|
#if __has_include(<stdbool.h>) || __STDC_VERSION__ >= 199901L
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
#else
|
#else
|
||||||
# undef true
|
# undef true
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <QtCore/QElapsedTimer>
|
#include <QtCore/QElapsedTimer>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
# include <chrono>
|
# include <chrono>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ void tst_QDeadlineTimer::expire()
|
|||||||
|
|
||||||
void tst_QDeadlineTimer::stdchrono()
|
void tst_QDeadlineTimer::stdchrono()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("std::chrono not found on this system");
|
QSKIP("std::chrono not found on this system");
|
||||||
#else
|
#else
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
@ -223,7 +223,7 @@ void tst_QTimer::remainingTimeDuringActivation()
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::chrono::milliseconds to_ms(T t)
|
std::chrono::milliseconds to_ms(T t)
|
||||||
{ return std::chrono::duration_cast<std::chrono::milliseconds>(t); }
|
{ return std::chrono::duration_cast<std::chrono::milliseconds>(t); }
|
||||||
@ -233,7 +233,7 @@ namespace {
|
|||||||
|
|
||||||
void tst_QTimer::basic_chrono()
|
void tst_QTimer::basic_chrono()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires C++11 <chrono> support");
|
QSKIP("This test requires C++11 <chrono> support");
|
||||||
#else
|
#else
|
||||||
// duplicates zeroTimer, singleShotTimeout, interval and remainingTime
|
// duplicates zeroTimer, singleShotTimeout, interval and remainingTime
|
||||||
@ -871,7 +871,7 @@ void tst_QTimer::singleShotToFunctors()
|
|||||||
|
|
||||||
void tst_QTimer::singleShot_chrono()
|
void tst_QTimer::singleShot_chrono()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires C++11 <chrono> support");
|
QSKIP("This test requires C++11 <chrono> support");
|
||||||
#else
|
#else
|
||||||
// duplicates singleShotStaticFunctionZeroTimeout and singleShotToFunctors
|
// duplicates singleShotStaticFunctionZeroTimeout and singleShotToFunctors
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#endif
|
#endif
|
||||||
#include <QLinkedList>
|
#include <QLinkedList>
|
||||||
@ -4992,7 +4992,7 @@ void tst_QVariant::accessSequentialContainerKey()
|
|||||||
|
|
||||||
void tst_QVariant::fromStdVariant()
|
void tst_QVariant::fromStdVariant()
|
||||||
{
|
{
|
||||||
#if QT_HAS_INCLUDE(<variant>) && __cplusplus >= 201703L
|
#if __has_include(<variant>) && __cplusplus >= 201703L
|
||||||
{
|
{
|
||||||
typedef std::variant<int, bool> intorbool_t;
|
typedef std::variant<int, bool> intorbool_t;
|
||||||
intorbool_t stdvar = 5;
|
intorbool_t stdvar = 5;
|
||||||
|
@ -384,7 +384,7 @@ void tst_QCborValue::copyCompare()
|
|||||||
QCOMPARE(v, other);
|
QCOMPARE(v, other);
|
||||||
QVERIFY(!(v != other));
|
QVERIFY(!(v != other));
|
||||||
QVERIFY(!(v < other));
|
QVERIFY(!(v < other));
|
||||||
#if 0 && QT_HAS_INCLUDE(<compare>)
|
#if 0 && __has_include(<compare>)
|
||||||
QVERIFY(v <= other);
|
QVERIFY(v <= other);
|
||||||
QVERIFY(v >= other);
|
QVERIFY(v >= other);
|
||||||
QVERIFY(!(v > other));
|
QVERIFY(!(v > other));
|
||||||
|
@ -89,7 +89,7 @@ enum {
|
|||||||
waitTime = 100
|
waitTime = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_HAS_INCLUDE(<chrono>)
|
#if __has_include(<chrono>)
|
||||||
static Q_CONSTEXPR std::chrono::milliseconds waitTimeAsDuration(waitTime);
|
static Q_CONSTEXPR std::chrono::milliseconds waitTimeAsDuration(waitTime);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ void tst_QMutex::convertToMilliseconds_data()
|
|||||||
QTest::addColumn<qint64>("intValue");
|
QTest::addColumn<qint64>("intValue");
|
||||||
QTest::addColumn<qint64>("expected");
|
QTest::addColumn<qint64>("expected");
|
||||||
|
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires <chrono>");
|
QSKIP("This test requires <chrono>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void tst_QMutex::convertToMilliseconds_data()
|
|||||||
|
|
||||||
void tst_QMutex::convertToMilliseconds()
|
void tst_QMutex::convertToMilliseconds()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires <chrono>");
|
QSKIP("This test requires <chrono>");
|
||||||
#else
|
#else
|
||||||
QFETCH(TimeUnit, unit);
|
QFETCH(TimeUnit, unit);
|
||||||
@ -325,7 +325,7 @@ void tst_QMutex::tryLock_non_recursive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tst_QMutex::try_lock_for_non_recursive() {
|
void tst_QMutex::try_lock_for_non_recursive() {
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires <chrono>");
|
QSKIP("This test requires <chrono>");
|
||||||
#else
|
#else
|
||||||
class Thread : public QThread
|
class Thread : public QThread
|
||||||
@ -454,7 +454,7 @@ void tst_QMutex::try_lock_for_non_recursive() {
|
|||||||
|
|
||||||
void tst_QMutex::try_lock_until_non_recursive()
|
void tst_QMutex::try_lock_until_non_recursive()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires <chrono>");
|
QSKIP("This test requires <chrono>");
|
||||||
#else
|
#else
|
||||||
class Thread : public QThread
|
class Thread : public QThread
|
||||||
@ -707,7 +707,7 @@ void tst_QMutex::tryLock_recursive()
|
|||||||
|
|
||||||
void tst_QMutex::try_lock_for_recursive()
|
void tst_QMutex::try_lock_for_recursive()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires <chrono>");
|
QSKIP("This test requires <chrono>");
|
||||||
#else
|
#else
|
||||||
class Thread : public QThread
|
class Thread : public QThread
|
||||||
@ -836,7 +836,7 @@ void tst_QMutex::try_lock_for_recursive()
|
|||||||
|
|
||||||
void tst_QMutex::try_lock_until_recursive()
|
void tst_QMutex::try_lock_until_recursive()
|
||||||
{
|
{
|
||||||
#if !QT_HAS_INCLUDE(<chrono>)
|
#if !__has_include(<chrono>)
|
||||||
QSKIP("This test requires <chrono>");
|
QSKIP("This test requires <chrono>");
|
||||||
#else
|
#else
|
||||||
class Thread : public QThread
|
class Thread : public QThread
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#ifdef Q_CC_MSVC
|
#ifdef Q_CC_MSVC
|
||||||
#define COMPILER_HAS_STDLIB_INCLUDE(x) 1
|
#define COMPILER_HAS_STDLIB_INCLUDE(x) 1
|
||||||
#else
|
#else
|
||||||
#define COMPILER_HAS_STDLIB_INCLUDE(x) QT_HAS_INCLUDE(x)
|
#define COMPILER_HAS_STDLIB_INCLUDE(x) __has_include(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>)
|
#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
#include <QtCore/private/qmemory_p.h>
|
#include <QtCore/private/qmemory_p.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#if QT_HAS_INCLUDE(<shared_mutex>)
|
#if __has_include(<shared_mutex>)
|
||||||
#if __cplusplus > 201103L
|
#if __cplusplus > 201103L
|
||||||
#include <shared_mutex>
|
#include <shared_mutex>
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user