From b53489d0e4252aafe5ada7466e0b3b7c4ad5aaaf Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 5 Mar 2015 21:28:51 +0000 Subject: Lots of MISRA-related changes in RT. Not finished yet. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7715 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/include/chdebug.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'os/rt/include/chdebug.h') diff --git a/os/rt/include/chdebug.h b/os/rt/include/chdebug.h index 728d9bf35..2e4b846f3 100644 --- a/os/rt/include/chdebug.h +++ b/os/rt/include/chdebug.h @@ -74,7 +74,7 @@ /* Module data structures and types. */ /*===========================================================================*/ -#if CH_DBG_ENABLE_TRACE || defined(__DOXYGEN__) +#if (CH_DBG_ENABLE_TRACE == TRUE) || defined(__DOXYGEN__) /** * @brief Trace buffer record. */ @@ -120,14 +120,14 @@ typedef struct { /* Module macros. */ /*===========================================================================*/ -#if CH_DBG_SYSTEM_STATE_CHECK +#if CH_DBG_SYSTEM_STATE_CHECK == TRUE #define _dbg_enter_lock() (ch.dbg.lock_cnt = 1) #define _dbg_leave_lock() (ch.dbg.lock_cnt = 0) #endif /* When the state checker feature is disabled then the following functions are replaced by an empty macro.*/ -#if !CH_DBG_SYSTEM_STATE_CHECK +#if CH_DBG_SYSTEM_STATE_CHECK == FALSE #define _dbg_enter_lock() #define _dbg_leave_lock() #define _dbg_check_disable() @@ -145,7 +145,7 @@ typedef struct { /* When the trace feature is disabled this function is replaced by an empty macro.*/ -#if !CH_DBG_ENABLE_TRACE +#if CH_DBG_ENABLE_TRACE == FALSE #define _dbg_trace(otp) #endif @@ -164,11 +164,15 @@ typedef struct { * @api */ #if !defined(chDbgCheck) +#if CH_DBG_ENABLE_CHECKS #define chDbgCheck(c) do { \ - if (CH_DBG_ENABLE_CHECKS && !(c)) { \ + if (!(c)) { \ chSysHalt(__func__); \ } \ -} while (0) +} while (false) +#else +#define chDbgCheck(c) +#endif #endif /* !defined(chDbgCheck) */ /** @@ -186,11 +190,15 @@ typedef struct { * @api */ #if !defined(chDbgAssert) +#if CH_DBG_ENABLE_ASSERTS == TRUE #define chDbgAssert(c, r) do { \ - if (CH_DBG_ENABLE_ASSERTS && !(c)) { \ + if (!(c)) { \ chSysHalt(__func__); \ } \ -} while (0) +} while (false) +#else +#define chDbgAssert(c, r) +#endif #endif /* !defined(chDbgAssert) */ /** @} */ @@ -201,7 +209,7 @@ typedef struct { #ifdef __cplusplus extern "C" { #endif -#if CH_DBG_SYSTEM_STATE_CHECK +#if CH_DBG_SYSTEM_STATE_CHECK == TRUE void _dbg_check_disable(void); void _dbg_check_suspend(void); void _dbg_check_enable(void); @@ -214,7 +222,7 @@ extern "C" { void chDbgCheckClassI(void); void chDbgCheckClassS(void); #endif -#if CH_DBG_ENABLE_TRACE || defined(__DOXYGEN__) +#if (CH_DBG_ENABLE_TRACE == TRUE) || defined(__DOXYGEN__) void _dbg_trace_init(void); void _dbg_trace(thread_t *otp); #endif -- cgit v1.2.3