casaroli opened a new pull request, #21329: URL: https://github.com/apache/nuttx/pull/21329
## Summary In the TLSF heap, `add_delaylist()` and `free_delaylist()` use the static functions `mm_lock_irq()` and `mm_unlock_irq()` only in a flat build or in kernel code (`CONFIG_BUILD_FLAT || __KERNEL__`). In a protected or kernel build, the user-space copy of `mm/tlsf/mm_tlsf.c` does not use the two functions, so GCC gives `-Wunused-function`. A board that builds with `-Werror` stops, for example qemu-armv8a:knsh with `CONFIG_MM_TLSF_MANAGER=y`: ``` tlsf/mm_tlsf.c:210:13: error: 'mm_unlock_irq' defined but not used [-Werror=unused-function] tlsf/mm_tlsf.c:196:19: error: 'mm_lock_irq' defined but not used [-Werror=unused-function] ``` This PR puts the two functions under the same condition as their callers. ## Impact - Protected and kernel builds with the TLSF heap: the user-space copy of `mm_tlsf.c` builds without the two warnings. The kernel copy does not change. - Flat builds and the default heap manager: no change. Not a breaking change. - All architectures: the change is in common code and adds only a preprocessor condition. - No documentation change: Documentation/ does not describe these functions. ## Testing Base: master 5c441693fa8. "master" in the results is this base. Builds with `CONFIG_MM_TLSF_MANAGER=y`; "delay 8" adds `CONFIG_MM_FREE_DELAYCOUNT_MAX=8`, which adds more callers of the delay list: | Configuration | master | this PR | | --- | --- | --- | | qemu-armv8a:knsh (kernel, arm64, `-Werror`) | fails, 2 errors | builds, 0 warnings | | qemu-armv8a:knsh, delay 8 | fails, 2 errors | builds, 0 warnings | | rv-virt:knsh64 (kernel, rv64) | builds, 2 warnings | builds, 0 warnings | | mps2-an500:knsh (protected, Cortex-M7), also delay 8 | 2 warnings | 0 warnings | | qemu-armv8a:nsh (flat), also delay 8 | builds, 0 warnings | builds, 0 warnings | | mps2-an500:nsh (flat), delay 8 | builds, 0 warnings | builds, 0 warnings | | sim:nsh (flat, host clang), delay 8 | builds | builds | mps2-an500:knsh with TLSF does not link on master and with this PR: the user image calls `nxsched_get_tcb()`. The PR "mm: Do not call scheduler functions in the user-space heap." fixes that. With the two PRs, the image links. For the same reason, the programs of qemu-armv8a:knsh with TLSF have an undefined `nxsched_get_tcb()`, and `init` does not start. With the two PRs, ostest exits with status 0 on qemu-armv8a:knsh and qemu-armv8a:nsh with TLSF and delay 8. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
