Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some clang/gcc warnings found integrating qtpromise #39

Merged
merged 10 commits into from
Oct 26, 2020
8 changes: 4 additions & 4 deletions src/qtpromise/qpromise_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static void qtpromise_defer(F&& f, const QPointer<QThread>& thread)
{
Event(FType&& f) : QEvent{QEvent::None}, m_f{std::move(f)} { }
Event(const FType& f) : QEvent{QEvent::None}, m_f{f} { }
~Event() { m_f(); }
~Event() override { m_f(); }
FType m_f;
};

Expand Down Expand Up @@ -113,7 +113,7 @@ class PromiseError

PromiseError() { }
PromiseError(const std::exception_ptr& exception) : m_data{exception} { }
void rethrow() const { std::rethrow_exception(m_data); }
Q_NORETURN void rethrow() const { std::rethrow_exception(m_data); }
bool isNull() const { return m_data == nullptr; }

private:
Expand Down Expand Up @@ -329,8 +329,8 @@ struct PromiseCatcher
return [=](const PromiseError& error) {
try {
error.rethrow();
} catch (const TArg& error) {
PromiseDispatch<ResType>::call(resolve, reject, handler, error);
} catch (const TArg& argError) {
PromiseDispatch<ResType>::call(resolve, reject, handler, argError);
} catch (...) {
reject(std::current_exception());
}
Expand Down
10 changes: 10 additions & 0 deletions src/qtpromise/qpromiseglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,14 @@ struct ArgsOf<R (T::*)(Args...) const volatile> : public ArgsTraits<Args...>

} // namespace QtPromisePrivate


// qtpromise still supports MSVC 2013 on CI/CD
// -> MSVC 2013 does not support N2761, hence we need to wrap the noreturn attribute
#if defined(_MSVC) && (_MSVC <= 1800)
#define NO_RETURN
ssproessig marked this conversation as resolved.
Show resolved Hide resolved
#else
#define NO_RETURN [[ noreturn ]]
#endif


#endif // QTPROMISE_QPROMISEGLOBAL_H