From c76e31af89cefabf5e8376b425af16e6ebbfcb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Desbiens?= Date: Thu, 17 Sep 2026 09:45:22 -0400 Subject: [PATCH] Silenced the SMP MISRA shim's implicit conversions common_smp/src/tx_misra.c performs four implicit conversions that its monoprocessor twin makes explicit, and ignores a parameter the twin casts to void. Built with the warning set common_smp uses, the file reports five diagnostics that common/src/tx_misra.c does not: tx_misra.c:49 conversion to 'int' from 'UINT' may change the sign of the result tx_misra.c:93 conversion to 'ULONG' from 'int' may change the sign of the result tx_misra.c:151 the same tx_misra.c:221 the same tx_misra.c:624 unused parameter 'status' The two files are otherwise the same shim, so this is drift rather than a deliberate difference: common/src already carries (INT) on the memset value, (ULONG) on the three pointer differences, and (VOID)status. That the shim is the file reporting them is the reason to fix it. It exists to route the kernel's pointer conversions through functions a MISRA analysis can account for, and an implicit signed-to-unsigned conversion inside it is the class of construct it was written to remove. The test trees hide it. test/tx builds the kernel with -Werror, so the monoprocessor copy could never have regressed this way; test/smp has -Werror commented out, so the SMP copy warns and builds. Applying the monoprocessor form to all five sites. Object code is byte identical before and after, compared with --strip-debug at -m32 -std=c99 with TX_MISRA_ENABLE defined, so this changes diagnostics and nothing else. Assisted-by: Claude Code (Opus 5) --- common_smp/src/tx_misra.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common_smp/src/tx_misra.c b/common_smp/src/tx_misra.c index f5dd5f53d..f37cebaac 100644 --- a/common_smp/src/tx_misra.c +++ b/common_smp/src/tx_misra.c @@ -47,7 +47,7 @@ /**************************************************************************/ VOID _tx_misra_memset(VOID *ptr, UINT value, UINT size) { - memset(ptr, value, size); + memset(ptr, (INT)value, size); } @@ -91,7 +91,7 @@ ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2) ULONG value; - value = ptr1 - ptr2; + value = (ULONG)(ptr1 - ptr2); return(value); } @@ -149,7 +149,7 @@ ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2) { ULONG value; - value = ptr1 - ptr2; + value = (ULONG)(ptr1 - ptr2); return(value); } @@ -219,7 +219,7 @@ ULONG _tx_misra_timer_pointer_dif(TX_TIMER_INTERNAL **ptr1, TX_TIMER_INTERNAL * ULONG value; - value = ptr1 - ptr2; + value = (ULONG)(ptr1 - ptr2); return(value); } @@ -625,6 +625,8 @@ TX_MUTEX *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer) UINT _tx_misra_status_get(UINT status) { + (VOID)status; + /* Return a successful status. */ return(TX_SUCCESS); }