From 5bda586c64ae5cd6c2f0cc98dd67d19253de416a Mon Sep 17 00:00:00 2001 From: Jennifer Williams Date: Mon, 5 Oct 2020 12:19:59 -0700 Subject: [PATCH] logging: fix if else if constructs missing final else The logging subsytsem had if else if constructs without final else statement. This commit adds else {} to comply with coding guideline 15.7. Signed-off-by: Jennifer Williams --- include/logging/log_core.h | 5 ++++- subsys/logging/log_backend_rtt.c | 1 + subsys/logging/log_core.c | 3 +++ subsys/logging/log_msg.c | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/logging/log_core.h b/include/logging/log_core.h index 96ca0a9371a..1c01e43ff94 100644 --- a/include/logging/log_core.h +++ b/include/logging/log_core.h @@ -282,7 +282,8 @@ static inline char z_log_minimal_level_to_char(int level) src_level, \ __VA_ARGS__); \ } \ - } \ + } else { \ + } \ } \ if (false) { \ /* Arguments checker present but never evaluated.*/ \ @@ -341,6 +342,7 @@ static inline char z_log_minimal_level_to_char(int level) _length, \ src_level); \ } \ + } else { \ } \ } \ } while (false) @@ -738,6 +740,7 @@ __syscall void z_log_hexdump_from_user(uint32_t src_level_val, src_level, \ _str, _valist, _argnum, \ _strdup_action); \ + } else { \ } \ } \ } while (false) diff --git a/subsys/logging/log_backend_rtt.c b/subsys/logging/log_backend_rtt.c index e78ad72053b..a8854df106e 100644 --- a/subsys/logging/log_backend_rtt.c +++ b/subsys/logging/log_backend_rtt.c @@ -222,6 +222,7 @@ static int data_out_block_mode(uint8_t *data, size_t length, void *ctx) } else if (host_present) { retry_cnt--; on_failed_write(retry_cnt); + } else { } } while ((ret == 0) && host_present); diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c index 805316c1662..4fd93a8f0e4 100644 --- a/subsys/logging/log_core.c +++ b/subsys/logging/log_core.c @@ -99,6 +99,7 @@ uint32_t z_log_get_s_mask(const char *str, uint32_t nargs) } arm = false; arg++; + } else { } } @@ -210,6 +211,7 @@ static inline void msg_finalize(struct log_msg *msg, k_timer_stop(&log_process_thread_timer); k_sem_give(&log_process_thread_sem); } + } else { } } @@ -370,6 +372,7 @@ uint32_t log_count_args(const char *fmt) } else if (prev) { args++; prev = false; + } else { } fmt++; } diff --git a/subsys/logging/log_msg.c b/subsys/logging/log_msg.c index cb55497f175..41aee50af13 100644 --- a/subsys/logging/log_msg.c +++ b/subsys/logging/log_msg.c @@ -149,6 +149,7 @@ static void msg_free(struct log_msg *msg) if (log_is_strdup(str)) { log_free((void *)(str)); } + } else { } if (msg->hdr.params.generic.ext == 1) {