ML-dev-crypto opened a new pull request, #19497: URL: https://github.com/apache/nuttx/pull/19497
## Summary Building the `hello_d` example with LDC ImportC fails because ImportC does not correctly handle direct `__uint128_t` C-style casts such as `(__uint128_t)a` and `(__uint128_t)1` used in `include/nuttx/lib/math32.h`. These expressions compile successfully with the existing implementation, but ImportC fails while parsing them, preventing the D example from building. Rewrite the affected expressions to initialize `__uint128_t` variables first and then perform the arithmetic. This preserves the existing behavior while allowing the code to compile successfully with LDC ImportC. ## Impact Rewrite the two direct `__uint128_t` cast expressions in `math32.h` to use initialized `__uint128_t` variables before the arithmetic operations. The computation remains unchanged while avoiding the current ImportC parser limitation. ## Testing **Host:** WSL2 Ubuntu 24.04 x86_64 **Configuration:** `sim:nsh` Enabled `CONFIG_EXAMPLES_HELLO_D`. Before this change, the build failed while compiling `include/nuttx/lib/math32.h` with LDC ImportC. After applying this change, the project built successfully. Verified the application from NSH: ```text nsh> hello_d Hello World, [skylake]! hello_d_main: Saying hello from the dynamically constructed instance HelloWorld: mSecret=1630678024 DHelloWorld.HelloWorld: CONSTRUCTION FAILED! Constructor hello_d_main: Saying hello from the instance constructed on the stack HelloWorld: mSecret=42 DHelloWorld.HelloWorld: Hello, World!! Destructor ``` -- 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]
