From afab37a4de76bcf2d0c0daf847c035b1570e9271 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 May 2017 10:01:58 +0200 Subject: [PATCH] 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 597d4ff7962c0add87e4b93da4c366503d11aff5. Change-Id: I5c91d1dd3967c4922ced315b475d653b8b102ad6 Reviewed-by: Giuseppe D'Angelo --- src/corelib/thread/qthread.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index a061394deb..5e6f216219 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -43,11 +43,15 @@ #include // 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 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() +#if QT_HAS_INCLUDE() \ + && (!defined(__GLIBCXX__) || (defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1))) # define QTHREAD_HAS_CREATE # include // for std::async # include // for std::invoke; no guard needed as it's a C++98 header