coding guidelines: comply with MISRA Rule 20.9

- avoid to use undefined macros in #if expressions

Signed-off-by: Hess Nathan <nhess@baumer.com>
This commit is contained in:
Hess Nathan 2024-04-29 14:08:04 +02:00 committed by Fabio Baltieri
commit 527e712448
4 changed files with 5 additions and 5 deletions

View file

@ -140,7 +140,7 @@ extern void smp_timer_init(void);
extern void z_early_rand_get(uint8_t *buf, size_t length);
#if CONFIG_STACK_POINTER_RANDOM
#if defined(CONFIG_STACK_POINTER_RANDOM) && (CONFIG_STACK_POINTER_RANDOM != 0)
extern int z_stack_adjust_initialized;
#endif /* CONFIG_STACK_POINTER_RANDOM */

View file

@ -75,7 +75,7 @@ static inline int thread_is_metairq(struct k_thread *thread)
#endif /* CONFIG_NUM_METAIRQ_PRIORITIES */
}
#if CONFIG_ASSERT
#ifdef CONFIG_ASSERT
static inline bool is_thread_dummy(struct k_thread *thread)
{
return (thread->base.thread_state & _THREAD_DUMMY) != 0U;

View file

@ -424,7 +424,7 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
z_sys_post_kernel = true;
z_sys_init_run_level(INIT_LEVEL_POST_KERNEL);
#if CONFIG_STACK_POINTER_RANDOM
#if defined(CONFIG_STACK_POINTER_RANDOM) && (CONFIG_STACK_POINTER_RANDOM != 0)
z_stack_adjust_initialized = 1;
#endif /* CONFIG_STACK_POINTER_RANDOM */
boot_banner();

View file

@ -356,7 +356,7 @@ static inline void z_vrfy_k_thread_start(struct k_thread *thread)
#include <syscalls/k_thread_start_mrsh.c>
#endif /* CONFIG_USERSPACE */
#if CONFIG_STACK_POINTER_RANDOM
#if defined(CONFIG_STACK_POINTER_RANDOM) && (CONFIG_STACK_POINTER_RANDOM != 0)
int z_stack_adjust_initialized;
static size_t random_offset(size_t stack_size)
@ -487,7 +487,7 @@ static char *setup_thread_stack(struct k_thread *new_thread,
new_thread->userspace_local_data =
(struct _thread_userspace_local_data *)(stack_ptr - delta);
#endif /* CONFIG_THREAD_USERSPACE_LOCAL_DATA */
#if CONFIG_STACK_POINTER_RANDOM
#if defined(CONFIG_STACK_POINTER_RANDOM) && (CONFIG_STACK_POINTER_RANDOM != 0)
delta += random_offset(stack_buf_size);
#endif /* CONFIG_STACK_POINTER_RANDOM */
delta = ROUND_UP(delta, ARCH_STACK_PTR_ALIGN);