From 88fc433e5dfc3ddc3948d27b78be2e531113fa1e Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 3 Apr 2016 09:27:34 +0000 Subject: MISRA-related fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9229 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/include/chalign.h | 11 ++++++++--- os/rt/include/chdebug.h | 16 ++++++++-------- os/rt/include/chsys.h | 4 ++++ 3 files changed, 20 insertions(+), 11 deletions(-) (limited to 'os/rt/include') diff --git a/os/rt/include/chalign.h b/os/rt/include/chalign.h index 9662b3b2f..b2065923e 100644 --- a/os/rt/include/chalign.h +++ b/os/rt/include/chalign.h @@ -64,7 +64,10 @@ * @param[in] p variable to be aligned * @param[in] a alignment, must be a power of two */ -#define MEM_ALIGN_PREV(p, a) ((size_t)(p) & ~MEM_ALIGN_MASK(a)) +#define MEM_ALIGN_PREV(p, a) \ + /*lint -save -e9033 [10.8] The cast is safe.*/ \ + ((size_t)(p) & ~MEM_ALIGN_MASK(a)) \ + /*lint -restore*/ /** * @brief Aligns to the new aligned memory address. @@ -72,8 +75,10 @@ * @param[in] p variable to be aligned * @param[in] a alignment, must be a power of two */ -#define MEM_ALIGN_NEXT(p, a) MEM_ALIGN_PREV((size_t)(p) + \ - MEM_ALIGN_MASK(a), (a)) +#define MEM_ALIGN_NEXT(p, a) \ + /*lint -save -e9033 [10.8] The cast is safe.*/ \ + MEM_ALIGN_PREV((size_t)(p) + MEM_ALIGN_MASK(a), (a)) \ + /*lint -restore*/ /** * @brief Returns whatever a pointer or memory size is aligned. diff --git a/os/rt/include/chdebug.h b/os/rt/include/chdebug.h index f1a4230f4..a6631fffb 100644 --- a/os/rt/include/chdebug.h +++ b/os/rt/include/chdebug.h @@ -244,17 +244,17 @@ typedef struct { /* When a trace feature is disabled the associated functions are replaced by an empty macro.*/ -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) == 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) == 0U #define _dbg_trace_switch(otp) #endif -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) == 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) == 0U #define _dbg_trace_isr_enter(isr) #define _dbg_trace_isr_leave(isr) #endif -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) == 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) == 0U #define _dbg_trace_halt(reason) #endif -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) == 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) == 0U #define chDbgWriteTraceI(up1, up2) #define chDbgWriteTrace(up1, up2) #endif @@ -334,17 +334,17 @@ extern "C" { #endif #if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_NONE) || defined(__DOXYGEN__) void _dbg_trace_init(void); -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) != 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) != 0U void _dbg_trace_switch(thread_t *otp); #endif -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) != 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) != 0U void _dbg_trace_isr_enter(const char *isr); void _dbg_trace_isr_leave(const char *isr); #endif -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) != 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) != 0U void _dbg_trace_halt(const char *reason); #endif -#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) != 0 +#if (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) != 0U void chDbgWriteTraceI(void *up1, void *up2); void chDbgWriteTrace(void *up1, void *up2); void chDbgSuspendTraceI(uint16_t mask); diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h index 5e90f0a35..3f51244d5 100644 --- a/os/rt/include/chsys.h +++ b/os/rt/include/chsys.h @@ -295,6 +295,10 @@ /* External declarations. */ /*===========================================================================*/ +#if !defined(__DOXYGEN__) +extern stkalign_t ch_idle_thread_wa[]; +#endif + #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.3