kernel: Using boolean types for boolean constants
Make boolean expressions use boolean types. MISRA-C rule 14.4 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
2c924119a3
commit
6fdc56d286
19 changed files with 64 additions and 46 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <arch/arc/syscall.h>
|
#include <arch/arc/syscall.h>
|
||||||
#include <arch/arc/v2/exc.h>
|
#include <arch/arc/v2/exc.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -54,7 +55,7 @@ extern void _SysFatalErrorHandler(unsigned int cause, const NANO_ESF *esf);
|
||||||
: "memory"); \
|
: "memory"); \
|
||||||
CODE_UNREACHABLE; \
|
CODE_UNREACHABLE; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <arch/arm/syscall.h>
|
#include <arch/arm/syscall.h>
|
||||||
#include <arch/arm/cortex_m/exc.h>
|
#include <arch/arm/cortex_m/exc.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
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) \
|
: [reason] "i" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
|
||||||
: "memory"); \
|
: "memory"); \
|
||||||
CODE_UNREACHABLE; \
|
CODE_UNREACHABLE; \
|
||||||
} while (0)
|
} while (false)
|
||||||
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
|
#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
|
||||||
#define _ARCH_EXCEPT(reason_p) do { \
|
#define _ARCH_EXCEPT(reason_p) do { \
|
||||||
__asm__ volatile ( \
|
__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) \
|
: [reason] "i" (reason_p), [id] "i" (_SVC_CALL_RUNTIME_EXCEPT) \
|
||||||
: "memory"); \
|
: "memory"); \
|
||||||
CODE_UNREACHABLE; \
|
CODE_UNREACHABLE; \
|
||||||
} while (0)
|
} while (false)
|
||||||
#else
|
#else
|
||||||
#error Unknown ARM architecture
|
#error Unknown ARM architecture
|
||||||
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <irq.h>
|
#include <irq.h>
|
||||||
#include <sw_isr_table.h>
|
#include <sw_isr_table.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -104,7 +105,7 @@ extern void _irq_priority_set(unsigned int irq, unsigned int prio,
|
||||||
extern void _arch_isr_direct_pm(void);
|
extern void _arch_isr_direct_pm(void);
|
||||||
#define _ARCH_ISR_DIRECT_PM() _arch_isr_direct_pm()
|
#define _ARCH_ISR_DIRECT_PM() _arch_isr_direct_pm()
|
||||||
#else
|
#else
|
||||||
#define _ARCH_ISR_DIRECT_PM() do { } while (0)
|
#define _ARCH_ISR_DIRECT_PM() do { } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _ARCH_ISR_DIRECT_HEADER() _arch_isr_direct_header()
|
#define _ARCH_ISR_DIRECT_HEADER() _arch_isr_direct_header()
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <kernel_arch_thread.h>
|
#include <kernel_arch_thread.h>
|
||||||
#include <generated_dts_board.h>
|
#include <generated_dts_board.h>
|
||||||
#include <mmustructs.h>
|
#include <mmustructs.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
#include <arch/x86/asm_inline.h>
|
#include <arch/x86/asm_inline.h>
|
||||||
|
@ -48,8 +49,8 @@ extern "C" {
|
||||||
void _int_latency_start(void);
|
void _int_latency_start(void);
|
||||||
void _int_latency_stop(void);
|
void _int_latency_stop(void);
|
||||||
#else
|
#else
|
||||||
#define _int_latency_start() do { } while (0)
|
#define _int_latency_start() do { } while (false)
|
||||||
#define _int_latency_stop() do { } while (0)
|
#define _int_latency_stop() do { } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* interrupt/exception/error related definitions */
|
/* interrupt/exception/error related definitions */
|
||||||
|
@ -266,7 +267,7 @@ extern unsigned char _irq_to_interrupt_vector[];
|
||||||
extern void _arch_irq_direct_pm(void);
|
extern void _arch_irq_direct_pm(void);
|
||||||
#define _ARCH_ISR_DIRECT_PM() _arch_irq_direct_pm()
|
#define _ARCH_ISR_DIRECT_PM() _arch_irq_direct_pm()
|
||||||
#else
|
#else
|
||||||
#define _ARCH_ISR_DIRECT_PM() do { } while (0)
|
#define _ARCH_ISR_DIRECT_PM() do { } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _ARCH_ISR_DIRECT_HEADER() _arch_isr_direct_header()
|
#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), \
|
: [vector] "i" (CONFIG_X86_KERNEL_OOPS_VECTOR), \
|
||||||
[reason] "i" (reason_p)); \
|
[reason] "i" (reason_p)); \
|
||||||
CODE_UNREACHABLE; \
|
CODE_UNREACHABLE; \
|
||||||
} while (0)
|
} while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Dummy ESF for fatal errors that would otherwise not have an ESF */
|
/** Dummy ESF for fatal errors that would otherwise not have an ESF */
|
||||||
|
|
|
@ -12,11 +12,13 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_
|
#ifndef ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_
|
||||||
#define ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_
|
#define ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifndef CONFIG_OBJECT_TRACING
|
#ifndef CONFIG_OBJECT_TRACING
|
||||||
|
|
||||||
#define SYS_TRACING_OBJ_INIT(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 ((0))
|
#define SYS_TRACING_OBJ_INIT_DLL(name, obj) do { } while (false)
|
||||||
#define SYS_TRACING_OBJ_REMOVE_DLL(name, obj) do { } while ((0))
|
#define SYS_TRACING_OBJ_REMOVE_DLL(name, obj) do { } while (false)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -40,7 +42,7 @@
|
||||||
_trace_list_ ## name = obj; \
|
_trace_list_ ## name = obj; \
|
||||||
irq_unlock(key); \
|
irq_unlock(key); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def SYS_TRACING_OBJ_INIT_DLL
|
* @def SYS_TRACING_OBJ_INIT_DLL
|
||||||
|
@ -67,7 +69,7 @@
|
||||||
_trace_list_ ## name = obj; \
|
_trace_list_ ## name = obj; \
|
||||||
irq_unlock(key); \
|
irq_unlock(key); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def SYS_TRACING_OBJ_REMOVE_DLL
|
* @def SYS_TRACING_OBJ_REMOVE_DLL
|
||||||
|
@ -95,7 +97,7 @@
|
||||||
} \
|
} \
|
||||||
irq_unlock(key); \
|
irq_unlock(key); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (false)
|
||||||
|
|
||||||
#endif /*CONFIG_OBJECT_TRACING*/
|
#endif /*CONFIG_OBJECT_TRACING*/
|
||||||
#endif /*ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_*/
|
#endif /*ZEPHYR_INCLUDE_DEBUG_OBJECT_TRACING_COMMON_H_*/
|
||||||
|
|
|
@ -26,6 +26,7 @@ GTEXT(_timer_int_handler)
|
||||||
#else /* _ASMLANGUAGE */
|
#else /* _ASMLANGUAGE */
|
||||||
|
|
||||||
#include <device.h>
|
#include <device.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern int _sys_clock_driver_init(struct device *device);
|
extern int _sys_clock_driver_init(struct device *device);
|
||||||
|
|
||||||
|
@ -39,8 +40,8 @@ extern void sys_clock_disable(void);
|
||||||
extern void _timer_idle_enter(s32_t ticks);
|
extern void _timer_idle_enter(s32_t ticks);
|
||||||
extern void _timer_idle_exit(void);
|
extern void _timer_idle_exit(void);
|
||||||
#else
|
#else
|
||||||
#define _timer_idle_enter(ticks) do { } while ((0))
|
#define _timer_idle_enter(ticks) do { } while (false)
|
||||||
#define _timer_idle_exit() do { } while ((0))
|
#define _timer_idle_exit() do { } while (false)
|
||||||
#endif /* CONFIG_TICKLESS_IDLE */
|
#endif /* CONFIG_TICKLESS_IDLE */
|
||||||
|
|
||||||
extern void _nano_sys_clock_tick_announce(s32_t ticks);
|
extern void _nano_sys_clock_tick_announce(s32_t ticks);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#if !defined(_ASMLANGUAGE)
|
#if !defined(_ASMLANGUAGE)
|
||||||
#include <kernel_includes.h>
|
#include <kernel_includes.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -4206,9 +4207,9 @@ extern void *k_calloc(size_t nmemb, size_t size);
|
||||||
/* polling API - PRIVATE */
|
/* polling API - PRIVATE */
|
||||||
|
|
||||||
#ifdef CONFIG_POLL
|
#ifdef CONFIG_POLL
|
||||||
#define _INIT_OBJ_POLL_EVENT(obj) do { (obj)->poll_event = NULL; } while ((0))
|
#define _INIT_OBJ_POLL_EVENT(obj) do { (obj)->poll_event = NULL; } while (false)
|
||||||
#else
|
#else
|
||||||
#define _INIT_OBJ_POLL_EVENT(obj) do { } while ((0))
|
#define _INIT_OBJ_POLL_EVENT(obj) do { } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* private - implementation data created as needed, per-type */
|
/* private - implementation data created as needed, per-type */
|
||||||
|
@ -4563,7 +4564,7 @@ extern void _sys_power_save_idle_exit(s32_t ticks);
|
||||||
printk("@ %s:%d:\n", __FILE__, __LINE__); \
|
printk("@ %s:%d:\n", __FILE__, __LINE__); \
|
||||||
_NanoFatalErrorHandler(reason, &_default_esf); \
|
_NanoFatalErrorHandler(reason, &_default_esf); \
|
||||||
CODE_UNREACHABLE; \
|
CODE_UNREACHABLE; \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#endif /* _ARCH__EXCEPT */
|
#endif /* _ARCH__EXCEPT */
|
||||||
|
|
||||||
|
@ -4605,7 +4606,7 @@ extern void _init_static_threads(void);
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
#define _init_static_threads() do { } while ((0))
|
#define _init_static_threads() do { } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <logging/log_msg.h>
|
#include <logging/log_msg.h>
|
||||||
#include <logging/log_instance.h>
|
#include <logging/log_instance.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -153,7 +154,7 @@ extern "C" {
|
||||||
do { \
|
do { \
|
||||||
u32_t args[] = {__LOG_ARGUMENTS(__VA_ARGS__)}; \
|
u32_t args[] = {__LOG_ARGUMENTS(__VA_ARGS__)}; \
|
||||||
log_n(_str, args, ARRAY_SIZE(args), _src_level); \
|
log_n(_str, args, ARRAY_SIZE(args), _src_level); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define _LOG_INTERNAL_4(_src_level, _str, ...) \
|
#define _LOG_INTERNAL_4(_src_level, _str, ...) \
|
||||||
_LOG_INTERNAL_LONG(_src_level, _str, __VA_ARGS__)
|
_LOG_INTERNAL_LONG(_src_level, _str, __VA_ARGS__)
|
||||||
|
@ -206,7 +207,7 @@ extern "C" {
|
||||||
/* evaluated once when log is enabled.*/ \
|
/* evaluated once when log is enabled.*/ \
|
||||||
log_printf_arg_checker(__VA_ARGS__); \
|
log_printf_arg_checker(__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define _LOG(_level, ...) \
|
#define _LOG(_level, ...) \
|
||||||
__LOG(_level, \
|
__LOG(_level, \
|
||||||
|
@ -237,7 +238,7 @@ extern "C" {
|
||||||
}; \
|
}; \
|
||||||
log_hexdump(_str, _data, _length, src_level); \
|
log_hexdump(_str, _data, _length, src_level); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define _LOG_HEXDUMP(_level, _data, _length, _str) \
|
#define _LOG_HEXDUMP(_level, _data, _length, _str) \
|
||||||
__LOG_HEXDUMP(_level, \
|
__LOG_HEXDUMP(_level, \
|
||||||
|
@ -286,7 +287,7 @@ extern "C" {
|
||||||
LOG_FILTER_SLOT_SHIFT(_id)); \
|
LOG_FILTER_SLOT_SHIFT(_id)); \
|
||||||
*(_filters) |= ((_filter) & LOG_FILTER_SLOT_MASK) << \
|
*(_filters) |= ((_filter) & LOG_FILTER_SLOT_MASK) << \
|
||||||
LOG_FILTER_SLOT_SHIFT(_id); \
|
LOG_FILTER_SLOT_SHIFT(_id); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#define LOG_FILTER_AGGR_SLOT_IDX 0
|
#define LOG_FILTER_AGGR_SLOT_IDX 0
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ extern void posix_exit(int exit_code);
|
||||||
(void)printk(fmt, ##__VA_ARGS__); \
|
(void)printk(fmt, ##__VA_ARGS__); \
|
||||||
__ASSERT_POST; \
|
__ASSERT_POST; \
|
||||||
} \
|
} \
|
||||||
} while ((0))
|
} while (false)
|
||||||
|
|
||||||
#define __ASSERT_EVAL(expr1, expr2, test, fmt, ...) \
|
#define __ASSERT_EVAL(expr1, expr2, test, fmt, ...) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
|
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
/* Helper to pass a int as a pointer or vice-versa.
|
/* Helper to pass a int as a pointer or vice-versa.
|
||||||
* Those are available for 32 bits architectures:
|
* Those are available for 32 bits architectures:
|
||||||
|
@ -181,7 +182,7 @@ static inline s64_t arithmetic_shift_right(s64_t value, u8_t shift)
|
||||||
* ENABLED: _IS_ENABLED3(_YYYY, 1, 0)
|
* ENABLED: _IS_ENABLED3(_YYYY, 1, 0)
|
||||||
* DISABLED _IS_ENABLED3(_XXXX 1, 0)
|
* DISABLED _IS_ENABLED3(_XXXX 1, 0)
|
||||||
*/
|
*/
|
||||||
#define _IS_ENABLED2(one_or_two_args) _IS_ENABLED3(one_or_two_args 1, 0)
|
#define _IS_ENABLED2(one_or_two_args) _IS_ENABLED3(one_or_two_args true, false)
|
||||||
|
|
||||||
/* And our second argument is thus now cooked to be 1 in the case
|
/* And our second argument is thus now cooked to be 1 in the case
|
||||||
* where the value is defined to 1, and 0 if not:
|
* where the value is defined to 1, and 0 if not:
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <net/net_core.h>
|
#include <net/net_core.h>
|
||||||
#include <net/ptp_time.h>
|
#include <net/ptp_time.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -170,7 +171,7 @@ struct gptp_hdr {
|
||||||
(uscaled_ns_ptr)->low = \
|
(uscaled_ns_ptr)->low = \
|
||||||
gptp_get_current_time_nanosecond(port) << 16; \
|
gptp_get_current_time_nanosecond(port) << 16; \
|
||||||
(uscaled_ns_ptr)->high = 0; \
|
(uscaled_ns_ptr)->high = 0; \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef gptp_phase_dis_callback_t
|
* @typedef gptp_phase_dis_callback_t
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Networking
|
* @brief Networking
|
||||||
* @defgroup networking Networking
|
* @defgroup networking Networking
|
||||||
|
@ -53,12 +55,12 @@ extern "C" {
|
||||||
#define NET_ASSERT(cond) do { \
|
#define NET_ASSERT(cond) do { \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
NET_ERR("{assert: '" #cond "' failed}"); \
|
NET_ERR("{assert: '" #cond "' failed}"); \
|
||||||
} } while (0)
|
} } while (false)
|
||||||
#define NET_ASSERT_INFO(cond, fmt, ...) do { \
|
#define NET_ASSERT_INFO(cond, fmt, ...) do { \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
NET_ERR("{assert: '" #cond "' failed} " fmt, \
|
NET_ERR("{assert: '" #cond "' failed} " fmt, \
|
||||||
##__VA_ARGS__); \
|
##__VA_ARGS__); \
|
||||||
} } while (0)
|
} } while (false)
|
||||||
#else /* NET_LOG_ENABLED */
|
#else /* NET_LOG_ENABLED */
|
||||||
#define NET_DBG(...)
|
#define NET_DBG(...)
|
||||||
#define NET_ERR(...)
|
#define NET_ERR(...)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_
|
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_
|
||||||
#define ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_
|
#define ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* @brief GCC toolchain abstraction
|
* @brief GCC toolchain abstraction
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <toolchain/common.h>
|
#include <toolchain/common.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define ALIAS_OF(of) __attribute__((alias(#of)))
|
#define ALIAS_OF(of) __attribute__((alias(#of)))
|
||||||
|
|
||||||
|
@ -85,7 +87,7 @@ do { \
|
||||||
} *__p = (__typeof__(__p)) (p); \
|
} *__p = (__typeof__(__p)) (p); \
|
||||||
__p->__v = (v); \
|
__p->__v = (v); \
|
||||||
compiler_barrier(); \
|
compiler_barrier(); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ do { \
|
||||||
__typeof__(*p) __v; \
|
__typeof__(*p) __v; \
|
||||||
} *__p = (__typeof__(__p)) (p); \
|
} *__p = (__typeof__(__p)) (p); \
|
||||||
__p->__v = (v); \
|
__p->__v = (v); \
|
||||||
} while (0)
|
} while (false)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -137,8 +139,8 @@ do { \
|
||||||
#define __deprecated __attribute__((deprecated))
|
#define __deprecated __attribute__((deprecated))
|
||||||
#define ARG_UNUSED(x) (void)(x)
|
#define ARG_UNUSED(x) (void)(x)
|
||||||
|
|
||||||
#define likely(x) __builtin_expect((long)!!(x), 1L)
|
#define likely(x) __builtin_expect((long)!!(x), true)
|
||||||
#define unlikely(x) __builtin_expect((long)!!(x), 0L)
|
#define unlikely(x) __builtin_expect((long)!!(x), false)
|
||||||
|
|
||||||
#define popcount(x) __builtin_popcount(x)
|
#define popcount(x) __builtin_popcount(x)
|
||||||
|
|
||||||
|
@ -364,6 +366,6 @@ A##a:
|
||||||
|
|
||||||
#define compiler_barrier() do { \
|
#define compiler_barrier() do { \
|
||||||
__asm__ __volatile__ ("" ::: "memory"); \
|
__asm__ __volatile__ ("" ::: "memory"); \
|
||||||
} while ((0))
|
} while (false)
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_ */
|
#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_ */
|
||||||
|
|
|
@ -27,7 +27,7 @@ s32_t _sys_idle_threshold_ticks = CONFIG_TICKLESS_IDLE_THRESH;
|
||||||
((ticks == K_FOREVER) || (ticks >= _sys_idle_threshold_ticks))
|
((ticks == K_FOREVER) || (ticks >= _sys_idle_threshold_ticks))
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define _must_enter_tickless_idle(ticks) ((void)ticks, (0))
|
#define _must_enter_tickless_idle(ticks) ((void)ticks, false)
|
||||||
#endif /* CONFIG_TICKLESS_IDLE */
|
#endif /* CONFIG_TICKLESS_IDLE */
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||||
|
@ -153,7 +153,7 @@ void _sys_power_save_idle_exit(s32_t ticks)
|
||||||
#if K_IDLE_PRIO < 0
|
#if K_IDLE_PRIO < 0
|
||||||
#define IDLE_YIELD_IF_COOP() k_yield()
|
#define IDLE_YIELD_IF_COOP() k_yield()
|
||||||
#else
|
#else
|
||||||
#define IDLE_YIELD_IF_COOP() do { } while ((0))
|
#define IDLE_YIELD_IF_COOP() do { } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void idle(void *unused1, void *unused2, void *unused3)
|
void idle(void *unused1, void *unused2, void *unused3)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <kernel_structs.h>
|
#include <kernel_structs.h>
|
||||||
#include <tracing.h>
|
#include <tracing.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef CONFIG_MULTITHREADING
|
#ifdef CONFIG_MULTITHREADING
|
||||||
#define _VALID_PRIO(prio, entry_point) \
|
#define _VALID_PRIO(prio, entry_point) \
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
(prio), \
|
(prio), \
|
||||||
K_LOWEST_APPLICATION_THREAD_PRIO, \
|
K_LOWEST_APPLICATION_THREAD_PRIO, \
|
||||||
K_HIGHEST_APPLICATION_THREAD_PRIO); \
|
K_HIGHEST_APPLICATION_THREAD_PRIO); \
|
||||||
} while ((0))
|
} while (false)
|
||||||
#else
|
#else
|
||||||
#define _VALID_PRIO(prio, entry_point) ((prio) == -1)
|
#define _VALID_PRIO(prio, entry_point) ((prio) == -1)
|
||||||
#define _ASSERT_VALID_PRIO(prio, entry_point) __ASSERT((prio) == -1, "")
|
#define _ASSERT_VALID_PRIO(prio, entry_point) __ASSERT((prio) == -1, "")
|
||||||
|
|
|
@ -122,7 +122,7 @@ K_THREAD_STACK_DEFINE(_interrupt_stack3, CONFIG_ISR_STACK_SIZE);
|
||||||
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
||||||
#define initialize_timeouts() do { \
|
#define initialize_timeouts() do { \
|
||||||
sys_dlist_init(&_timeout_q); \
|
sys_dlist_init(&_timeout_q); \
|
||||||
} while ((0))
|
} while (false)
|
||||||
#else
|
#else
|
||||||
#define initialize_timeouts() do { } while ((0))
|
#define initialize_timeouts() do { } while ((0))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <kernel_structs.h>
|
#include <kernel_structs.h>
|
||||||
#include <kernel_internal.h>
|
#include <kernel_internal.h>
|
||||||
#include <misc/__assert.h>
|
#include <misc/__assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
static u8_t max_partitions;
|
static u8_t max_partitions;
|
||||||
|
|
||||||
|
@ -26,7 +27,8 @@ static bool sane_partition(const struct k_mem_partition *part,
|
||||||
write = K_MEM_PARTITION_IS_WRITABLE(part->attr);
|
write = K_MEM_PARTITION_IS_WRITABLE(part->attr);
|
||||||
|
|
||||||
if (exec && write) {
|
if (exec && write) {
|
||||||
__ASSERT(0, "partition is writable and executable <start %x>",
|
__ASSERT(false,
|
||||||
|
"partition is writable and executable <start %x>",
|
||||||
part->start);
|
part->start);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +47,7 @@ static bool sane_partition(const struct k_mem_partition *part,
|
||||||
cur_exec = K_MEM_PARTITION_IS_EXECUTABLE(parts[i].attr);
|
cur_exec = K_MEM_PARTITION_IS_EXECUTABLE(parts[i].attr);
|
||||||
|
|
||||||
if ((cur_write && exec) || (cur_exec && write)) {
|
if ((cur_write && exec) || (cur_exec && write)) {
|
||||||
__ASSERT(0, "overlapping partitions are "
|
__ASSERT(false, "overlapping partitions are "
|
||||||
"writable and executable "
|
"writable and executable "
|
||||||
"<%x...%x>, <%x...%x>",
|
"<%x...%x>, <%x...%x>",
|
||||||
part->start, end,
|
part->start, end,
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
#include <syscall_handler.h>
|
#include <syscall_handler.h>
|
||||||
#include <tracing.h>
|
#include <tracing.h>
|
||||||
|
|
||||||
#define RECORD_STATE_CHANGE(mutex) do { } while ((0))
|
#define RECORD_STATE_CHANGE(mutex) do { } while (false)
|
||||||
#define RECORD_CONFLICT(mutex) do { } while ((0))
|
#define RECORD_CONFLICT(mutex) do { } while (false)
|
||||||
|
|
||||||
|
|
||||||
extern struct k_mutex _k_mutex_list_start[];
|
extern struct k_mutex _k_mutex_list_start[];
|
||||||
|
|
|
@ -67,7 +67,7 @@ static inline int is_condition_met(struct k_poll_event *event, u32_t *state)
|
||||||
case K_POLL_TYPE_IGNORE:
|
case K_POLL_TYPE_IGNORE:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
__ASSERT(0, "invalid event type (0x%x)\n", event->type);
|
__ASSERT(false, "invalid event type (0x%x)\n", event->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ static inline int register_event(struct k_poll_event *event,
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
__ASSERT(0, "invalid event type\n");
|
__ASSERT(false, "invalid event type\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ static inline void clear_event_registration(struct k_poll_event *event)
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
__ASSERT(0, "invalid event type\n");
|
__ASSERT(false, "invalid event type\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ int _impl_k_poll(struct k_poll_event *events, int num_events, s32_t timeout)
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
++last_registered;
|
++last_registered;
|
||||||
} else {
|
} else {
|
||||||
__ASSERT(0, "unexpected return code\n");
|
__ASSERT(false, "unexpected return code\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
irq_unlock(key);
|
irq_unlock(key);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue