COMPMID-1819 Add option to build library with -fno-exceptions
Change-Id: I3de6bb33746d52f8d8c337ab7776eccee8c205fb
Reviewed-on: https://review.mlplatform.org/328
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index 39dad8f..6080dc4 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -48,8 +48,10 @@
std::string out;
std::ifstream fs;
+#ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
try
{
+#endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
fs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
std::ios_base::openmode mode = std::ios::in;
@@ -68,11 +70,13 @@
fs.seekg(0, std::ios::beg);
// Copy the content of the file
out.assign(std::istreambuf_iterator<char>(fs), std::istreambuf_iterator<char>());
+#ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
}
catch(const std::ifstream::failure &e)
{
ARM_COMPUTE_ERROR("Accessing %s: %s", filename.c_str(), e.what());
}
+#endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
return out;
}