aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2019-05-01 13:03:59 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2019-05-07 15:35:57 +0000
commit299fdd31bd8e1add3ac557a5e630de55b1b6659c (patch)
treea2ecde5f639d10789fed84ee9cc300abf4b6e03a /src/core
parentdc5d34319a673f6cbcd346a0c7046fb7fd0106ec (diff)
downloadComputeLibrary-299fdd31bd8e1add3ac557a5e630de55b1b6659c.tar.gz
COMPMID-2177 Fix clang warnings
Change-Id: I4beacfd714ee3ed771fd174cce5d8009a2961380 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/1065 Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CL/kernels/CLConvolutionKernel.cpp28
-rw-r--r--src/core/utils/helpers/tensor_transform.cpp6
-rw-r--r--src/core/utils/logging/LoggerRegistry.cpp4
-rw-r--r--src/core/utils/quantization/AsymmHelpers.cpp12
4 files changed, 28 insertions, 22 deletions
diff --git a/src/core/CL/kernels/CLConvolutionKernel.cpp b/src/core/CL/kernels/CLConvolutionKernel.cpp
index e6777938a2..d9c7ede068 100644
--- a/src/core/CL/kernels/CLConvolutionKernel.cpp
+++ b/src/core/CL/kernels/CLConvolutionKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -39,9 +39,12 @@
#include <sstream>
#include <string>
-using namespace arm_compute;
-
-#define MAX_MATRIX_SIZE 81
+namespace arm_compute
+{
+namespace
+{
+constexpr unsigned int max_matrix_size = 81;
+} // namespace
/****************************************************************************************\
* Square Convolution *
@@ -138,8 +141,8 @@ void CLSeparableConvolutionHorKernel<matrix_size>::configure(const ICLTensor *in
// Set build options
std::set<std::string> build_opts;
- int16_t mat[matrix_size * matrix_size] = { 0 };
- memcpy(mat, conv, matrix_size * sizeof(int16_t));
+ std::array<int16_t, matrix_size *matrix_size> mat = { 0 };
+ memcpy(mat.data(), conv, matrix_size * sizeof(int16_t));
for(unsigned int j = 0; j < matrix_size * matrix_size; j++)
{
@@ -173,7 +176,7 @@ void CLSeparableConvolutionHorKernel<matrix_size>::configure(const ICLTensor *in
template <unsigned int matrix_size>
BorderSize CLSeparableConvolutionVertKernel<matrix_size>::border_size() const
{
- return BorderSize(matrix_size / 2, 0);
+ return BorderSize{ matrix_size / 2, 0 };
}
template <unsigned int matrix_size>
@@ -190,8 +193,8 @@ void CLSeparableConvolutionVertKernel<matrix_size>::configure(const ICLTensor *i
std::set<std::string> build_opts;
- int16_t mat[matrix_size * matrix_size] = { 0 };
- memcpy(mat + matrix_size, conv, matrix_size * sizeof(int16_t));
+ std::array<int16_t, matrix_size *matrix_size> mat = { 0 };
+ memcpy(mat.data() + matrix_size, conv, matrix_size * sizeof(int16_t));
for(unsigned int j = 0; j < matrix_size * matrix_size; j++)
{
@@ -264,11 +267,11 @@ void CLConvolutionRectangleKernel::configure(const ICLTensor *input, ICLTensor *
uint32_t matrix_size = width * height;
- int16_t mat[MAX_MATRIX_SIZE] = { 0 };
+ std::array<int16_t, max_matrix_size> mat = { 0 };
- memcpy(mat, conv, matrix_size * sizeof(int16_t));
+ memcpy(mat.data(), conv, matrix_size * sizeof(int16_t));
- for(unsigned int j = 0; j < MAX_MATRIX_SIZE; j++)
+ for(unsigned int j = 0; j < max_matrix_size; j++)
{
options.insert("-DMAT" + support::cpp11::to_string(j) + "=" + support::cpp11::to_string(mat[j]));
}
@@ -328,3 +331,4 @@ template class arm_compute::CLSeparableConvolutionVertKernel<9>;
template class arm_compute::CLSeparableConvolutionHorKernel<5>;
template class arm_compute::CLSeparableConvolutionHorKernel<7>;
template class arm_compute::CLSeparableConvolutionHorKernel<9>;
+} // namespace arm_compute
diff --git a/src/core/utils/helpers/tensor_transform.cpp b/src/core/utils/helpers/tensor_transform.cpp
index 08803c7fb0..7c56390fed 100644
--- a/src/core/utils/helpers/tensor_transform.cpp
+++ b/src/core/utils/helpers/tensor_transform.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -114,7 +114,9 @@ std::tuple<Coordinates, Coordinates, Coordinates> calculate_strided_slice_coords
Coordinates starts, Coordinates ends, Coordinates strides,
int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask)
{
- Coordinates starts_abs, ends_abs, final_strides;
+ Coordinates starts_abs{};
+ Coordinates ends_abs{};
+ Coordinates final_strides{};
for(unsigned int i = 0; i < input_shape.num_dimensions(); ++i)
{
const int start_i = calculate_start_on_index(input_shape, i, starts, strides, begin_mask);
diff --git a/src/core/utils/logging/LoggerRegistry.cpp b/src/core/utils/logging/LoggerRegistry.cpp
index 99236d25c3..3a466963fd 100644
--- a/src/core/utils/logging/LoggerRegistry.cpp
+++ b/src/core/utils/logging/LoggerRegistry.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -66,7 +66,7 @@ std::shared_ptr<Logger> LoggerRegistry::logger(const std::string &name)
return (_loggers.find(name) != _loggers.end()) ? _loggers[name] : nullptr;
}
-void LoggerRegistry::create_reserved_loggers(LogLevel log_level, std::vector<std::shared_ptr<Printer>> printers)
+void LoggerRegistry::create_reserved_loggers(LogLevel log_level, const std::vector<std::shared_ptr<Printer>> &printers)
{
std::lock_guard<arm_compute::Mutex> lock(_mtx);
for(const auto &r : _reserved_loggers)
diff --git a/src/core/utils/quantization/AsymmHelpers.cpp b/src/core/utils/quantization/AsymmHelpers.cpp
index ea9ba776a9..d606adba62 100644
--- a/src/core/utils/quantization/AsymmHelpers.cpp
+++ b/src/core/utils/quantization/AsymmHelpers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -29,12 +29,12 @@
using namespace arm_compute::quantization;
-constexpr int64_t fixed_point_one_Q0 = (1ll << 31);
+constexpr int64_t fixed_point_one_Q0 = (1LL << 31);
constexpr float epsilon = 0.00001f;
arm_compute::Status arm_compute::quantization::calculate_quantized_multiplier_less_than_one(float multiplier,
- int *quant_multiplier,
- int *right_shift)
+ int *quant_multiplier,
+ int *right_shift)
{
ARM_COMPUTE_RETURN_ERROR_ON(quant_multiplier == nullptr);
ARM_COMPUTE_RETURN_ERROR_ON(right_shift == nullptr);
@@ -71,8 +71,8 @@ arm_compute::Status arm_compute::quantization::calculate_quantized_multiplier_le
}
arm_compute::Status arm_compute::quantization::calculate_quantized_multiplier_greater_than_one(float multiplier,
- int *quantized_multiplier,
- int *left_shift)
+ int *quantized_multiplier,
+ int *left_shift)
{
ARM_COMPUTE_RETURN_ERROR_ON(quantized_multiplier == nullptr);
ARM_COMPUTE_RETURN_ERROR_ON(left_shift == nullptr);