Commit 6fdc56d2 authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Anas Nashif
Browse files

kernel: Using boolean types for boolean constants



Make boolean expressions use boolean types.

MISRA-C rule 14.4

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
parent 2c924119
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include <arch/arc/syscall.h>
#include <arch/arc/v2/exc.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
@@ -54,7 +55,7 @@ extern void _SysFatalErrorHandler(unsigned int cause, const NANO_ESF *esf);
		: "memory"); \
		CODE_UNREACHABLE; \
	} \
	} while (0)
	} while (false)

#ifdef __cplusplus
}
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include <arch/arm/syscall.h>
#include <arch/arm/cortex_m/exc.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
@@ -51,7 +52,7 @@ extern void _SysFatalErrorHandler(unsigned int reason, const NANO_ESF *esf);
		: [reason] "i" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
		: "memory"); \
	CODE_UNREACHABLE; \
} while (0)
} while (false)
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
#define _ARCH_EXCEPT(reason_p) do { \
	__asm__ volatile ( \
@@ -63,7 +64,7 @@ extern void _SysFatalErrorHandler(unsigned int reason, const NANO_ESF *esf);
		: [reason] "i" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
		: "memory"); \
	CODE_UNREACHABLE; \
} while (0)
} while (false)
#else
#error Unknown ARM architecture
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include <irq.h>
#include <sw_isr_table.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
@@ -104,7 +105,7 @@ extern void _irq_priority_set(unsigned int irq, unsigned int prio,
extern void _arch_isr_direct_pm(void);
#define _ARCH_ISR_DIRECT_PM() _arch_isr_direct_pm()
#else
#define _ARCH_ISR_DIRECT_PM() do { } while (0)
#define _ARCH_ISR_DIRECT_PM() do { } while (false)
#endif

#define _ARCH_ISR_DIRECT_HEADER() _arch_isr_direct_header()
+5 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <kernel_arch_thread.h>
#include <generated_dts_board.h>
#include <mmustructs.h>
#include <stdbool.h>

#ifndef _ASMLANGUAGE
#include <arch/x86/asm_inline.h>
@@ -48,8 +49,8 @@ extern "C" {
void _int_latency_start(void);
void _int_latency_stop(void);
#else
#define _int_latency_start()  do { } while (0)
#define _int_latency_stop()   do { } while (0)
#define _int_latency_start()  do { } while (false)
#define _int_latency_stop()   do { } while (false)
#endif

/* interrupt/exception/error related definitions */
@@ -266,7 +267,7 @@ extern unsigned char _irq_to_interrupt_vector[];
extern void _arch_irq_direct_pm(void);
#define _ARCH_ISR_DIRECT_PM() _arch_irq_direct_pm()
#else
#define _ARCH_ISR_DIRECT_PM() do { } while (0)
#define _ARCH_ISR_DIRECT_PM() do { } while (false)
#endif

#define _ARCH_ISR_DIRECT_HEADER() _arch_isr_direct_header()
@@ -624,7 +625,7 @@ extern struct task_state_segment _main_tss;
		: [vector] "i" (CONFIG_X86_KERNEL_OOPS_VECTOR), \
		  [reason] "i" (reason_p)); \
	CODE_UNREACHABLE; \
} while (0)
} while (false)
#endif

/** Dummy ESF for fatal errors that would otherwise not have an ESF */
+8 −6
Original line number Diff line number Diff line
@@ -12,11 +12,13 @@
#ifndef ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_
#define ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_

#include <stdbool.h>

#ifndef CONFIG_OBJECT_TRACING

#define SYS_TRACING_OBJ_INIT(name, obj) do { } while ((0))
#define SYS_TRACING_OBJ_INIT_DLL(name, obj) do { } while ((0))
#define SYS_TRACING_OBJ_REMOVE_DLL(name, obj) do { } while ((0))
#define SYS_TRACING_OBJ_INIT(name, obj) do { } while (false)
#define SYS_TRACING_OBJ_INIT_DLL(name, obj) do { } while (false)
#define SYS_TRACING_OBJ_REMOVE_DLL(name, obj) do { } while (false)

#else

@@ -40,7 +42,7 @@
		_trace_list_ ## name = obj;	       \
		irq_unlock(key);		       \
	}					       \
	while (0)
	while (false)

/**
 * @def SYS_TRACING_OBJ_INIT_DLL
@@ -67,7 +69,7 @@
		_trace_list_ ## name = obj;		      \
		irq_unlock(key);			      \
	}						      \
	while (0)
	while (false)

/**
 * @def SYS_TRACING_OBJ_REMOVE_DLL
@@ -95,7 +97,7 @@
		}					      \
		irq_unlock(key);			      \
	}						      \
	while (0)
	while (false)

#endif  /*CONFIG_OBJECT_TRACING*/
#endif  /*ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_*/
Loading