diff --git a/os/oslib/src/chfactory.c b/os/oslib/src/chfactory.c index 6ceda1c28..8490026c7 100644 --- a/os/oslib/src/chfactory.c +++ b/os/oslib/src/chfactory.c @@ -85,13 +85,14 @@ objects_factory_t ch_factory; static void copy_name(const char *sp, char *dp) { unsigned i; + char c; - i = 0U; - while ((*sp != (char)0) && (i++ < CH_CFG_FACTORY_MAX_NAMES_LENGTH)) { - *dp = *sp; - sp++; - dp++; - } + i = CH_CFG_FACTORY_MAX_NAMES_LENGTH; + do { + c = *sp++; + *dp++ = c; + i--; + } while ((c != (char)0) && (i > 0U)); } static inline void dyn_list_init(dyn_list_t *dlp) { diff --git a/os/rt/include/chregistry.h b/os/rt/include/chregistry.h index b67dda4b6..ef03c9f4c 100644 --- a/os/rt/include/chregistry.h +++ b/os/rt/include/chregistry.h @@ -83,7 +83,7 @@ typedef struct { #define REG_REMOVE(tp) do { \ (tp)->older->newer = (tp)->newer; \ (tp)->newer->older = (tp)->older; \ -} while (0) +} while (false) /** * @brief Adds a thread to the registry list. @@ -97,7 +97,7 @@ typedef struct { (tp)->older = (oip)->rlist.older; \ (tp)->older->newer = (tp); \ (oip)->rlist.older = (tp); \ -} while (0) +} while (false) /*===========================================================================*/ /* External declarations. */ diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c index 6ea32a77d..23a739f08 100644 --- a/os/rt/src/chschd.c +++ b/os/rt/src/chschd.c @@ -90,7 +90,6 @@ static void __idle_thread(void *p) { * * @notapi */ -__attribute__((noinline)) static thread_t *__sch_ready_behind(os_instance_t *oip, thread_t *tp) { chDbgAssert((tp->state != CH_STATE_READY) && @@ -125,7 +124,6 @@ static thread_t *__sch_ready_behind(os_instance_t *oip, thread_t *tp) { * * @notapi */ -__attribute__((noinline)) static thread_t *__sch_ready_ahead(os_instance_t *oip, thread_t *tp) { chDbgAssert((tp->state != CH_STATE_READY) && @@ -725,7 +723,7 @@ thread_t *chSchSelectFirstI(void) { } /* Placing in ready list ahead of peers.*/ - __sch_ready_ahead(oip, otp); + (void) __sch_ready_ahead(oip, otp); return ntp; } diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c index 8ff465a76..24231deaf 100644 --- a/os/rt/src/chvt.c +++ b/os/rt/src/chvt.c @@ -60,6 +60,7 @@ static inline bool is_vtlist_empty(delta_list_t *dlhp) { return (bool)(dlhp == dlhp->next); } +#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__) /** * @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); } -#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__) /** * @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 time stamp. Note that this fails if the interval is larger than a 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");