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 --- utils/GraphUtils.cpp | 21 +++++++++++---------- utils/ImageLoader.h | 12 ++++++------ utils/Utils.cpp | 2 +- utils/Utils.h | 12 ++++++------ 4 files changed, 24 insertions(+), 23 deletions(-) (limited to 'utils') diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp index eaa7d79778..e07e26f2fd 100644 --- a/utils/GraphUtils.cpp +++ b/utils/GraphUtils.cpp @@ -35,6 +35,7 @@ #pragma GCC diagnostic pop #include "utils/Utils.h" +#include #include #include @@ -258,9 +259,9 @@ bool ImageAccessor::access_tensor(ITensor &tensor) { std::tie(permuted_shape, perm) = compute_permutation_parameters(tensor.info()->tensor_shape(), tensor.info()->data_layout()); } - ARM_COMPUTE_EXIT_ON_MSG(image_loader->width() != permuted_shape.x() || image_loader->height() != permuted_shape.y(), - "Failed to load image file: dimensions [%d,%d] not correct, expected [%d,%d].", - image_loader->width(), image_loader->height(), permuted_shape.x(), permuted_shape.y()); + ARM_COMPUTE_EXIT_ON_MSG_VAR(image_loader->width() != permuted_shape.x() || image_loader->height() != permuted_shape.y(), + "Failed to load image file: dimensions [%d,%d] not correct, expected [%" PRIu32 ",%" PRIu32 "].", + image_loader->width(), image_loader->height(), permuted_shape.x(), permuted_shape.y()); // Fill the tensor with the PPM content (BGR) image_loader->fill_planar_tensor(tensor, _bgr); @@ -310,7 +311,7 @@ ValidationInputAccessor::ValidationInputAccessor(const std::string & } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", image_list.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", image_list.c_str(), e.what()); } } @@ -334,9 +335,9 @@ bool ValidationInputAccessor::access_tensor(arm_compute::ITensor &tensor) std::tie(permuted_shape, perm) = compute_permutation_parameters(tensor.info()->tensor_shape(), tensor.info()->data_layout()); } - ARM_COMPUTE_EXIT_ON_MSG(jpeg.width() != permuted_shape.x() || jpeg.height() != permuted_shape.y(), - "Failed to load image file: dimensions [%d,%d] not correct, expected [%d,%d].", - jpeg.width(), jpeg.height(), permuted_shape.x(), permuted_shape.y()); + ARM_COMPUTE_EXIT_ON_MSG_VAR(jpeg.width() != permuted_shape.x() || jpeg.height() != permuted_shape.y(), + "Failed to load image file: dimensions [%d,%d] not correct, expected [%" PRIu32 ",%" PRIu32 "].", + jpeg.width(), jpeg.height(), permuted_shape.x(), permuted_shape.y()); // Fill the tensor with the JPEG content (BGR) jpeg.fill_planar_tensor(tensor, _bgr); @@ -383,7 +384,7 @@ ValidationOutputAccessor::ValidationOutputAccessor(const std::string &image_list } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", image_list.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", image_list.c_str(), e.what()); } } @@ -499,7 +500,7 @@ DetectionOutputAccessor::DetectionOutputAccessor(const std::string &labels_path, } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", labels_path.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", labels_path.c_str(), e.what()); } } @@ -570,7 +571,7 @@ TopNPredictionsAccessor::TopNPredictionsAccessor(const std::string &labels_path, } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", labels_path.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", labels_path.c_str(), e.what()); } } diff --git a/utils/ImageLoader.h b/utils/ImageLoader.h index 5a2825ebc3..f37ffa2820 100644 --- a/utils/ImageLoader.h +++ b/utils/ImageLoader.h @@ -242,7 +242,7 @@ public: } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Loading image file: %s", e.what()); + ARM_COMPUTE_ERROR_VAR("Loading image file: %s", e.what()); } } /** Fill a tensor with 3 planes (one for each channel) with the content of the currently open image file. @@ -344,7 +344,7 @@ public: } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Loading image file: %s", e.what()); + ARM_COMPUTE_ERROR_VAR("Loading image file: %s", e.what()); } } @@ -387,14 +387,14 @@ public: unsigned int max_val = 0; std::tie(_width, _height, max_val) = parse_ppm_header(_fs); - ARM_COMPUTE_ERROR_ON_MSG(max_val >= 256, "2 bytes per colour channel not supported in file %s", - filename.c_str()); + ARM_COMPUTE_ERROR_ON_MSG_VAR(max_val >= 256, "2 bytes per colour channel not supported in file %s", + filename.c_str()); _feeder = support::cpp14::make_unique(_fs); } catch(std::runtime_error &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", filename.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", filename.c_str(), e.what()); } } void close() override @@ -457,7 +457,7 @@ public: uint8_t *rgb_image = stbi_load(filename.c_str(), &width, &height, &bpp, 3); if(rgb_image == NULL) { - ARM_COMPUTE_ERROR("Accessing %s failed", filename.c_str()); + ARM_COMPUTE_ERROR_VAR("Accessing %s failed", filename.c_str()); } else { diff --git a/utils/Utils.cpp b/utils/Utils.cpp index 8cc3fcf9b0..20ccf55af8 100644 --- a/utils/Utils.cpp +++ b/utils/Utils.cpp @@ -186,7 +186,7 @@ ImageType get_image_type_from_file(const std::string &filename) } catch(std::runtime_error &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", filename.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", filename.c_str(), e.what()); } return type; diff --git a/utils/Utils.h b/utils/Utils.h index d669730a3e..bc2fef4eb0 100644 --- a/utils/Utils.h +++ b/utils/Utils.h @@ -344,7 +344,7 @@ public: try { _fs.open(npy_filename, std::ios::in | std::ios::binary); - ARM_COMPUTE_EXIT_ON_MSG(!_fs.good(), "Failed to load binary data from %s", npy_filename.c_str()); + ARM_COMPUTE_EXIT_ON_MSG_VAR(!_fs.good(), "Failed to load binary data from %s", npy_filename.c_str()); _fs.exceptions(std::ifstream::failbit | std::ifstream::badbit); _file_layout = file_layout; @@ -352,7 +352,7 @@ public: } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Accessing %s: %s", npy_filename.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", npy_filename.c_str(), e.what()); } } /** Return true if a NPY file is currently open */ @@ -521,7 +521,7 @@ public: } catch(const std::ifstream::failure &e) { - ARM_COMPUTE_ERROR("Loading NPY file: %s", e.what()); + ARM_COMPUTE_ERROR_VAR("Loading NPY file: %s", e.what()); } } @@ -609,7 +609,7 @@ void save_to_ppm(T &tensor, const std::string &ppm_filename) } catch(const std::ofstream::failure &e) { - ARM_COMPUTE_ERROR("Writing %s: (%s)", ppm_filename.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Writing %s: (%s)", ppm_filename.c_str(), e.what()); } } @@ -668,7 +668,7 @@ void save_to_npy(T &tensor, const std::string &npy_filename, bool fortran_order) } catch(const std::ofstream::failure &e) { - ARM_COMPUTE_ERROR("Writing %s: (%s)", npy_filename.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Writing %s: (%s)", npy_filename.c_str(), e.what()); } } @@ -720,7 +720,7 @@ void load_trained_data(T &tensor, const std::string &filename) } catch(const std::ofstream::failure &e) { - ARM_COMPUTE_ERROR("Writing %s: (%s)", filename.c_str(), e.what()); + ARM_COMPUTE_ERROR_VAR("Writing %s: (%s)", filename.c_str(), e.what()); } } -- cgit v1.2.1