Commit 6d0edc12 authored by Volker Krause's avatar Volker Krause
Browse files

Remove the std::auto_ptr and std::unique_ptr payload checks

Now that we depend on C++17 std::auto_ptr doesn't exist anymore and thus
also cannot accidentally be put into an item payload.

The check for std::unique_ptr is unnecessary as it's not copyable (unlike
std::auto_ptr or a raw pointer), and as such will neither succeed to
compile with the item payload template code, nor will it be able to be
declared as a Qt metatype which is required for that.
parent 69df5152
Pipeline #59046 passed with stage
in 11 minutes and 46 seconds
......@@ -111,10 +111,9 @@ void ItemHydra::testItemPointerPayload()
// the below should not compile
// f.setPayload( rudi );
// std::auto_ptr is not copyconstructable and assignable, therefore this will fail as well
// f.setPayload( std::auto_ptr<Rudi>( rudi ) );
// f.setPayload( std::unique_ptr<Rudi>( rudi ) );
// QVERIFY( f.hasPayload() );
// QCOMPARE( f.payload< std::auto_ptr<Rudi> >()->who, rudi->who );
// QCOMPARE( f.payload< std::unique_ptr<Rudi> >()->who, rudi->who );
// below doesn't compile, hopefully
// QCOMPARE( f.payload< Rudi* >()->who, rudi->who );
......
......@@ -564,30 +564,6 @@ public:
template<typename T> void setPayload(const T &p);
/// @cond PRIVATE
template<typename T> void setPayload(T *p);
// We know that auto_ptr is deprecated, but we still want to handle the case
// without compilers yelling at us all the time just because item.h gets included
// virtually everywhere
#if __cplusplus < 201703L
#ifdef __GNUC__
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
template<typename T> void setPayload(std::auto_ptr<T> p);
#ifdef __GNUC__
#ifdef __clang__
#pragma clang diagnostic pop
#else
#pragma GCC diagnostic pop
#endif
#endif
#endif
template<typename T> void setPayload(std::unique_ptr<T> p);
/// @endcond
/**
......@@ -954,34 +930,6 @@ template<typename T> void Item::setPayload(T *p)
p->You_MUST_NOT_use_a_pointer_as_payload;
}
#if __cplusplus < 201703L
#ifdef __GNUC__
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
template<typename T> void Item::setPayload(std::auto_ptr<T> p)
{
p.Nice_try_but_a_std_auto_ptr_is_not_allowed_as_payload_either;
}
#ifdef __GNUC__
#ifdef __clang__
#pragma clang diagnostic pop
#else
#pragma GCC diagnostic pop
#endif
#endif
#endif
template<typename T> void Item::setPayload(std::unique_ptr<T> p)
{
p.Nope_even_std_unique_ptr_is_not_allowed;
}
} // namespace Akonadi
Q_DECLARE_METATYPE(Akonadi::Item)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment