From 81f0f4efd0f3c40dc932e8c6e4b48f1af1840e1c Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 20 May 2021 12:58:04 +0200 Subject: [PATCH] lib: os: cbprintf: Add missing initialization of structure fields C++ compiliation may generate warning if all fields are not explicitly initialized. Added explicit initialization to 0. Signed-off-by: Krzysztof Chruscinski --- include/sys/cbprintf_internal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/sys/cbprintf_internal.h b/include/sys/cbprintf_internal.h index 39206b5193a..d435a69c83c 100644 --- a/include/sys/cbprintf_internal.h +++ b/include/sys/cbprintf_internal.h @@ -360,7 +360,10 @@ do { \ /* Store length in the header, set number of dumped strings to 0 */ \ if (_pbuf) { \ union z_cbprintf_hdr hdr = { \ - .desc = {.len = (uint8_t)(_pkg_len / sizeof(int)) } \ + .desc = { \ + .len = (uint8_t)(_pkg_len / sizeof(int)), \ + .str_cnt = 0, \ + } \ }; \ *_len_loc = hdr; \ } \