QThread: Refine check for presence of std::future

MinGW with win32 threads might not have _GLIBCXX_HAS_GTHREADS, so it
needs to be checked.

Amends change 597d4ff796.

Change-Id: I5c91d1dd3967c4922ced315b475d653b8b102ad6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Friedemann Kleint 2017-05-18 10:01:58 +02:00
parent 40206a9f6d
commit afab37a4de

View File

@ -43,11 +43,15 @@
#include <QtCore/qobject.h>
// The implementation of QThread::create uses various C++14/C++17 facilities;
// we must check for their presence. For std::async (used in all codepaths)
// we must check for their presence. Specifically for glibcxx bundled in MinGW
// with win32 threads, we check the condition found in its <future> header
// since _GLIBCXX_HAS_GTHREADS might then not be defined.
// For std::async (used in all codepaths)
// there is no SG10 feature macro; just test for the header presence.
// For the C++17 codepath do some more throughout checks for std::invoke and
// C++14 lambdas availability.
#if QT_HAS_INCLUDE(<future>)
#if QT_HAS_INCLUDE(<future>) \
&& (!defined(__GLIBCXX__) || (defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)))
# define QTHREAD_HAS_CREATE
# include <future> // for std::async
# include <functional> // for std::invoke; no guard needed as it's a C++98 header