From d2081e8b61bbe982f4e0977c2b46e00ccf19732f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 14 Oct 2016 09:10:01 +0200 Subject: CppunitTest_desktop_lib: fix loplugin:cppunitassertequals warnings And also address a few new warnings in sal, plus silence such warnings in salhelper till we can't print typeids out of the box. Change-Id: I38049146710b6885f6a874bf74eedbc38b4d4651 Reviewed-on: https://gerrit.libreoffice.org/29809 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- salhelper/qa/test_api.cxx | 88 +++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'salhelper') diff --git a/salhelper/qa/test_api.cxx b/salhelper/qa/test_api.cxx index 4a73b63d273b..33a3c9400cba 100644 --- a/salhelper/qa/test_api.cxx +++ b/salhelper/qa/test_api.cxx @@ -110,14 +110,14 @@ void Test::testCondition() { osl::Mutex mutex; std::unique_ptr< salhelper::Condition > p(new DerivedCondition(mutex)); CPPUNIT_ASSERT(typeid (*p.get()) != typeid (salhelper::Condition)); - CPPUNIT_ASSERT(typeid (p.get()) == typeid (salhelper::Condition *)); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT(bool(typeid (p.get()) == typeid (salhelper::Condition *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::Condition const * >(p.get())) - == typeid (salhelper::Condition const *)); - CPPUNIT_ASSERT( + == typeid (salhelper::Condition const *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::Condition volatile * >(p.get())) - == typeid (salhelper::Condition volatile *)); - CPPUNIT_ASSERT(typeid (salhelper::Condition *) == getConditionTypeInfo()); + == typeid (salhelper::Condition volatile *))); + CPPUNIT_ASSERT(bool(typeid (salhelper::Condition *) == getConditionTypeInfo())); } #ifdef _MSC_VER @@ -129,45 +129,45 @@ void Test::testCondition() { void Test::testConditionModifier() { salhelper::ConditionModifier * p = nullptr; - CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionModifier)); - CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionModifier *)); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT(bool(typeid (*p) == typeid (salhelper::ConditionModifier))); + CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ConditionModifier *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ConditionModifier const * >(p)) - == typeid (salhelper::ConditionModifier const *)); - CPPUNIT_ASSERT( + == typeid (salhelper::ConditionModifier const *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ConditionModifier volatile * >(p)) - == typeid (salhelper::ConditionModifier volatile *)); - CPPUNIT_ASSERT( + == typeid (salhelper::ConditionModifier volatile *))); + CPPUNIT_ASSERT(bool( typeid (salhelper::ConditionModifier *) - == getConditionModifierTypeInfo()); + == getConditionModifierTypeInfo())); } void Test::testConditionWaiter() { salhelper::ConditionWaiter * p = nullptr; - CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionWaiter)); - CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionWaiter *)); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT(bool(typeid (*p) == typeid (salhelper::ConditionWaiter))); + CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ConditionWaiter *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ConditionWaiter const * >(p)) - == typeid (salhelper::ConditionWaiter const *)); - CPPUNIT_ASSERT( + == typeid (salhelper::ConditionWaiter const *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ConditionWaiter volatile * >(p)) - == typeid (salhelper::ConditionWaiter volatile *)); - CPPUNIT_ASSERT( - typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo()); + == typeid (salhelper::ConditionWaiter volatile *))); + CPPUNIT_ASSERT(bool( + typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo())); } void Test::testConditionWaiterTimedout() { salhelper::ConditionWaiter::timedout x; - CPPUNIT_ASSERT(typeid (x) == typeid (salhelper::ConditionWaiter::timedout)); - CPPUNIT_ASSERT( - typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *)); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT(bool(typeid (x) == typeid (salhelper::ConditionWaiter::timedout))); + CPPUNIT_ASSERT(bool( + typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ConditionWaiter::timedout const * >(&x)) - == typeid (salhelper::ConditionWaiter::timedout const *)); - CPPUNIT_ASSERT( + == typeid (salhelper::ConditionWaiter::timedout const *))); + CPPUNIT_ASSERT(bool( (typeid (const_cast< salhelper::ConditionWaiter::timedout volatile * >(&x))) - == typeid (salhelper::ConditionWaiter::timedout volatile *)); + == typeid (salhelper::ConditionWaiter::timedout volatile *))); try { throw salhelper::ConditionWaiter::timedout(); } catch (salhelper::ConditionWaiter::timedout &) { @@ -179,16 +179,16 @@ void Test::testConditionWaiterTimedout() { void Test::testORealDynamicLoader() { salhelper::ORealDynamicLoader * p = nullptr; CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader)); - CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ORealDynamicLoader *)); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ORealDynamicLoader *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ORealDynamicLoader const * >(p)) - == typeid (salhelper::ORealDynamicLoader const *)); - CPPUNIT_ASSERT( + == typeid (salhelper::ORealDynamicLoader const *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::ORealDynamicLoader volatile * >(p)) - == typeid (salhelper::ORealDynamicLoader volatile *)); - CPPUNIT_ASSERT( + == typeid (salhelper::ORealDynamicLoader volatile *))); + CPPUNIT_ASSERT(bool( typeid (salhelper::ORealDynamicLoader *) - == getORealDynamicLoaderTypeInfo()); + == getORealDynamicLoaderTypeInfo())); } #ifdef _MSC_VER @@ -200,18 +200,18 @@ void Test::testSimpleReferenceObject() { try { CPPUNIT_ASSERT( typeid (*p) != typeid (salhelper::SimpleReferenceObject)); - CPPUNIT_ASSERT( - typeid (p) == typeid (salhelper::SimpleReferenceObject *)); - CPPUNIT_ASSERT( + CPPUNIT_ASSERT(bool( + typeid (p) == typeid (salhelper::SimpleReferenceObject *))); + CPPUNIT_ASSERT(bool( typeid (const_cast< salhelper::SimpleReferenceObject const * >(p)) - == typeid (salhelper::SimpleReferenceObject const *)); - CPPUNIT_ASSERT( + == typeid (salhelper::SimpleReferenceObject const *))); + CPPUNIT_ASSERT(bool( (typeid (const_cast< salhelper::SimpleReferenceObject volatile * >(p))) - == typeid (salhelper::SimpleReferenceObject volatile *)); - CPPUNIT_ASSERT( + == typeid (salhelper::SimpleReferenceObject volatile *))); + CPPUNIT_ASSERT(bool( typeid (salhelper::SimpleReferenceObject *) - == getSimpleReferenceObjectTypeInfo()); + == getSimpleReferenceObjectTypeInfo())); } catch (...) { delete static_cast< DerivedSimpleReferenceObject * >(p); throw; -- cgit v1.2.3