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 --- arm_compute/core/utils/logging/Macros.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'arm_compute/core/utils/logging') diff --git a/arm_compute/core/utils/logging/Macros.h b/arm_compute/core/utils/logging/Macros.h index 5593030261..6c5bb32144 100644 --- a/arm_compute/core/utils/logging/Macros.h +++ b/arm_compute/core/utils/logging/Macros.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -40,14 +40,17 @@ } \ } while(false) -#define ARM_COMPUTE_LOG_MSG_WITH_FORMAT(logger_name, log_level, fmt, ...) \ - do \ - { \ - auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ - { \ - __logger->log(log_level, fmt, __VA_ARGS__); \ - } \ +#define ARM_COMPUTE_LOG_MSG_WITH_FORMAT(logger_name, log_level, fmt, ...) \ + do \ + { \ + auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ + if(__logger != nullptr) \ + { \ + size_t size = ::snprintf(nullptr, 0, fmt, __VA_ARGS__) + 1; \ + auto char_str = support::cpp14::make_unique(size); \ + ::snprintf(char_str.get(), size, #fmt, __VA_ARGS__); \ + __logger->log(log_level, std::string(char_str.get(), char_str.get() + size - 1)); \ + } \ } while(false) #define ARM_COMPUTE_LOG_STREAM(logger_name, log_level, stream) \ -- cgit v1.2.1