From c878e3fcadfdffed24e40d2be591339ce90d6db9 Mon Sep 17 00:00:00 2001 From: Hess Nathan Date: Mon, 29 Apr 2024 12:54:03 +0200 Subject: [PATCH] coding guidelines: comply with MISRA Rule 20.9 - avoid to use undefined macros in #if expressions Signed-off-by: Hess Nathan --- include/zephyr/linker/common-ram.ld | 2 +- include/zephyr/logging/log_msg.h | 2 +- include/zephyr/sys/__assert.h | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/zephyr/linker/common-ram.ld b/include/zephyr/linker/common-ram.ld index c0d2d444ea..0f750f93cd 100644 --- a/include/zephyr/linker/common-ram.ld +++ b/include/zephyr/linker/common-ram.ld @@ -43,7 +43,7 @@ __device_states_end = .; } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -#if CONFIG_PM_DEVICE +#ifdef CONFIG_PM_DEVICE ITERABLE_SECTION_RAM(pm_device_slots, Z_LINK_ITERABLE_SUBALIGN) #endif diff --git a/include/zephyr/logging/log_msg.h b/include/zephyr/logging/log_msg.h index 0d0094ab82..2f6b3a0461 100644 --- a/include/zephyr/logging/log_msg.h +++ b/include/zephyr/logging/log_msg.h @@ -72,7 +72,7 @@ struct log_msg_hdr { /* Attempting to keep best alignment. When address is 64 bit and timestamp 32 * swap the order to have 16 byte header instead of 24 byte. */ -#if (INTPTR_MAX > INT32_MAX) && !CONFIG_LOG_TIMESTAMP_64BIT +#if (INTPTR_MAX > INT32_MAX) && !defined(CONFIG_LOG_TIMESTAMP_64BIT) log_timestamp_t timestamp; const void *source; #else diff --git a/include/zephyr/sys/__assert.h b/include/zephyr/sys/__assert.h index fc0b9476ea..9f1ab977be 100644 --- a/include/zephyr/sys/__assert.h +++ b/include/zephyr/sys/__assert.h @@ -12,15 +12,21 @@ #ifdef CONFIG_ASSERT #ifndef __ASSERT_ON +#ifdef CONFIG_ASSERT_LEVEL #define __ASSERT_ON CONFIG_ASSERT_LEVEL #endif #endif +#endif #ifdef CONFIG_FORCE_NO_ASSERT #undef __ASSERT_ON #define __ASSERT_ON 0 #endif +#ifndef __ASSERT_ON +#define __ASSERT_ON 0 +#endif + #ifdef __cplusplus extern "C" { #endif