aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/rt/include/chschd.h2
-rw-r--r--os/rt/include/chvt.h9
-rw-r--r--os/rt/ports/SIMIA32/chcore.h39
-rw-r--r--os/rt/src/chmemcore.c8
-rw-r--r--os/rt/src/chregistry.c4
-rw-r--r--os/rt/src/chschd.c4
-rw-r--r--os/rt/src/chsys.c3
-rw-r--r--test/rt/testbuild/Makefile2
-rw-r--r--test/rt/testbuild/pclint/waivers.lnt12
9 files changed, 53 insertions, 30 deletions
diff --git a/os/rt/include/chschd.h b/os/rt/include/chschd.h
index f57972a88..c106dd9b0 100644
--- a/os/rt/include/chschd.h
+++ b/os/rt/include/chschd.h
@@ -775,7 +775,7 @@ static inline void chSchPreemption(void) {
tprio_t p2 = currp->p_prio;
#if CH_CFG_TIME_QUANTUM > 0
- if (currp->p_preempt) {
+ if (currp->p_preempt > 0U) {
if (p1 > p2) {
chSchDoRescheduleAhead();
}
diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h
index d461ccbfa..fe55fcc19 100644
--- a/os/rt/include/chvt.h
+++ b/os/rt/include/chvt.h
@@ -447,14 +447,19 @@ 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;
- while (!(vtp = ch.vtlist.vt_next)->vt_delta) {
+ vtp = ch.vtlist.vt_next;
+ while (vtp->vt_delta == 0U) {
vtfunc_t fn = vtp->vt_func;
- vtp->vt_func = (vtfunc_t)NULL;
+ 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);
diff --git a/os/rt/ports/SIMIA32/chcore.h b/os/rt/ports/SIMIA32/chcore.h
index 06d9f9329..943dbaf6e 100644
--- a/os/rt/ports/SIMIA32/chcore.h
+++ b/os/rt/ports/SIMIA32/chcore.h
@@ -154,13 +154,17 @@ struct context {
/* Module macros. */
/*===========================================================================*/
-#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a)
+#define APUSH(p, a) do { \
+ (p) -= sizeof(void *); \
+ *(void **)(p) = (void*)(a); \
+} while (false)
/* Darwin requires the stack to be aligned to a 16-byte boundary at
* the time of a call instruction (in case the called function needs
* to save MMX registers). This aligns to 'mod' module 16, so that we'll end
* up with the right alignment after pushing the args. */
-#define AALIGN(p, mask, mod) p = (void *)((((uintptr_t)(p) - mod) & ~mask) + mod)
+#define AALIGN(p, mask, mod) \
+ p = (void *)((((uint32_t)(p) - (uint32_t)(mod)) & ~(uint32_t)(mask)) + (uint32_t)(mod)) \
/**
* @brief Platform dependent part of the @p chThdCreateI() API.
@@ -168,6 +172,7 @@ struct context {
* by an @p port_intctx structure.
*/
#define PORT_SETUP_CONTEXT(tp, workspace, wsize, pf, arg) { \
+ /*lint -save -e611 -e9033 -e9074 -e9087 [10.8, 11.1, 11.3] Valid casts.*/ \
uint8_t *esp = (uint8_t *)workspace + wsize; \
APUSH(esp, 0); \
uint8_t *savebp = esp; \
@@ -177,20 +182,20 @@ struct context {
APUSH(esp, 0); \
esp -= sizeof(struct port_intctx); \
((struct port_intctx *)esp)->eip = (void *)_port_thread_start; \
- ((struct port_intctx *)esp)->ebx = 0; \
- ((struct port_intctx *)esp)->edi = 0; \
- ((struct port_intctx *)esp)->esi = 0; \
+ ((struct port_intctx *)esp)->ebx = NULL; \
+ ((struct port_intctx *)esp)->edi = NULL; \
+ ((struct port_intctx *)esp)->esi = NULL; \
((struct port_intctx *)esp)->ebp = (void *)savebp; \
(tp)->p_ctx.esp = (struct port_intctx *)esp; \
+ /*lint -restore*/ \
}
/**
* @brief Computes the thread working area global size.
* @note There is no need to perform alignments in this macro.
*/
-#define PORT_WA_SIZE(n) (sizeof(void *) * 4 + \
+#define PORT_WA_SIZE(n) ((sizeof(void *) * 4U) + \
sizeof(struct port_intctx) + \
- sizeof(struct port_extctx) + \
((size_t)(n)) + \
((size_t)(PORT_INT_REQUIRED_STACK)))
@@ -229,9 +234,11 @@ struct context {
#ifdef __cplusplus
extern "C" {
#endif
+ /*lint -save -e950 [Dir-2.1] Non-ANSI keywords are fine in the port layer.*/
__attribute__((fastcall)) void port_switch(thread_t *ntp, thread_t *otp);
- __attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *),
+ __attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *p),
void *p);
+ /*lint -restore*/
void _sim_check_for_interrupts(void);
#ifdef __cplusplus
}
@@ -269,7 +276,7 @@ static inline syssts_t port_get_irq_status(void) {
*/
static inline bool port_irq_enabled(syssts_t sts) {
- return (sts & 1) == 0;
+ return (sts & 1U) == 0U;
}
/**
@@ -290,7 +297,7 @@ static inline bool port_is_isr_context(void) {
*/
static inline void port_lock(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
@@ -299,7 +306,7 @@ static inline void port_lock(void) {
*/
static inline void port_unlock(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
@@ -309,7 +316,7 @@ static inline void port_unlock(void) {
*/
static inline void port_lock_from_isr(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
@@ -319,7 +326,7 @@ static inline void port_lock_from_isr(void) {
*/
static inline void port_unlock_from_isr(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
@@ -327,7 +334,7 @@ static inline void port_unlock_from_isr(void) {
*/
static inline void port_disable(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
@@ -335,7 +342,7 @@ static inline void port_disable(void) {
*/
static inline void port_suspend(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
@@ -343,7 +350,7 @@ static inline void port_suspend(void) {
*/
static inline void port_enable(void) {
- asm volatile("nop");
+ __asm volatile ("nop");
}
/**
diff --git a/os/rt/src/chmemcore.c b/os/rt/src/chmemcore.c
index 2932e09f9..901fb5828 100644
--- a/os/rt/src/chmemcore.c
+++ b/os/rt/src/chmemcore.c
@@ -134,8 +134,8 @@ void *chCoreAllocI(size_t size) {
chDbgCheckClassI();
size = MEM_ALIGN_NEXT(size);
- /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
- is safe.*/
+ /*lint -save -e9033 -e946 -e947 [10.8, 18.2, 18.3] Normal pointers
+ arithmetic, it is safe.*/
if ((size_t)(endmem - nextmem) < size) {
/*lint -restore*/
return NULL;
@@ -155,8 +155,8 @@ void *chCoreAllocI(size_t size) {
*/
size_t chCoreGetStatusX(void) {
- /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
- is safe.*/
+ /*lint -save -e9033 -e946 -e947 [10.8, 18.2, 18.3] Normal pointers
+ arithmetic, it is safe.*/
return (size_t)(endmem - nextmem);
/*lint -restore*/
}
diff --git a/os/rt/src/chregistry.c b/os/rt/src/chregistry.c
index 76a5190b4..0b5e01681 100644
--- a/os/rt/src/chregistry.c
+++ b/os/rt/src/chregistry.c
@@ -65,8 +65,8 @@
/*===========================================================================*/
#define _offsetof(st, m) \
- /*lint -save -e946 -e947 -e9033 -e413 [18.2, 18.3, 10.8 1.3] Normal
- pointers arithmetic, it is safe.*/ \
+ /*lint -save -e9005 -e946 -e947 -e9033 -e413 [11.8, 18.2, 18.3, 10.8 1.3]
+ Normal pointers arithmetic, it is safe.*/ \
((size_t)((char *)&((st *)0)->m - (char *)0)) \
/*lint -restore*/
diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c
index ba377ac4a..6775b1a12 100644
--- a/os/rt/src/chschd.c
+++ b/os/rt/src/chschd.c
@@ -436,7 +436,7 @@ bool chSchIsPreemptionRequired(void) {
if the first thread on the ready queue has a higher priority.
Otherwise, if the running thread has used up its time quantum, reschedule
if the first thread on the ready queue has equal or higher priority.*/
- return currp->p_preempt ? p1 > p2 : p1 >= p2;
+ return (currp->p_preempt > 0U) ? (p1 > p2) : (p1 >= p2);
#else
/* If the round robin preemption feature is not enabled then performs a
simpler comparison.*/
@@ -526,7 +526,7 @@ void chSchDoReschedule(void) {
#if CH_CFG_TIME_QUANTUM > 0
/* If CH_CFG_TIME_QUANTUM is enabled then there are two different scenarios
to handle on preemption: time quantum elapsed or not.*/
- if (currp->p_preempt == 0) {
+ if (currp->p_preempt == 0U) {
/* The thread consumed its time quantum so it is enqueued behind threads
with same priority level, however, it acquires a new time quantum.*/
chSchDoRescheduleBehind();
diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c
index 4e2102b89..7754e546d 100644
--- a/os/rt/src/chsys.c
+++ b/os/rt/src/chsys.c
@@ -191,9 +191,10 @@ void chSysTimerHandlerI(void) {
#if CH_CFG_TIME_QUANTUM > 0
/* Running thread has not used up quantum yet? */
- if (currp->p_preempt > 0)
+ if (currp->p_preempt > 0U) {
/* Decrement remaining quantum.*/
currp->p_preempt--;
+ }
#endif
#if CH_DBG_THREADS_PROFILING == TRUE
currp->p_time++;
diff --git a/test/rt/testbuild/Makefile b/test/rt/testbuild/Makefile
index 10b7856b4..390eda422 100644
--- a/test/rt/testbuild/Makefile
+++ b/test/rt/testbuild/Makefile
@@ -128,7 +128,7 @@ clean:
-rm -fR .dep
misra:
- lint-nt -w1 pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(INCDIR) $(KERNSRC) > misra.txt
+ lint-nt -w3 pclint/co-gcc.lnt pclint/au-misra3.lnt pclint/waivers.lnt $(INCDIR) $(KERNSRC) > misra.txt
#
# Include the dependency files, should be the last of the makefile
diff --git a/test/rt/testbuild/pclint/waivers.lnt b/test/rt/testbuild/pclint/waivers.lnt
index 8f441be43..e6caa1612 100644
--- a/test/rt/testbuild/pclint/waivers.lnt
+++ b/test/rt/testbuild/pclint/waivers.lnt
@@ -9,7 +9,9 @@
/* Silencing common non-MISRA info generated by PCLint in -w3 mode. All of
them have been controlled. Other infos have been fixed in the code.*/
--e526 -e537 -e714 -e716 -e757 -e759 -e768 -e773 -e826 -e835 -e845
+-e526 -e537
+-e714 -e716 -e717 -e757 -e758 -e759 -e768 -e773
+-e826 -e830 -e835 -e845
/* Removing *advisory* directives and rules that would negatively impact
code readability or not avoidable.*/
@@ -30,10 +32,18 @@
-e9018 /* Rule-19.2 */
-e9024 /* Rule-20.10 */
+/* Waiver Directive 2.1, Rule 1.1, Rule 1.2, assembler is allowed in some
+ modules.*/
+-e950
+
/* Waiver Directive 4.10, PCLint is confused by the guard used in the CMSIS
header files, the guard is present, suppressing the noise.*/
-e451
+/* Waiver Rule 2.2, PCLint marks as pure functions that contain just arm
+ code, this does not mean that those functions do nothing.*/
+-e522
+
/* Waiver Rule 3.1, the sequence "//" is mandated by standard license
headers included on top of all source files. The sequence is part of the
license URL and cannot be removed.*/