aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/src/chregistry.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-03-06 10:13:59 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-03-06 10:13:59 +0000
commita380d9ad03f2fcf950dad0f08652a03b738dc0e8 (patch)
tree78dfbd7a271ba17cbb8cd7383a5c7edcb87f448b /os/rt/src/chregistry.c
parentb53489d0e4252aafe5ada7466e0b3b7c4ad5aaaf (diff)
downloadChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.tar.gz
ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.tar.bz2
ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.zip
More MISRA.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7716 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/src/chregistry.c')
-rw-r--r--os/rt/src/chregistry.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/os/rt/src/chregistry.c b/os/rt/src/chregistry.c
index 157d90d11..bd49925af 100644
--- a/os/rt/src/chregistry.c
+++ b/os/rt/src/chregistry.c
@@ -46,7 +46,7 @@
*/
#include "ch.h"
-#if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__)
+#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Module exported variables. */
@@ -65,7 +65,10 @@
/*===========================================================================*/
#define _offsetof(st, m) \
- ((size_t)((char *)&((st *)0)->m - (char *)0))
+ /*lint -save -e946 -e947 -e9033 -e413 [18.2, 18.3, 10.8 1.3] Normal
+ pointers arithmetic, it is safe.*/ \
+ ((size_t)((char *)&((st *)0)->m - (char *)0)) \
+ /*lint -restore*/
/*===========================================================================*/
/* Module exported functions. */
@@ -89,14 +92,14 @@ ROMCONST chdebug_t ch_debug = {
(uint8_t)_offsetof(thread_t, p_newer),
(uint8_t)_offsetof(thread_t, p_older),
(uint8_t)_offsetof(thread_t, p_name),
-#if CH_DBG_ENABLE_STACK_CHECK
+#if CH_DBG_ENABLE_STACK_CHECK == TRUE
(uint8_t)_offsetof(thread_t, p_stklimit),
#else
(uint8_t)0,
#endif
(uint8_t)_offsetof(thread_t, p_state),
(uint8_t)_offsetof(thread_t, p_flags),
-#if CH_CFG_USE_DYNAMIC
+#if CH_CFG_USE_DYNAMIC == TRUE
(uint8_t)_offsetof(thread_t, p_refs),
#else
(uint8_t)0,
@@ -106,7 +109,7 @@ ROMCONST chdebug_t ch_debug = {
#else
(uint8_t)0,
#endif
-#if CH_DBG_THREADS_PROFILING
+#if CH_DBG_THREADS_PROFILING == TRUE
(uint8_t)_offsetof(thread_t, p_time)
#else
(uint8_t)0
@@ -130,7 +133,7 @@ thread_t *chRegFirstThread(void) {
chSysLock();
tp = ch.rlist.r_newer;
-#if CH_CFG_USE_DYNAMIC
+#if CH_CFG_USE_DYNAMIC == TRUE
tp->p_refs++;
#endif
chSysUnlock();
@@ -154,23 +157,25 @@ thread_t *chRegNextThread(thread_t *tp) {
chSysLock();
ntp = tp->p_newer;
+ /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
if (ntp == (thread_t *)&ch.rlist) {
+ /*lint -restore*/
ntp = NULL;
}
-#if CH_CFG_USE_DYNAMIC
+#if CH_CFG_USE_DYNAMIC == TRUE
else {
chDbgAssert(ntp->p_refs < 255, "too many references");
ntp->p_refs++;
}
#endif
chSysUnlock();
-#if CH_CFG_USE_DYNAMIC
+#if CH_CFG_USE_DYNAMIC == TRUE
chThdRelease(tp);
#endif
return ntp;
}
-#endif /* CH_CFG_USE_REGISTRY */
+#endif /* CH_CFG_USE_REGISTRY == TRUE */
/** @} */