Skip to content

Commit b821eb6

Browse files
nordic-krchanangl
authored andcommitted
[nrf fromtree] lib: os: cbprintf: Fix potential Coverity issue
Seen in some Coverity runs that it was complaining about unused variable. Variables are used only in one path of _Generic. Signed-off-by: Krzysztof Chruscinski <[email protected]> (cherry picked from commit 468218a) Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 3be8dd1 commit b821eb6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/zephyr/sys/cbprintf_internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ extern "C" {
168168
#else
169169
#define Z_CBPRINTF_ARG_SIZE(v) ({\
170170
__auto_type _v = (v) + 0; \
171+
/* Static code analysis may complain about unused variable. */ \
172+
(void)_v; \
171173
size_t _arg_size = _Generic((v), \
172174
float : sizeof(double), \
173175
default : \
@@ -194,6 +196,9 @@ extern "C" {
194196
float : (arg) + 0, \
195197
default : \
196198
0.0); \
199+
/* Static code analysis may complain about unused variable. */ \
200+
(void)_v; \
201+
(void)_d; \
197202
size_t arg_size = Z_CBPRINTF_ARG_SIZE(arg); \
198203
size_t _wsize = arg_size / sizeof(int); \
199204
z_cbprintf_wcpy((int *)buf, \

0 commit comments

Comments
 (0)