diff options
author | surmeh01 <surabhi.mehta@arm.com> | 2018-05-18 16:31:43 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-05-23 13:09:07 +0100 |
commit | 3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 (patch) | |
tree | 5950603ad78ec3fe56fb31ddc7f4d52a19f5bc60 /src/armnn/Layer.hpp | |
parent | bceff2fb3fc68bb0aa88b886900c34b77340c826 (diff) | |
download | armnn-3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0.tar.gz |
Release 18.05
Diffstat (limited to 'src/armnn/Layer.hpp')
-rw-r--r-- | src/armnn/Layer.hpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/armnn/Layer.hpp b/src/armnn/Layer.hpp index f9f2f22bea..2a199afc24 100644 --- a/src/armnn/Layer.hpp +++ b/src/armnn/Layer.hpp @@ -20,6 +20,7 @@ #include <memory> #include <string> #include <vector> +#include <iostream> #include <boost/numeric/conversion/cast.hpp> #include <boost/core/ignore_unused.hpp> @@ -85,7 +86,19 @@ public: ~OutputSlot() { - DisconnectAll(); + try + { + // Coverity fix: DisconnectAll() may throw uncaught exceptions. + DisconnectAll(); + } + catch (const std::exception& e) + { + // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an + // exception of type std::length_error. + // Using stderr instead in this context as there is no point in nesting try-catch blocks here. + std::cerr << "WARNING: An error has occurred when disconnecting all output slots: " + << e.what() << std::endl; + } } Layer& GetOwningLayer() const { return m_OwningLayer; } @@ -140,7 +153,19 @@ inline InputSlot::~InputSlot() { if (m_Connection != nullptr) { - m_Connection->Disconnect(*this); + try + { + // Coverity fix: Disconnect() may throw uncaught exceptions. + m_Connection->Disconnect(*this); + } + catch (const std::exception& e) + { + // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an + // exception of type std::length_error. + // Using stderr instead in this context as there is no point in nesting try-catch blocks here. + std::cerr << "WARNING: An error has occurred when disconnecting an input slot: " + << e.what() << std::endl; + } } } @@ -221,7 +246,7 @@ public: /// Helper to serialize the layer parameters to string /// (currently used in DotSerializer and company) - virtual void SerializeLayerParameters(ParameterStringifyFunction & fn) const {} + virtual void SerializeLayerParameters(ParameterStringifyFunction &) const {} // IConnectableLayer |