From c3bd5ffdc8a3b459f18ba6e35fca93e29f3b0ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 8 Dec 2019 23:47:10 +0100 Subject: 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 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qtimer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/kernel/qtimer.h') diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index eb7185c12d..6bbfd741d9 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -47,7 +47,7 @@ #include // conceptual inheritance #include -#if QT_HAS_INCLUDE() +#if __has_include() # include #endif @@ -177,7 +177,7 @@ Q_SIGNALS: void timeout(QPrivateSignal); public: -#if QT_HAS_INCLUDE() || defined(Q_QDOC) +#if __has_include() || defined(Q_QDOC) void setInterval(std::chrono::milliseconds value) { setInterval(int(value.count())); @@ -223,7 +223,7 @@ private: static void singleShotImpl(int msec, Qt::TimerType timerType, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj); -#if QT_HAS_INCLUDE() +#if __has_include() static Qt::TimerType defaultTypeFor(std::chrono::milliseconds interval) { return defaultTypeFor(int(interval.count())); } -- cgit v1.2.3