diff options
author | Pavel Macenauer <pavel.macenauer@linaro.org> | 2020-05-26 10:54:22 +0000 |
---|---|---|
committer | Derek Lamberti <derek.lamberti@arm.com> | 2020-05-27 12:19:00 +0000 |
commit | 855a47b1b0a78c839a674cc1e61d0668b8c4e349 (patch) | |
tree | 946e6e78ad98fd84fc9e43aabf508debb321b43d /tests | |
parent | 12239e7291fb04b862e44045be0a4feb7751af62 (diff) | |
download | armnn-855a47b1b0a78c839a674cc1e61d0668b8c4e349.tar.gz |
Catch exceptions by const reference
Change-Id: I4b4d8ae419dfb8470e8937e75cd3bab85f03b935
Signed-off-by: Pavel Macenauer <pavel.macenauer@nxp.com>
Diffstat (limited to 'tests')
4 files changed, 17 insertions, 17 deletions
diff --git a/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp b/tests/ModelAccuracyTool-Armnn/ModelAccuracyTool-Armnn.cpp index 20f6180700..85d757f820 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 0e72f7bc1e..c80260130a 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 ec0eaf90f8..ff28eb4f3b 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 c96d1f28d0..1905e9002d 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) |