Add compilation test instead of VxWorks check
`<future>` is explicitly excluded for VxWork, because enabling it causes compilation error when building tests (and causes some serious issues when trying to naively work-arond this compilation problem). When forcing `QT_FEATURE_cxx11_future` on VxWorks, failure occurs: ``` qtbase/src/corelib/thread/qthread.h:125:19: error: no matching function for call to 'invoke' 125 | (void)std::invoke(std::move(f), std::forward<decltype(largs)>(largs)...); | ^~~~~~~~~~~ [...] qtbase/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp:32:45: note: in instantiation of function template specialization 'QThread::create<(lambda at qtbase/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp:32:52), QPromise<int>>' requested here 32 | QScopedPointer<QThread> thread(QThread::create([] (QPromise<int> promise) { | ^ VSB/usr/h/public/type_traits:2720:7: note: candidate template ignored: substitution failure [with _Callable = remove_reference_t<(lambda at qtbase/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp:32:52) &>, _Types = <QPromise<int> &>]: no matching function for call to '_Call' 2720 | auto invoke(_Callable&& _Obj, _Types&&... _Args) noexcept(noexcept(_Invoker<_Callable, _Types...>::_Call( | ^ 2721 | _STD forward<_Callable>(_Obj), _STD forward<_Types>(_Args)...))) 2722 | -> decltype(_Invoker<_Callable, _Types...>::_Call( | ~~~~~~~~ ``` Instead of excluding cxx11_future on VxWorks explicitly, replace condition with actual check which should pass in non-VxWorks 24.03 (or older) standard libraries. VxWorks in version 24.03 fails this test due to std::async improperly forwards argument type to lambda, which causes compilation error when argument type is a non-copiable value type. This is a problem in VxWorks standard library, which could be fixed in future versions of this OS, so keeping this as a test should unlock `<future>` header once it's fixed. Task-number: QTBUG-115777 Change-Id: Ic67df9be2e95dce999689eaea146f113017ab4f3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit ced943e936e335a16e9b479a2010e5bbee1af4f1)
This commit is contained in:
parent
a4118e8b2a
commit
6b2103960c
@ -411,6 +411,34 @@ int main(void)
|
|||||||
}
|
}
|
||||||
")
|
")
|
||||||
|
|
||||||
|
# <future>
|
||||||
|
qt_config_compile_test(cxx_std_async_noncopyable
|
||||||
|
LABEL "std::async() NonCopyable"
|
||||||
|
CODE
|
||||||
|
"// Calling std::async with lambda which takes non-copyable argument causes compilation error on
|
||||||
|
// some platforms (VxWorks 24.03 and older with C++17-compatibility for example)
|
||||||
|
#include <future>
|
||||||
|
|
||||||
|
class NonCopyable {
|
||||||
|
public:
|
||||||
|
NonCopyable(const NonCopyable&) = delete;
|
||||||
|
NonCopyable(NonCopyable&&) = default;
|
||||||
|
|
||||||
|
NonCopyable(int value)
|
||||||
|
:value (value)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int value;
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
return std::async(
|
||||||
|
std::launch::deferred,
|
||||||
|
[](NonCopyable value) { return value.value; },
|
||||||
|
NonCopyable(argc - 1)).get();
|
||||||
|
}
|
||||||
|
")
|
||||||
|
|
||||||
#### Features
|
#### Features
|
||||||
|
|
||||||
qt_feature("clock-gettime" PRIVATE
|
qt_feature("clock-gettime" PRIVATE
|
||||||
@ -439,7 +467,7 @@ qt_feature("system-doubleconversion" PRIVATE
|
|||||||
)
|
)
|
||||||
qt_feature("cxx11_future" PUBLIC
|
qt_feature("cxx11_future" PUBLIC
|
||||||
LABEL "C++11 <future>"
|
LABEL "C++11 <future>"
|
||||||
CONDITION ON
|
CONDITION TEST_cxx_std_async_noncopyable
|
||||||
)
|
)
|
||||||
qt_feature("cxx17_filesystem" PUBLIC
|
qt_feature("cxx17_filesystem" PUBLIC
|
||||||
LABEL "C++17 <filesystem>"
|
LABEL "C++17 <filesystem>"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user