zyfeier opened a new pull request, #18360: URL: https://github.com/apache/nuttx/pull/18360
Some compilers (e.g., Tasking) do not allow forced type casting of unions. Replace the direct cast with memcpy to copy the union parameter into a local variable, avoiding the illegal cast while preserving the correct behavior. *Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Some compilers (e.g., Tasking) do not allow forced type casting of unions in generated syscall stub files. The mksyscall tool previously generated code like (union_type)((uintptr_t)parm), which is illegal on strict compilers. This patch replaces the direct union cast with memcpy to copy the uintptr_t parameter into a local union variable, avoiding the illegal cast while preserving correct behavior. Changed file: mksyscall.c ## Impact No breaking changes — only affects generated stub code for union-type parameters Improves compiler compatibility (Tasking and other strict C compilers) No functional behavior change at runtime ## Testing Build host: Ubuntu Linux x86_64 Target: Tasking compiler toolchain Steps: Configured NuttX with a board that uses syscalls with union parameters Ran make to generate stub files via mksyscall Verified generated STUB files no longer contain direct union casts Verified generated code uses memcpy for union parameters Build completed without illegal type for cast or incompatible types at assignment errors Verification checklist: Generated stub files compile without errors on Tasking compiler No regression on GCC/Clang builds Union parameter values correctly passed through syscall interface -- 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]
