aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/include
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-03-08 09:17:38 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-03-08 09:17:38 +0000
commit0fda3648f96f5fe9b1b14870d1e51375901fc348 (patch)
tree8e04fa7b971a51814b88c4ab877e9874076ae456 /os/rt/include
parentf0abafaab1bf40ee24cee1670aef6989690b0135 (diff)
downloadChibiOS-0fda3648f96f5fe9b1b14870d1e51375901fc348.tar.gz
ChibiOS-0fda3648f96f5fe9b1b14870d1e51375901fc348.tar.bz2
ChibiOS-0fda3648f96f5fe9b1b14870d1e51375901fc348.zip
Reduced MISRA annoyances.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7735 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/include')
-rw-r--r--os/rt/include/chdebug.h24
-rw-r--r--os/rt/include/chevents.h4
-rw-r--r--os/rt/include/chmboxes.h2
-rw-r--r--os/rt/include/chmsg.h2
-rw-r--r--os/rt/include/chqueues.h2
-rw-r--r--os/rt/include/chregistry.h2
-rw-r--r--os/rt/include/chschd.h20
-rw-r--r--os/rt/include/chvt.h8
8 files changed, 13 insertions, 51 deletions
diff --git a/os/rt/include/chdebug.h b/os/rt/include/chdebug.h
index a839813d7..893ec26b1 100644
--- a/os/rt/include/chdebug.h
+++ b/os/rt/include/chdebug.h
@@ -164,15 +164,15 @@ typedef struct {
* @api
*/
#if !defined(chDbgCheck)
-#if CH_DBG_ENABLE_CHECKS
#define chDbgCheck(c) do { \
- if (!(c)) { \
- chSysHalt(__func__); \
+ /*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
+ if (CH_DBG_ENABLE_CHECKS != FALSE) { \
+ if (!(c)) { \
+ /*lint -restore*/ \
+ chSysHalt(__func__); \
+ } \
} \
} while (false)
-#else
-#define chDbgCheck(c)
-#endif
#endif /* !defined(chDbgCheck) */
/**
@@ -190,17 +190,15 @@ typedef struct {
* @api
*/
#if !defined(chDbgAssert)
-#if CH_DBG_ENABLE_ASSERTS == TRUE
#define chDbgAssert(c, r) do { \
- /*lint -save -e506 -e774 [2.1, 14.3] Can be a constant.*/ \
- if (!(c)) { \
+ /*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
+ if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
+ if (!(c)) { \
/*lint -restore*/ \
- chSysHalt(__func__); \
+ chSysHalt(__func__); \
+ } \
} \
} while (false)
-#else
-#define chDbgAssert(c, r)
-#endif
#endif /* !defined(chDbgAssert) */
/** @} */
diff --git a/os/rt/include/chevents.h b/os/rt/include/chevents.h
index 9e06f897c..e58836f2e 100644
--- a/os/rt/include/chevents.h
+++ b/os/rt/include/chevents.h
@@ -169,9 +169,7 @@ extern "C" {
*/
static inline void chEvtObjectInit(event_source_t *esp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
esp->es_next = (event_listener_t *)esp;
- /*lint -restore*/
}
/**
@@ -225,9 +223,7 @@ static inline void chEvtRegister(event_source_t *esp,
*/
static inline bool chEvtIsListeningI(event_source_t *esp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
return (bool)(esp != (event_source_t *)esp->es_next);
- /*lint -restore*/
}
/**
diff --git a/os/rt/include/chmboxes.h b/os/rt/include/chmboxes.h
index 6cf12abb5..f4a52ae90 100644
--- a/os/rt/include/chmboxes.h
+++ b/os/rt/include/chmboxes.h
@@ -137,7 +137,7 @@ extern "C" {
*/
static inline size_t chMBGetSizeI(mailbox_t *mbp) {
- /*lint -save -e946 -e947 -e9033 [18.2, 18.3, 10.8] Perfectly safe pointers
+ /*lint -save -e9033 [10.8] Perfectly safe pointers
arithmetic.*/
return (size_t)(mbp->mb_top - mbp->mb_buffer);
/*lint -restore*/
diff --git a/os/rt/include/chmsg.h b/os/rt/include/chmsg.h
index 0420562c3..61c117e75 100644
--- a/os/rt/include/chmsg.h
+++ b/os/rt/include/chmsg.h
@@ -80,9 +80,7 @@ static inline bool chMsgIsPendingI(thread_t *tp) {
chDbgCheckClassI();
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
return (bool)(tp->p_msgqueue.p_next != (thread_t *)&tp->p_msgqueue);
- /*lint -restore*/
}
/**
diff --git a/os/rt/include/chqueues.h b/os/rt/include/chqueues.h
index f07990629..079b417d5 100644
--- a/os/rt/include/chqueues.h
+++ b/os/rt/include/chqueues.h
@@ -201,7 +201,7 @@ typedef io_queue_t output_queue_t;
* @xclass
*/
#define chQSizeX(qp) \
- /*lint -save -e946 -e947 -e9033 [18.2, 18.3, 10.8] Perfectly safe.*/ \
+ /*lint -save -e9033 [10.8] The cast is safe.*/ \
((size_t)((qp)->q_top - (qp)->q_buffer)) \
/*lint -restore*/
diff --git a/os/rt/include/chregistry.h b/os/rt/include/chregistry.h
index 501ae7cd0..ca90f26dd 100644
--- a/os/rt/include/chregistry.h
+++ b/os/rt/include/chregistry.h
@@ -114,9 +114,7 @@ typedef struct {
* @param[in] tp thread to add to the registry
*/
#define REG_INSERT(tp) { \
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/ \
(tp)->p_newer = (thread_t *)&ch.rlist; \
- /*lint -restore*/ \
(tp)->p_older = ch.rlist.r_older; \
(tp)->p_older->p_newer = (tp); \
ch.rlist.r_older = (tp); \
diff --git a/os/rt/include/chschd.h b/os/rt/include/chschd.h
index 78fac0004..4d3319817 100644
--- a/os/rt/include/chschd.h
+++ b/os/rt/include/chschd.h
@@ -559,9 +559,7 @@ extern "C" {
*/
static inline void list_init(threads_list_t *tlp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tlp->p_next = (thread_t *)tlp;
- /*lint -restore*/
}
/**
@@ -574,9 +572,7 @@ static inline void list_init(threads_list_t *tlp) {
*/
static inline bool list_isempty(threads_list_t *tlp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
return (bool)(tlp->p_next == (thread_t *)tlp);
- /*lint -restore*/
}
/**
@@ -589,9 +585,7 @@ static inline bool list_isempty(threads_list_t *tlp) {
*/
static inline bool list_notempty(threads_list_t *tlp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
return (bool)(tlp->p_next != (thread_t *)tlp);
- /*lint -restore*/
}
/**
@@ -603,10 +597,8 @@ static inline bool list_notempty(threads_list_t *tlp) {
*/
static inline void queue_init(threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tqp->p_next = (thread_t *)tqp;
tqp->p_prev = (thread_t *)tqp;
- /*lint -restore*/
}
/**
@@ -619,9 +611,7 @@ static inline void queue_init(threads_queue_t *tqp) {
*/
static inline bool queue_isempty(const threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
return (bool)(tqp->p_next == (const thread_t *)tqp);
- /*lint -restore*/
}
/**
@@ -634,9 +624,7 @@ static inline bool queue_isempty(const threads_queue_t *tqp) {
*/
static inline bool queue_notempty(const threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
return (bool)(tqp->p_next != (const thread_t *)tqp);
- /*lint -restore*/
}
/* If the performance code path has been chosen then all the following
@@ -658,12 +646,10 @@ static inline thread_t *list_remove(threads_list_t *tlp) {
static inline void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
thread_t *cp = (thread_t *)tqp;
do {
cp = cp->p_next;
} while ((cp != (thread_t *)tqp) && (cp->p_prio >= tp->p_prio));
- /*lint -restore*/
tp->p_next = cp;
tp->p_prev = cp->p_prev;
tp->p_prev->p_next = tp;
@@ -672,9 +658,7 @@ static inline void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) {
static inline void queue_insert(thread_t *tp, threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tp->p_next = (thread_t *)tqp;
- /*lint -restore*/
tp->p_prev = tqp->p_prev;
tp->p_prev->p_next = tp;
tqp->p_prev = tp;
@@ -684,9 +668,7 @@ static inline thread_t *queue_fifo_remove(threads_queue_t *tqp) {
thread_t *tp = tqp->p_next;
tqp->p_next = tp->p_next;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tqp->p_next->p_prev = (thread_t *)tqp;
- /*lint -restore*/
return tp;
}
@@ -695,9 +677,7 @@ static inline thread_t *queue_lifo_remove(threads_queue_t *tqp) {
thread_t *tp = tqp->p_prev;
tqp->p_prev = tp->p_prev;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tqp->p_prev->p_next = (thread_t *)tqp;
- /*lint -restore*/
return tp;
}
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h
index 71a8c6bbf..2d7d36f29 100644
--- a/os/rt/include/chvt.h
+++ b/os/rt/include/chvt.h
@@ -447,9 +447,7 @@ static inline void chVTDoTickI(void) {
#if CH_CFG_ST_TIMEDELTA == 0
ch.vtlist.vt_systime++;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
if (&ch.vtlist != (virtual_timers_list_t *)ch.vtlist.vt_next) {
- /*lint -restore*/
virtual_timer_t *vtp;
--ch.vtlist.vt_next->vt_delta;
@@ -459,9 +457,7 @@ static inline void chVTDoTickI(void) {
vtp = ch.vtlist.vt_next;
fn = vtp->vt_func;
vtp->vt_func = NULL;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
vtp->vt_next->vt_prev = (virtual_timer_t *)&ch.vtlist;
- /*lint -restore*/
ch.vtlist.vt_next = vtp->vt_next;
chSysUnlockFromISR();
fn(vtp->vt_par);
@@ -493,9 +489,7 @@ static inline void chVTDoTickI(void) {
ch.vtlist.vt_lasttime += vtp->vt_delta;
/* The timer is removed from the list and marked as non-armed.*/
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
vtp->vt_next->vt_prev = (virtual_timer_t *)&ch.vtlist;
- /*lint -restore*/
ch.vtlist.vt_next = vtp->vt_next;
fn = vtp->vt_func;
vtp->vt_func = NULL;
@@ -505,9 +499,7 @@ static inline void chVTDoTickI(void) {
fn(vtp->vt_par);
chSysLockFromISR();
}
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
- /*lint -restore*/
/* The list is empty, no tick event needed so the alarm timer
is stopped.*/
port_timer_stop_alarm();