MISRA-related fixes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13973 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2020-12-20 09:37:02 +00:00
parent f56587102a
commit 7802b82505
4 changed files with 12 additions and 13 deletions

View File

@ -85,13 +85,14 @@ objects_factory_t ch_factory;
static void copy_name(const char *sp, char *dp) { static void copy_name(const char *sp, char *dp) {
unsigned i; unsigned i;
char c;
i = 0U; i = CH_CFG_FACTORY_MAX_NAMES_LENGTH;
while ((*sp != (char)0) && (i++ < CH_CFG_FACTORY_MAX_NAMES_LENGTH)) { do {
*dp = *sp; c = *sp++;
sp++; *dp++ = c;
dp++; i--;
} } while ((c != (char)0) && (i > 0U));
} }
static inline void dyn_list_init(dyn_list_t *dlp) { static inline void dyn_list_init(dyn_list_t *dlp) {

View File

@ -83,7 +83,7 @@ typedef struct {
#define REG_REMOVE(tp) do { \ #define REG_REMOVE(tp) do { \
(tp)->older->newer = (tp)->newer; \ (tp)->older->newer = (tp)->newer; \
(tp)->newer->older = (tp)->older; \ (tp)->newer->older = (tp)->older; \
} while (0) } while (false)
/** /**
* @brief Adds a thread to the registry list. * @brief Adds a thread to the registry list.
@ -97,7 +97,7 @@ typedef struct {
(tp)->older = (oip)->rlist.older; \ (tp)->older = (oip)->rlist.older; \
(tp)->older->newer = (tp); \ (tp)->older->newer = (tp); \
(oip)->rlist.older = (tp); \ (oip)->rlist.older = (tp); \
} while (0) } while (false)
/*===========================================================================*/ /*===========================================================================*/
/* External declarations. */ /* External declarations. */

View File

@ -90,7 +90,6 @@ static void __idle_thread(void *p) {
* *
* @notapi * @notapi
*/ */
__attribute__((noinline))
static thread_t *__sch_ready_behind(os_instance_t *oip, thread_t *tp) { static thread_t *__sch_ready_behind(os_instance_t *oip, thread_t *tp) {
chDbgAssert((tp->state != CH_STATE_READY) && chDbgAssert((tp->state != CH_STATE_READY) &&
@ -125,7 +124,6 @@ static thread_t *__sch_ready_behind(os_instance_t *oip, thread_t *tp) {
* *
* @notapi * @notapi
*/ */
__attribute__((noinline))
static thread_t *__sch_ready_ahead(os_instance_t *oip, thread_t *tp) { static thread_t *__sch_ready_ahead(os_instance_t *oip, thread_t *tp) {
chDbgAssert((tp->state != CH_STATE_READY) && chDbgAssert((tp->state != CH_STATE_READY) &&
@ -725,7 +723,7 @@ thread_t *chSchSelectFirstI(void) {
} }
/* Placing in ready list ahead of peers.*/ /* Placing in ready list ahead of peers.*/
__sch_ready_ahead(oip, otp); (void) __sch_ready_ahead(oip, otp);
return ntp; return ntp;
} }

View File

@ -60,6 +60,7 @@ static inline bool is_vtlist_empty(delta_list_t *dlhp) {
return (bool)(dlhp == dlhp->next); return (bool)(dlhp == dlhp->next);
} }
#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
/** /**
* @brief Last timer in the list check. * @brief Last timer in the list check.
* *
@ -99,7 +100,6 @@ static inline bool is_timer(delta_list_t *dlhp, delta_list_t *dlp) {
return (bool)(dlp != dlhp); return (bool)(dlp != dlhp);
} }
#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
/** /**
* @brief Delta list compression. * @brief Delta list compression.
* *
@ -504,7 +504,7 @@ systimestamp_t chVTGetTimeStampI(void) {
/* Interval between the last time stamp and current time used for a new /* Interval between the last time stamp and current time used for a new
time stamp. Note that this fails if the interval is larger than a time stamp. Note that this fails if the interval is larger than a
systime_t type.*/ systime_t type.*/
stamp = last + (systimestamp_t)chTimeDiffX((sysinterval_t)last, now); stamp = last + (systimestamp_t)chTimeDiffX((systime_t)last, now);
chDbgAssert(ch.vtlist.laststamp <= stamp, "wrapped"); chDbgAssert(ch.vtlist.laststamp <= stamp, "wrapped");