MISRA fixes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13153 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-11-02 08:05:48 +00:00
parent a8ea66210b
commit dbe3e7f58c
8 changed files with 26 additions and 29 deletions

View File

@ -57,7 +57,7 @@
* @brief Working Areas alignment constant.
* @note It is the alignment to be enforced for thread working areas.
*/
#define PORT_WORKING_AREA_ALIGN (PORT_ENABLE_GUARD_PAGES == TRUE ? \
#define PORT_WORKING_AREA_ALIGN ((PORT_ENABLE_GUARD_PAGES == TRUE) ?\
32U : PORT_STACK_ALIGN)
/** @} */

View File

@ -467,7 +467,7 @@ struct nil_thread {
/* Note, the following union contains a pointer/value while the thread is
in a sleeping state or a wake-up message when the thread is made ready.*/
union {
msg_t msg; /**< @brief Wake-up message. */
msg_t msg; /**< @brief Wake-up/exit message. */
void *p; /**< @brief Generic pointer. */
nil_system_t *nsp; /**< @brief Pointer to nil base struct. */
thread_reference_t *trp; /**< @brief Pointer to thread reference.*/
@ -1070,7 +1070,7 @@ struct nil_system {
#define chSchWakeupS(ntp, msg) do { \
chSchReadyI(ntp, msg); \
chSchRescheduleS(); \
} while (0)
} while (false)
/**
* @brief Evaluates if a reschedule is required.
@ -1113,7 +1113,7 @@ struct nil_system {
#define chThdResumeS(trp, msg) do { \
chThdResumeI(trp, msg); \
chSchRescheduleS(); \
} while (0)
} while (false)
/**
* @brief Delays the invoking thread for the specified number of seconds.

View File

@ -203,7 +203,7 @@ typedef void (*evhandler_t)(eventid_t id);
*
* @iclass
*/
#define chEvtAddEventsI(events) (bool)(nil.current->epmask |= events)
#define chEvtAddEventsI(events) (nil.current->epmask |= events)
/**
* @brief Returns the events mask.

View File

@ -77,9 +77,9 @@
* @sclass
*/
#define chMsgReleaseS(tp, msg) do { \
chSchReadyI(tp, msg); \
(void) chSchReadyI(tp, msg); \
chSchRescheduleS(); \
} while (0)
} while (false)
/** @} */
/*===========================================================================*/

View File

@ -304,7 +304,7 @@ void chSysInit(void) {
/* Iterates through the list of threads to be auto-started.*/
tcp = nil_thd_configs;
do {
chThdCreateI(tcp);
(void) chThdCreateI(tcp);
tcp++;
} while (tcp->funcp != NULL);
#endif
@ -737,7 +737,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, sysinterval_t timeout) {
thread_t *chThdCreateI(const thread_config_t *tcp) {
thread_t *tp;
chDbgCheck((tcp->prio < CH_CFG_MAX_THREADS) &&
chDbgCheck((tcp->prio < (tprio_t)CH_CFG_MAX_THREADS) &&
(tcp->wbase != NULL) &&
MEM_IS_ALIGNED(tcp->wbase, PORT_WORKING_AREA_ALIGN) &&
(tcp->wend > tcp->wbase) &&
@ -830,7 +830,8 @@ void chThdExit(msg_t msg) {
#endif
/* Going into final state with exit message stored.*/
chSchGoSleepTimeoutS(NIL_STATE_FINAL, msg);
nil.current->u1.msg = msg;
(void) chSchGoSleepTimeoutS(NIL_STATE_FINAL, TIME_INFINITE);
/* The thread never returns here.*/
chDbgAssert(false, "zombies apocalypse");

View File

@ -237,14 +237,14 @@ eventflags_t chEvtGetAndClearFlags(event_listener_t *elp) {
* @brief Adds a set of event flags directly to the specified @p thread_t.
*
* @param[in] tp the thread to be signaled
* @param[in] mask the event flags set to be ORed
* @param[in] events the event flags set to be ORed
*
* @api
*/
void chEvtSignal(thread_t *tp, eventmask_t mask) {
void chEvtSignal(thread_t *tp, eventmask_t events) {
chSysLock();
chEvtSignalI(tp, mask);
chEvtSignalI(tp, events);
chSchRescheduleS();
chSysUnlock();
}
@ -257,16 +257,16 @@ void chEvtSignal(thread_t *tp, eventmask_t mask) {
* reschedule must not be performed in ISRs.
*
* @param[in] tp the thread to be signaled
* @param[in] mask the event flags set to be ORed
* @param[in] events the event flags set to be ORed
*
* @iclass
*/
void chEvtSignalI(thread_t *tp, eventmask_t mask) {
void chEvtSignalI(thread_t *tp, eventmask_t events) {
chDbgCheckClassI();
chDbgCheck(tp != NULL);
tp->epmask |= mask;
tp->epmask |= events;
if ((NIL_THD_IS_WTOREVT(tp) &&
((tp->epmask & tp->u1.ewmask) != (eventmask_t)0)) ||
(NIL_THD_IS_WTANDEVT(tp) &&

View File

@ -185,10 +185,6 @@ struct ch_oc_object {
* @p chCacheObjectInit() initializes it to @p NULL.
*/
void *dptr;
/**
* @brief Embedded data as an open array.
*/
uint8_t dbuf[];
};
/**

View File

@ -167,7 +167,7 @@ static oc_object_t *lru_get_last_s(objects_cache_t *ocp) {
while (true) {
/* Waiting for an object buffer to become available in the LRU.*/
chSemWaitS(&ocp->lru_sem);
(void) chSemWaitS(&ocp->lru_sem);
/* Now an object buffer is in the LRU for sure, taking it from the
LRU tail.*/
@ -208,7 +208,7 @@ static oc_object_t *lru_get_last_s(objects_cache_t *ocp) {
is written. It is responsibility of the write function to release
the buffer.*/
objp->obj_flags = OC_FLAG_INHASH | OC_FLAG_FORGET;
ocp->writef(ocp, objp, true);
(void) ocp->writef(ocp, objp, true);
/* Critical section enter again.*/
chSysLock();
@ -231,8 +231,8 @@ static oc_object_t *lru_get_last_s(objects_cache_t *ocp) {
* @param[in] objn number of elements in the objects table array
* @param[in] objsz size of elements in the objects table array, the
* minimum value is <tt>sizeof (oc_object_t)</tt>.
* @param[in] hashp pointer to the hash objects as an array of
* @p oc_object_t
* @param[in] objvp pointer to the hash objects as an array of structures
* starting with an @p oc_object_t
* @param[in] readf pointer to an object reader function
* @param[in] writef pointer to an object writer function
*
@ -248,8 +248,8 @@ void chCacheObjectInit(objects_cache_t *ocp,
oc_writef_t writef) {
chDbgCheck((ocp != NULL) && (hashp != NULL) && (objvp != NULL) &&
((hashn & (hashn - 1U)) == 0U) &&
(objn > (size_t)0) && (hashn >= objn) &&
((hashn & (hashn - (ucnt_t)1)) == (ucnt_t)0) &&
(objn > (ucnt_t)0) && (hashn >= objn) &&
(objsz >= sizeof (oc_object_t)) &&
((objsz & (PORT_NATURAL_ALIGN - 1U)) == 0U));
@ -283,9 +283,9 @@ void chCacheObjectInit(objects_cache_t *ocp,
objp->obj_key = 0U;
objp->obj_flags = OC_FLAG_INLRU;
objp->dptr = NULL;
objvp += objsz;
objvp = (void *)((uint8_t *)objvp + objsz);
objn--;
} while (objn > 0U);
} while (objn > (ucnt_t)0);
}
/**
@ -339,7 +339,7 @@ oc_object_t *chCacheGetObject(objects_cache_t *ocp,
chDbgAssert((objp->obj_flags & OC_FLAG_INLRU) == 0U, "in LRU");
/* Waiting on the buffer semaphore.*/
chSemWaitS(&objp->obj_sem);
(void) chSemWaitS(&objp->obj_sem);
}
}
else {