From 387d84e4525e93fefee893029b50cd055c6d6cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20T=C3=B6nz?= Date: Thu, 22 Sep 2022 15:18:39 +0200 Subject: [PATCH] includes: prevent warnings (Z_CBPRINTF_ARG_SIZE shadows variables) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We compile with the gcc compiler flags -Werror and -Wshadow. So the mentioned macro rasies a warning (and with the flags the warning becoms to an error). It uses the same variable names as on of its caller. Add an addidional underscore to the affected variables to prevent this warning. Signed-off-by: Peter Tönz --- include/zephyr/sys/cbprintf_internal.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/zephyr/sys/cbprintf_internal.h b/include/zephyr/sys/cbprintf_internal.h index 1792050576..2f8eb67855 100644 --- a/include/zephyr/sys/cbprintf_internal.h +++ b/include/zephyr/sys/cbprintf_internal.h @@ -178,15 +178,15 @@ extern "C" { #define Z_CBPRINTF_ARG_SIZE(v) z_cbprintf_cxx_arg_size(v) #else #define Z_CBPRINTF_ARG_SIZE(v) ({\ - __auto_type _v = (v) + 0; \ + __auto_type __v = (v) + 0; \ /* Static code analysis may complain about unused variable. */ \ - (void)_v; \ - size_t _arg_size = _Generic((v), \ + (void)__v; \ + size_t __arg_size = _Generic((v), \ float : sizeof(double), \ default : \ - sizeof((_v)) \ + sizeof((__v)) \ ); \ - _arg_size; \ + __arg_size; \ }) #endif