summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Macenauer <pavel.macenauer@linaro.org>2020-05-26 10:54:22 +0000
committerInki Dae <inki.dae@samsung.com>2020-07-27 15:06:43 +0900
commit633f559b23e583b8840c4867f5c35b515a0298c0 (patch)
tree412286891b12d12f298cecbc6bce6aa841d03a2a
parentde0d1ddea05a54a2769f3fc8ad6f760de0513250 (diff)
downloadarmnn-633f559b23e583b8840c4867f5c35b515a0298c0.tar.gz
armnn-633f559b23e583b8840c4867f5c35b515a0298c0.tar.bz2
armnn-633f559b23e583b8840c4867f5c35b515a0298c0.zip
Catch exceptions by const reference
Change-Id: I4b4d8ae419dfb8470e8937e75cd3bab85f03b935 Signed-off-by: Pavel Macenauer <pavel.macenauer@nxp.com> Back-ported from mainline. Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--python/pyarmnn/src/pyarmnn/swig/standard_header.i6
-rw-r--r--src/profiling/test/ProfilingTests.cpp2
-rw-r--r--tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp6
-rw-r--r--tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp4
-rw-r--r--tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp2
-rw-r--r--tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp22
6 files changed, 21 insertions, 21 deletions
diff --git a/python/pyarmnn/src/pyarmnn/swig/standard_header.i b/python/pyarmnn/src/pyarmnn/swig/standard_header.i
index b26cb0d39..a46981567 100644
--- a/python/pyarmnn/src/pyarmnn/swig/standard_header.i
+++ b/python/pyarmnn/src/pyarmnn/swig/standard_header.i
@@ -23,7 +23,7 @@
%exception{
try {
$action
- } catch (armnn::Exception &e) {
+ } catch (const armnn::Exception& e) {
SWIG_exception(SWIG_RuntimeError, const_cast<char*>(e.what()));
}
};
@@ -31,7 +31,7 @@
%exception __getitem__ {
try {
$action
- } catch (armnn::InvalidArgumentException &e) {
+ } catch (const armnn::InvalidArgumentException &e) {
SWIG_exception(SWIG_ValueError, const_cast<char*>(e.what()));
} catch (const std::out_of_range &e) {
SWIG_exception(SWIG_IndexError, const_cast<char*>(e.what()));
@@ -43,7 +43,7 @@
%exception __setitem__ {
try {
$action
- } catch (armnn::InvalidArgumentException &e) {
+ } catch (const armnn::InvalidArgumentException &e) {
SWIG_exception(SWIG_ValueError, const_cast<char*>(e.what()));
} catch (const std::out_of_range &e) {
SWIG_exception(SWIG_IndexError, const_cast<char*>(e.what()));
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index c541c8271..e3a49e48c 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -2088,7 +2088,7 @@ BOOST_AUTO_TEST_CASE(CheckSocketConnectionException2)
{
new SocketProfilingConnection();
}
- catch (armnnProfiling::SocketConnectionException& ex)
+ catch (const armnnProfiling::SocketConnectionException& ex)
{
BOOST_CHECK(ex.GetSocketFd() == 0);
BOOST_CHECK(ex.GetErrorNo() == 111);
diff --git a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
index 20f618070..85d757f82 100644
--- a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
+++ b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp
@@ -160,7 +160,7 @@ int main(int argc, char* argv[])
{
optimizedNet = armnn::Optimize(*network, computeDevice, runtime->GetDeviceSpec());
}
- catch (armnn::Exception& e)
+ catch (const armnn::Exception& e)
{
std::stringstream message;
message << "armnn::Exception (" << e.what() << ") caught from optimize.";
@@ -367,7 +367,7 @@ int main(int argc, char* argv[])
ARMNN_LOG(info) << "Accuracy Tool ran successfully!";
return 0;
}
- catch (armnn::Exception const & e)
+ catch (const armnn::Exception& e)
{
// Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
// exception of type std::length_error.
@@ -375,7 +375,7 @@ int main(int argc, char* argv[])
std::cerr << "Armnn Error: " << e.what() << std::endl;
return 1;
}
- catch (const std::exception & e)
+ catch (const std::exception& e)
{
// Coverity fix: various boost exceptions can be thrown by methods called by this test.
std::cerr << "WARNING: ModelAccuracyTool-Armnn: An error has occurred when running the "
diff --git a/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp b/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
index 0e72f7bc1..c80260130 100644
--- a/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
+++ b/tests/MultipleNetworksCifar10/MultipleNetworksCifar10.cpp
@@ -137,7 +137,7 @@ int main(int argc, char* argv[])
{
optimizedNet = armnn::Optimize(*network, computeDevice, runtime->GetDeviceSpec());
}
- catch (armnn::Exception& e)
+ catch (const armnn::Exception& e)
{
std::stringstream message;
message << "armnn::Exception ("<<e.what()<<") caught from optimize.";
@@ -216,7 +216,7 @@ int main(int argc, char* argv[])
ARMNN_LOG(info) << "Multiple networks inference ran successfully!";
return 0;
}
- catch (armnn::Exception const& e)
+ catch (const armnn::Exception& e)
{
// Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
// exception of type std::length_error.
diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
index ec0eaf90f..ff28eb4f3 100644
--- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
+++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
@@ -519,7 +519,7 @@ int MainImpl(const ExecuteNetworkParams& params,
}
}
}
- catch (armnn::Exception const& e)
+ catch (const armnn::Exception& e)
{
ARMNN_LOG(fatal) << "Armnn Error: " << e.what();
return EXIT_FAILURE;
diff --git a/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp b/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp
index c96d1f28d..1905e9002 100644
--- a/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp
+++ b/tests/TfLiteYoloV3Big-Armnn/TfLiteYoloV3Big-Armnn.cpp
@@ -28,17 +28,17 @@ static const int LOAD_NETWORK_ERROR = -4;
static const int LOAD_IMAGE_ERROR = -5;
static const int GENERAL_ERROR = -100;
-#define CHECK_OK(v) \
- do { \
- try { \
- auto r_local = v; \
- if (r_local != 0) { return r_local;} \
- } \
- catch(armnn::Exception e) \
- { \
- ARMNN_LOG(error) << "Oops: " << e.what(); \
- return GENERAL_ERROR; \
- } \
+#define CHECK_OK(v) \
+ do { \
+ try { \
+ auto r_local = v; \
+ if (r_local != 0) { return r_local;} \
+ } \
+ catch (const armnn::Exception& e) \
+ { \
+ ARMNN_LOG(error) << "Oops: " << e.what(); \
+ return GENERAL_ERROR; \
+ } \
} while(0)