common_smp/src/tx_misra.c and common/src/tx_misra.c are the same shim, but the SMP copy performs four implicit conversions the monoprocessor copy makes explicit, and ignores a parameter the monoprocessor copy casts to void.
Compiled at -m32 -std=c99 with TX_MISRA_ENABLE defined and the warning set common_smp is built with (-Wall -Wextra -pedantic -Wconversion -Wmissing-declarations -Wunused -Wuninitialized -Wpointer-arith -Wlogical-op -Waggregate-return -Wfloat-equal), on gcc 14.2.0:
common_smp/src/tx_misra.c:49:17 conversion to 'int' from 'UINT' may change the sign of the result [-Wsign-conversion]
common_smp/src/tx_misra.c:93:14 conversion to 'ULONG' from 'int' may change the sign of the result [-Wsign-conversion]
common_smp/src/tx_misra.c:151:14 conversion to 'ULONG' from 'int' may change the sign of the result [-Wsign-conversion]
common_smp/src/tx_misra.c:221:14 conversion to 'ULONG' from 'int' may change the sign of the result [-Wsign-conversion]
common_smp/src/tx_misra.c:624:33 unused parameter 'status' [-Wunused-parameter]
common/src/tx_misra.c reports none of them, because it already writes memset(ptr, (INT)value, size), value = (ULONG)(ptr1 - ptr2) at all three sites, and (VOID)status;. The difference looks like drift rather than a deliberate divergence.
It is worth fixing because of which file it is. The shim exists so that the kernel's pointer conversions go 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 reason this has not surfaced before is that the two test trees disagree. test/tx/cmake/CMakeLists.txt builds the kernel with -Werror, so the monoprocessor copy could not have regressed this way. test/smp/cmake/CMakeLists.txt has -Werror commented out in both add_compile_options and target_compile_options, so the SMP copy warns and builds. Neither tree defines TX_MISRA_ENABLE in any build configuration, so the file is normally compiled to nothing and the warnings never appear at all.
Fix in the linked pull request: apply the monoprocessor form to all five sites. Object code is byte identical before and after, compared with objcopy --strip-debug.
common_smp/src/tx_misra.candcommon/src/tx_misra.care the same shim, but the SMP copy performs four implicit conversions the monoprocessor copy makes explicit, and ignores a parameter the monoprocessor copy casts to void.Compiled at
-m32 -std=c99withTX_MISRA_ENABLEdefined and the warning setcommon_smpis built with (-Wall -Wextra -pedantic -Wconversion -Wmissing-declarations -Wunused -Wuninitialized -Wpointer-arith -Wlogical-op -Waggregate-return -Wfloat-equal), on gcc 14.2.0:common/src/tx_misra.creports none of them, because it already writesmemset(ptr, (INT)value, size),value = (ULONG)(ptr1 - ptr2)at all three sites, and(VOID)status;. The difference looks like drift rather than a deliberate divergence.It is worth fixing because of which file it is. The shim exists so that the kernel's pointer conversions go 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 reason this has not surfaced before is that the two test trees disagree.
test/tx/cmake/CMakeLists.txtbuilds the kernel with-Werror, so the monoprocessor copy could not have regressed this way.test/smp/cmake/CMakeLists.txthas-Werrorcommented out in bothadd_compile_optionsandtarget_compile_options, so the SMP copy warns and builds. Neither tree definesTX_MISRA_ENABLEin any build configuration, so the file is normally compiled to nothing and the warnings never appear at all.Fix in the linked pull request: apply the monoprocessor form to all five sites. Object code is byte identical before and after, compared with
objcopy --strip-debug.