From 7c60c990fbed62aab1369c0e4462c4081dc3cfeb Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 10 Oct 2019 14:33:47 +0100 Subject: COMPMID-2486: Remove disabled compiler warnings Removed the following flags: -Wno-format-nonliteral: This had a side effect on Error.h that resulted in rewriting most of the macros. Since I was at it I removed all the va_args in order to comply with DCL50-CPP. -Wno-deprecated-increment-bool -Wno-vla-extension -Wno-mismatched-tags -Wno-redundant-move Change-Id: I7c593854ecc3b7d595b8edcbd6a86d3c2563c6bd Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/2069 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas --- src/core/Error.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'src/core/Error.cpp') diff --git a/src/core/Error.cpp b/src/core/Error.cpp index 45cce66804..8d321c01fd 100644 --- a/src/core/Error.cpp +++ b/src/core/Error.cpp @@ -31,30 +31,20 @@ using namespace arm_compute; -Status arm_compute::create_error_va_list(ErrorCode error_code, const char *function, const char *file, const int line, const char *msg, va_list args) +Status arm_compute::create_error(ErrorCode error_code, std::string msg) { - std::array out{ 0 }; - int offset = snprintf(out.data(), out.size(), "in %s %s:%d: ", function, file, line); - vsnprintf(out.data() + offset, out.size() - offset, msg, args); - - return Status(error_code, std::string(out.data())); + return Status(error_code, msg); } -Status arm_compute::create_error(ErrorCode error_code, const char *function, const char *file, const int line, const char *msg, ...) +Status arm_compute::create_error_msg(ErrorCode error_code, const char *func, const char *file, int line, const char *msg) { - va_list args; - va_start(args, msg); - auto err = create_error_va_list(error_code, function, file, line, msg, args); - va_end(args); - return err; + std::array out{ 0 }; + snprintf(out.data(), out.size(), "in %s %s:%d: %s", func, file, line, msg); + return Status(error_code, std::string(out.data())); } -void arm_compute::error(const char *function, const char *file, const int line, const char *msg, ...) +void arm_compute::throw_error(Status err) { - va_list args; - va_start(args, msg); - auto err = create_error_va_list(ErrorCode::RUNTIME_ERROR, function, file, line, msg, args); - va_end(args); ARM_COMPUTE_THROW(std::runtime_error(err.error_description())); } void Status::internal_throw_on_error() const -- cgit v1.2.1