Reduced MISRA annoyances.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7735 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2015-03-08 09:17:38 +00:00
parent f0abafaab1
commit 0fda3648f9
18 changed files with 32 additions and 147 deletions

View File

@ -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) */
/** @} */

View File

@ -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*/
}
/**

View File

@ -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*/

View File

@ -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*/
}
/**

View File

@ -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*/

View File

@ -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); \

View File

@ -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;
}

View File

@ -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();

View File

@ -280,11 +280,8 @@ void _dbg_trace(thread_t *otp) {
ch.dbg.trace_buffer.tb_ptr->se_tp = currp;
ch.dbg.trace_buffer.tb_ptr->se_wtobjp = otp->p_u.wtobjp;
ch.dbg.trace_buffer.tb_ptr->se_state = (uint8_t)otp->p_state;
/*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
is safe.*/
if (++ch.dbg.trace_buffer.tb_ptr >=
&ch.dbg.trace_buffer.tb_buffer[CH_DBG_TRACE_BUFFER_SIZE]) {
/*lint -restore*/
ch.dbg.trace_buffer.tb_ptr = &ch.dbg.trace_buffer.tb_buffer[0];
}
}

View File

@ -224,13 +224,10 @@ void chHeapFree(void *p) {
H_LOCK(heapp);
while (true) {
/*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
is safe.*/
chDbgAssert((hp < qp) || (hp >= LIMIT(qp)), "within free block");
if (((qp == &heapp->h_free) || (hp > qp)) &&
((qp->h.u.next == NULL) || (hp < qp->h.u.next))) {
/*lint -restore*/
/* Insertion after qp.*/
hp->h.u.next = qp->h.u.next;
qp->h.u.next = hp;

View File

@ -128,10 +128,7 @@ void chMBResetI(mailbox_t *mbp) {
mbp->mb_wrptr = mbp->mb_buffer;
mbp->mb_rdptr = mbp->mb_buffer;
/*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
is safe.*/
chSemResetI(&mbp->mb_emptysem, (cnt_t)(mbp->mb_top - mbp->mb_buffer));
/*lint -restore*/
chSemResetI(&mbp->mb_fullsem, 0);
}
@ -191,11 +188,8 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, timeout);
if (rdymsg == MSG_OK) {
*mbp->mb_wrptr = msg;
mbp->mb_wrptr++;
/*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
*mbp->mb_wrptr++ = msg;
if (mbp->mb_wrptr >= mbp->mb_top) {
/*lint -restore*/
mbp->mb_wrptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_fullsem);
@ -229,12 +223,9 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) {
}
chSemFastWaitI(&mbp->mb_emptysem);
*mbp->mb_wrptr = msg;
mbp->mb_wrptr++;
/*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
*mbp->mb_wrptr++ = msg;
if (mbp->mb_wrptr >= mbp->mb_top) {
/*lint -restore*/
mbp->mb_wrptr = mbp->mb_buffer;
mbp->mb_wrptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_fullsem);
@ -297,9 +288,7 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, timeout);
if (rdymsg == MSG_OK) {
/*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
if (--mbp->mb_rdptr < mbp->mb_buffer) {
/*lint -restore*/
mbp->mb_rdptr = mbp->mb_top - 1;
}
*mbp->mb_rdptr = msg;
@ -333,9 +322,7 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) {
return MSG_TIMEOUT;
}
chSemFastWaitI(&mbp->mb_emptysem);
/*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
if (--mbp->mb_rdptr < mbp->mb_buffer) {
/*lint -restore*/
mbp->mb_rdptr = mbp->mb_top - 1;
}
*mbp->mb_rdptr = msg;
@ -400,11 +387,8 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
rdymsg = chSemWaitTimeoutS(&mbp->mb_fullsem, timeout);
if (rdymsg == MSG_OK) {
*msgp = *mbp->mb_rdptr;
mbp->mb_rdptr++;
/*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
*msgp = *mbp->mb_rdptr++;
if (mbp->mb_rdptr >= mbp->mb_top) {
/*lint -restore*/
mbp->mb_rdptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_emptysem);
@ -437,11 +421,8 @@ msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp) {
return MSG_TIMEOUT;
}
chSemFastWaitI(&mbp->mb_fullsem);
*msgp = *mbp->mb_rdptr;
mbp->mb_rdptr++;
/*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
*msgp = *mbp->mb_rdptr++;
if (mbp->mb_rdptr >= mbp->mb_top) {
/*lint -restore*/
mbp->mb_rdptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_emptysem);

View File

@ -134,8 +134,7 @@ void *chCoreAllocI(size_t size) {
chDbgCheckClassI();
size = MEM_ALIGN_NEXT(size);
/*lint -save -e9033 -e946 -e947 [10.8, 18.2, 18.3] Normal pointers
arithmetic, it is safe.*/
/*lint -save -e9033 [10.8] The cast is safe.*/
if ((size_t)(endmem - nextmem) < size) {
/*lint -restore*/
return NULL;
@ -155,8 +154,7 @@ void *chCoreAllocI(size_t size) {
*/
size_t chCoreGetStatusX(void) {
/*lint -save -e9033 -e946 -e947 [10.8, 18.2, 18.3] Normal pointers
arithmetic, it is safe.*/
/*lint -save -e9033 [10.8] The cast is safe.*/
return (size_t)(endmem - nextmem);
/*lint -restore*/
}

View File

@ -139,12 +139,9 @@ msg_t chIQPutI(input_queue_t *iqp, uint8_t b) {
return Q_FULL;
}
*iqp->q_wrptr = b;
iqp->q_wrptr++;
iqp->q_counter++;
/*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
*iqp->q_wrptr++ = b;
if (iqp->q_wrptr >= iqp->q_top) {
/*lint -restore*/
iqp->q_wrptr = iqp->q_buffer;
}
@ -189,12 +186,9 @@ msg_t chIQGetTimeout(input_queue_t *iqp, systime_t timeout) {
}
}
b = *iqp->q_rdptr;
iqp->q_rdptr++;
iqp->q_counter--;
/*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
b = *iqp->q_rdptr++;
if (iqp->q_rdptr >= iqp->q_top) {
/*lint -restore*/
iqp->q_rdptr = iqp->q_buffer;
}
chSysUnlock();
@ -246,20 +240,15 @@ size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
}
}
*bp = *iqp->q_rdptr;
bp++;
iqp->q_rdptr++;
iqp->q_counter--;
/*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
*bp++ = *iqp->q_rdptr++;
if (iqp->q_rdptr >= iqp->q_top) {
/*lint -restore*/
iqp->q_rdptr = iqp->q_buffer;
}
chSysUnlock(); /* Gives a preemption chance in a controlled point.*/
r++;
n--;
if (n == 0U) {
if (--n == 0U) {
return r;
}
@ -350,12 +339,9 @@ msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout) {
}
}
*oqp->q_wrptr = b;
oqp->q_wrptr++;
oqp->q_counter--;
/*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
*oqp->q_wrptr++ = b;
if (oqp->q_wrptr >= oqp->q_top) {
/*lint -restore*/
oqp->q_wrptr = oqp->q_buffer;
}
@ -386,12 +372,9 @@ msg_t chOQGetI(output_queue_t *oqp) {
return Q_EMPTY;
}
b = *oqp->q_rdptr;
oqp->q_rdptr++;
oqp->q_counter++;
/*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
b = *oqp->q_rdptr++;
if (oqp->q_rdptr >= oqp->q_top) {
/*lint -restore*/
oqp->q_rdptr = oqp->q_buffer;
}
@ -439,13 +422,10 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
return w;
}
}
*oqp->q_wrptr = *bp;
bp++;
oqp->q_wrptr++;
oqp->q_counter--;
/*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
*oqp->q_wrptr++ = *bp++;
if (oqp->q_wrptr >= oqp->q_top) {
/*lint -restore*/
oqp->q_wrptr = oqp->q_buffer;
}
@ -455,8 +435,7 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
chSysUnlock(); /* Gives a preemption chance in a controlled point.*/
w++;
n--;
if (n == 0U) {
if (--n == 0U) {
return w;
}
chSysLock();

View File

@ -65,8 +65,8 @@
/*===========================================================================*/
#define _offsetof(st, m) \
/*lint -save -e9005 -e946 -e947 -e9033 -e413 [11.8, 18.2, 18.3, 10.8 1.3]
Normal pointers arithmetic, it is safe.*/ \
/*lint -save -e9005 -e9033 -e413 [11.8, 10.8 1.3] Normal pointers
arithmetic, it is safe.*/ \
((size_t)((char *)&((st *)0)->m - (char *)0)) \
/*lint -restore*/

View File

@ -67,10 +67,8 @@ void _scheduler_init(void) {
queue_init(&ch.rlist.r_queue);
ch.rlist.r_prio = NOPRIO;
#if CH_CFG_USE_REGISTRY == TRUE
/*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
ch.rlist.r_newer = (thread_t *)&ch.rlist;
ch.rlist.r_older = (thread_t *)&ch.rlist;
/*lint -restore*/
#endif
}
@ -87,12 +85,10 @@ void _scheduler_init(void) {
*/
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;
@ -109,9 +105,7 @@ void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) {
*/
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;
@ -131,9 +125,7 @@ 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;
}
@ -152,9 +144,7 @@ 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;
}
@ -235,9 +225,7 @@ thread_t *chSchReadyI(thread_t *tp) {
"invalid state");
tp->p_state = CH_STATE_READY;
/*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
cp = (thread_t *)&ch.rlist.r_queue;
/*lint -restore*/
do {
cp = cp->p_next;
} while (cp->p_prio >= tp->p_prio);
@ -285,9 +273,7 @@ void chSchGoSleepS(tstate_t newstate) {
* Timeout wakeup callback.
*/
static void wakeup(void *p) {
/*lint -save -e9087 [11.3] The real type is hidden but correct.*/
thread_t *tp = (thread_t *)p;
/*lint -restore*/
chSysLockFromISR();
switch (tp->p_state) {
@ -504,9 +490,7 @@ void chSchDoRescheduleAhead(void) {
currp->p_state = CH_STATE_CURRENT;
otp->p_state = CH_STATE_READY;
/*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
cp = (thread_t *)&ch.rlist.r_queue;
/*lint -restore*/
do {
cp = cp->p_next;
} while (cp->p_prio > otp->p_prio);

View File

@ -138,11 +138,8 @@ void chSysInit(void) {
/* This thread has the lowest priority in the system, its role is just to
serve interrupts in its context while keeping the lowest energy saving
mode compatible with the system status.*/
/*lint -save -e9074 -e9087 [11.3, 11.1] The idle thread returns void because
an optimization.*/
(void) chThdCreateStatic(ch.idle_thread_wa, sizeof(ch.idle_thread_wa),
IDLEPRIO, (tfunc_t)_idle_thread, NULL);
/*lint -restore*/
#endif
}

View File

@ -144,12 +144,8 @@ thread_t *_thread_init(thread_t *tp, tprio_t prio) {
*/
void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
/*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
is safe.*/
while (startp < endp) {
/*lint -restore*/
*startp = v;
startp++;
*startp++ = v;
}
}
#endif /* CH_DBG_FILL_THREADS */

View File

@ -60,10 +60,8 @@
*/
void _vt_init(void) {
/*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
ch.vtlist.vt_next = (virtual_timer_t *)&ch.vtlist;
ch.vtlist.vt_prev = (virtual_timer_t *)&ch.vtlist;
/*lint -restore*/
ch.vtlist.vt_delta = (systime_t)-1;
#if CH_CFG_ST_TIMEDELTA == 0
ch.vtlist.vt_systime = 0;
@ -115,9 +113,7 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
delay = (systime_t)CH_CFG_ST_TIMEDELTA;
}
/*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
if (&ch.vtlist == (virtual_timers_list_t *)p) {
/*lint -restore*/
/* The delta list is empty, the current time becomes the new
delta list base time.*/
ch.vtlist.vt_lasttime = now;
@ -183,9 +179,7 @@ void chVTDoResetI(virtual_timer_t *vtp) {
#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
{
/*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*/
/* Just removed the last element in the list, alarm timer stopped.*/
port_timer_stop_alarm();
}