From 1dd75b3ce83b9adf611116d9247f7860951d8ed9 Mon Sep 17 00:00:00 2001 From: Derek Lamberti Date: Tue, 10 Dec 2019 21:23:23 +0000 Subject: IVGCVSW-4246 Clean build profiling with -Wextra Change-Id: Ieab870fa2194075433a0a26abdb13f69e1fbaaae Signed-off-by: Derek Lamberti --- src/profiling/CommandHandlerFunctor.hpp | 4 +++- src/profiling/FileOnlyProfilingConnection.cpp | 2 ++ src/profiling/PacketVersionResolver.cpp | 3 +++ src/profiling/ProfilingStateMachine.hpp | 3 +++ src/profiling/test/ProfilingTests.cpp | 15 +++------------ src/profiling/test/ProfilingTests.hpp | 9 ++++++++- src/profiling/test/SendCounterPacketTests.hpp | 16 ++++++++++++++-- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/profiling/CommandHandlerFunctor.hpp b/src/profiling/CommandHandlerFunctor.hpp index 4d6dfa080a..ea76d10141 100644 --- a/src/profiling/CommandHandlerFunctor.hpp +++ b/src/profiling/CommandHandlerFunctor.hpp @@ -7,6 +7,8 @@ #include +#include + namespace armnn { @@ -28,7 +30,7 @@ public: uint32_t GetPacketId() const; uint32_t GetVersion() const; - virtual void operator()(const Packet& packet) {} + virtual void operator()(const Packet& packet) = 0; virtual ~CommandHandlerFunctor() {} diff --git a/src/profiling/FileOnlyProfilingConnection.cpp b/src/profiling/FileOnlyProfilingConnection.cpp index 004e27d30a..75862616b9 100644 --- a/src/profiling/FileOnlyProfilingConnection.cpp +++ b/src/profiling/FileOnlyProfilingConnection.cpp @@ -40,6 +40,8 @@ void FileOnlyProfilingConnection::Close() bool FileOnlyProfilingConnection::WaitForStreamMeta(const unsigned char* buffer, uint32_t length) { + boost::ignore_unused(length); + // The first word, stream_metadata_identifer, should always be 0. if (ToUint32(buffer, TargetEndianness::BeWire) != 0) { diff --git a/src/profiling/PacketVersionResolver.cpp b/src/profiling/PacketVersionResolver.cpp index 3737e3cfca..869f09e635 100644 --- a/src/profiling/PacketVersionResolver.cpp +++ b/src/profiling/PacketVersionResolver.cpp @@ -5,6 +5,8 @@ #include "PacketVersionResolver.hpp" +#include + namespace armnn { @@ -52,6 +54,7 @@ bool PacketKey::operator!=(const PacketKey& rhs) const Version PacketVersionResolver::ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const { + boost::ignore_unused(familyId, packetId); // NOTE: For now every packet specification is at version 1.0.0 return Version(1, 0, 0); } diff --git a/src/profiling/ProfilingStateMachine.hpp b/src/profiling/ProfilingStateMachine.hpp index d070744b1b..160de71bbe 100644 --- a/src/profiling/ProfilingStateMachine.hpp +++ b/src/profiling/ProfilingStateMachine.hpp @@ -7,6 +7,8 @@ #include +#include + namespace armnn { @@ -33,6 +35,7 @@ public: bool IsOneOfStates(ProfilingState state1) { + boost::ignore_unused(state1); return false; } diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 647870ac13..1519cd42fd 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -718,7 +718,6 @@ BOOST_AUTO_TEST_CASE(CheckProfilingObjectUids) std::vector counterUids; BOOST_CHECK_NO_THROW(counterUids = GetNextCounterUids(uid,0)); BOOST_CHECK(counterUids.size() == 1); - BOOST_CHECK(counterUids[0] >= 0); std::vector nextCounterUids; BOOST_CHECK_NO_THROW(nextCounterUids = GetNextCounterUids(nextUid, 2)); @@ -1318,7 +1317,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) "valid description")); BOOST_CHECK(counterDirectory.GetCounterCount() == 1); BOOST_CHECK(counter); - BOOST_CHECK(counter->m_Uid >= 0); BOOST_CHECK(counter->m_MaxCounterUid == counter->m_Uid); BOOST_CHECK(counter->m_Class == 0); BOOST_CHECK(counter->m_Interpolation == 1); @@ -1360,7 +1358,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) std::string("Mnnsq2"))); // Units BOOST_CHECK(counterDirectory.GetCounterCount() == 2); BOOST_CHECK(counterWUnits); - BOOST_CHECK(counterWUnits->m_Uid >= 0); BOOST_CHECK(counterWUnits->m_Uid > counter->m_Uid); BOOST_CHECK(counterWUnits->m_MaxCounterUid == counterWUnits->m_Uid); BOOST_CHECK(counterWUnits->m_Class == 0); @@ -1389,7 +1386,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) 0)); // Device UID BOOST_CHECK(counterDirectory.GetCounterCount() == 3); BOOST_CHECK(counterWoDevice); - BOOST_CHECK(counterWoDevice->m_Uid >= 0); BOOST_CHECK(counterWoDevice->m_Uid > counter->m_Uid); BOOST_CHECK(counterWoDevice->m_MaxCounterUid == counterWoDevice->m_Uid); BOOST_CHECK(counterWoDevice->m_Class == 0); @@ -1444,7 +1440,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) device->m_Uid)); // Device UID BOOST_CHECK(counterDirectory.GetCounterCount() == 4); BOOST_CHECK(counterWDevice); - BOOST_CHECK(counterWDevice->m_Uid >= 0); BOOST_CHECK(counterWDevice->m_Uid > counter->m_Uid); BOOST_CHECK(counterWDevice->m_MaxCounterUid == counterWDevice->m_Uid); BOOST_CHECK(counterWDevice->m_Class == 0); @@ -1474,7 +1469,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) 0)); // CounterSet UID BOOST_CHECK(counterDirectory.GetCounterCount() == 5); BOOST_CHECK(counterWoCounterSet); - BOOST_CHECK(counterWoCounterSet->m_Uid >= 0); BOOST_CHECK(counterWoCounterSet->m_Uid > counter->m_Uid); BOOST_CHECK(counterWoCounterSet->m_MaxCounterUid == counterWoCounterSet->m_Uid); BOOST_CHECK(counterWoCounterSet->m_Class == 0); @@ -1517,7 +1511,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) armnn::EmptyOptional())); // Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 20); BOOST_CHECK(counterWNumberOfCores); - BOOST_CHECK(counterWNumberOfCores->m_Uid >= 0); BOOST_CHECK(counterWNumberOfCores->m_Uid > counter->m_Uid); BOOST_CHECK(counterWNumberOfCores->m_MaxCounterUid == counterWNumberOfCores->m_Uid + numberOfCores - 1); BOOST_CHECK(counterWNumberOfCores->m_Class == 0); @@ -1556,7 +1549,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) armnn::EmptyOptional())); // Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 24); BOOST_CHECK(counterWMultiCoreDevice); - BOOST_CHECK(counterWMultiCoreDevice->m_Uid >= 0); BOOST_CHECK(counterWMultiCoreDevice->m_Uid > counter->m_Uid); BOOST_CHECK(counterWMultiCoreDevice->m_MaxCounterUid == counterWMultiCoreDevice->m_Uid + multiCoreDevice->m_Cores - 1); @@ -1603,7 +1595,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) armnn::EmptyOptional()));// Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 26); BOOST_CHECK(counterWMultiCoreDeviceWParentCategory); - BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Uid >= 0); BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Uid > counter->m_Uid); BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_MaxCounterUid == counterWMultiCoreDeviceWParentCategory->m_Uid + multiCoreDeviceWParentCategory->m_Cores - 1); @@ -1643,7 +1634,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) counterSet->m_Uid)); // Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 27); BOOST_CHECK(counterWCounterSet); - BOOST_CHECK(counterWCounterSet->m_Uid >= 0); BOOST_CHECK(counterWCounterSet->m_Uid > counter->m_Uid); BOOST_CHECK(counterWCounterSet->m_MaxCounterUid == counterWCounterSet->m_Uid); BOOST_CHECK(counterWCounterSet->m_Class == 0); @@ -1668,7 +1658,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) counterSet->m_Uid)); // Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 28); BOOST_CHECK(counterWDeviceWCounterSet); - BOOST_CHECK(counterWDeviceWCounterSet->m_Uid >= 0); BOOST_CHECK(counterWDeviceWCounterSet->m_Uid > counter->m_Uid); BOOST_CHECK(counterWDeviceWCounterSet->m_MaxCounterUid == counterWDeviceWCounterSet->m_Uid); BOOST_CHECK(counterWDeviceWCounterSet->m_Class == 0); @@ -1705,7 +1694,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) counterSet->m_Uid)); // Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 29); BOOST_CHECK(anotherCounter); - BOOST_CHECK(anotherCounter->m_Uid >= 0); BOOST_CHECK(anotherCounter->m_MaxCounterUid == anotherCounter->m_Uid); BOOST_CHECK(anotherCounter->m_Class == 1); BOOST_CHECK(anotherCounter->m_Interpolation == 0); @@ -1737,6 +1725,7 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData) { bool IsCounterRegistered(uint16_t counterUid) const override { + boost::ignore_unused(counterUid); return true; } uint16_t GetCounterCount() const override @@ -1745,6 +1734,7 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData) } uint32_t GetCounterValue(uint16_t counterUid) const override { + boost::ignore_unused(counterUid); return 0; } }; @@ -2109,6 +2099,7 @@ BOOST_AUTO_TEST_CASE(CheckPeriodicCounterCaptureThread) //not used bool IsCounterRegistered(uint16_t counterUid) const override { + boost::ignore_unused(counterUid); return false; } diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp index cfac691cff..208fb80865 100644 --- a/src/profiling/test/ProfilingTests.hpp +++ b/src/profiling/test/ProfilingTests.hpp @@ -75,7 +75,12 @@ public: void Close() override {} - bool WritePacket(const unsigned char* buffer, uint32_t length) override { return false; } + bool WritePacket(const unsigned char* buffer, uint32_t length) override + { + boost::ignore_unused(buffer, length); + + return false; + } Packet ReadPacket(uint32_t timeout) override { @@ -134,6 +139,7 @@ public: Packet ReadPacket(uint32_t timeout) override { + boost::ignore_unused(timeout); ++m_ReadRequests; throw armnn::Exception("Simulate a non-timeout error"); } @@ -156,6 +162,7 @@ public: void operator()(const Packet& packet) override { + boost::ignore_unused(packet); m_Count++; } diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 79ebcd6cba..d0b13b59c0 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -67,13 +67,15 @@ public: Packet ReadPacket(uint32_t timeout) override { + boost::ignore_unused(timeout); + // Simulate a delay in the reading process. The default timeout is way too long. std::this_thread::sleep_for(std::chrono::milliseconds(5)); std::lock_guard lock(m_Mutex); return std::move(m_Packet); } - const std::vector GetWrittenData() + std::vector GetWrittenData() { std::lock_guard lock(m_Mutex); @@ -82,7 +84,7 @@ public: return writtenData; } - const bool HasWrittenData() + bool HasWrittenData() const { std::lock_guard lock(m_Mutex); return !m_WrittenData.empty(); @@ -107,6 +109,7 @@ class MockProfilingConnectionFactory : public IProfilingConnectionFactory public: IProfilingConnectionPtr GetProfilingConnection(const ExternalProfilingOptions& options) const override { + boost::ignore_unused(options); return std::make_unique(); } }; @@ -295,6 +298,8 @@ public: void SendCounterDirectoryPacket(const ICounterDirectory& counterDirectory) override { + boost::ignore_unused(counterDirectory); + std::string message("SendCounterDirectoryPacket"); unsigned int reserved = 0; IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); @@ -305,6 +310,8 @@ public: void SendPeriodicCounterCapturePacket(uint64_t timestamp, const std::vector>& values) override { + boost::ignore_unused(timestamp, values); + std::string message("SendPeriodicCounterCapturePacket"); unsigned int reserved = 0; IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); @@ -315,6 +322,8 @@ public: void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod, const std::vector& selectedCounterIds) override { + boost::ignore_unused(capturePeriod, selectedCounterIds); + std::string message("SendPeriodicCounterSelectionPacket"); unsigned int reserved = 0; IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); @@ -515,16 +524,19 @@ public: const Device* GetDevice(uint16_t uid) const override { + boost::ignore_unused(uid); return nullptr; // Not used by the unit tests } const CounterSet* GetCounterSet(uint16_t uid) const override { + boost::ignore_unused(uid); return nullptr; // Not used by the unit tests } const Counter* GetCounter(uint16_t uid) const override { + boost::ignore_unused(uid); return nullptr; // Not used by the unit tests } -- cgit v1.2.1