diff options
-rw-r--r-- | include/vcl/vclptr.hxx | 4 | ||||
-rw-r--r-- | vcl/qa/cppunit/lifecycle.cxx | 40 |
2 files changed, 34 insertions, 10 deletions
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index 31f97dc50602..39e4fe918d52 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -295,7 +295,7 @@ template<typename T> inline bool operator !=(T * p1, VclPtr<T> const & p2) { * @param reference_type must be a subclass of vcl::Window */ template <class reference_type> -class VclPtrInstance : public VclPtr<reference_type> +class SAL_WARN_UNUSED VclPtrInstance : public VclPtr<reference_type> { public: template<typename... Arg> VclPtrInstance(Arg &&... arg) @@ -407,7 +407,7 @@ protected: #pragma warning(disable: 4521) // " multiple copy constructors specified" #endif template <class reference_type> -class ScopedVclPtrInstance : public ScopedVclPtr<reference_type> +class SAL_WARN_UNUSED ScopedVclPtrInstance : public ScopedVclPtr<reference_type> { public: template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg) diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index 0ec8b4cd17d8..67f2e9bce9db 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -92,18 +92,42 @@ void LifecycleTest::testMultiDispose() void LifecycleTest::testWidgets(vcl::Window *pParent) { - { ScopedVclPtrInstance< PushButton > aPtr( pParent ); } - { ScopedVclPtrInstance< OKButton > aPtr( pParent ); } - { ScopedVclPtrInstance< CancelButton > aPtr( pParent ); } - { ScopedVclPtrInstance< HelpButton > aPtr( pParent ); } + { + ScopedVclPtrInstance< PushButton > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } + { + ScopedVclPtrInstance< OKButton > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } + { + ScopedVclPtrInstance< CancelButton > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } + { + ScopedVclPtrInstance< HelpButton > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } // Some widgets really insist on adoption. if (pParent) { - { ScopedVclPtrInstance< CheckBox > aPtr( pParent ); } - { ScopedVclPtrInstance< Edit > aPtr( pParent ); } - { ScopedVclPtrInstance< ComboBox > aPtr( pParent ); } - { ScopedVclPtrInstance< RadioButton > aPtr( pParent ); } + { + ScopedVclPtrInstance< CheckBox > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } + { + ScopedVclPtrInstance< Edit > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } + { + ScopedVclPtrInstance< ComboBox > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } + { + ScopedVclPtrInstance< RadioButton > aPtr( pParent ); + (void)aPtr; // silence unused variable warning + } } } |