casaroli opened a new pull request, #21524: URL: https://github.com/apache/nuttx/pull/21524
## Summary The system call functions of `<arch/syscall.h>` use the GNU keyword `asm`. A program includes this header through `<sys/syscall.h>`. In a strict ISO C mode (`-std=c99`, `-std=c11`) `asm` is not a keyword, so the program does not compile: ``` include/arch/syscall.h:176:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asm' include/arch/syscall.h:178:6: error: expected ';' before 'volatile' ``` This PR uses `__asm__` and `__volatile__`, as `arch/arm64/include/syscall.h` does. ## Impact Only the spelling changes, in a header of RISC-V. The code that the compiler makes is the same: `objdump -d` of `libproxies.a` has the same md5 on master and on this branch, for RV64 (`rv-virt:knsh64`) and RV32 (`rv-virt:knsh`). All RISC-V build modes include this header. No ABI change. No flat-build API change. No Documentation change. Other headers have the same form and are not in this PR: arm64 and tricore `<arch/barriers.h>`, avr `<arch/avr/irq.h>`, i486 `<arch/i486/io.h>` and `irq.h`. ## Testing Test program, built with `-std=c99`: it includes `<sys/syscall.h>` and calls `sys_call0(SYS_sched_yield)`. It is not in apps. A test in CI would need an apps PR with a strict C mode, and this is a build fix, so I add none. | Config | master bf029a2ef5d | this branch | |---|---|---| | `rv-virt:knsh64` (kernel), TCG | test does not compile; ostest status 0 | `sys_call0(SYS_sched_yield) = 0 PASS`; ostest status 0 | | `rv-virt:nsh64` (flat), TCG | the build with the test as a builtin fails with the errors above | builds, ostest status 0 | | `rv-virt:knsh` (RV32, kernel) | test does not compile | test compiles; not run | In the flat build `CONFIG_LIB_SYSCALL` is off, so the test only checks that the header compiles. Compilers: RISC-V GCC 14.3 for all builds. Clang 22.1.1 from Homebrew, `--target=riscv64-unknown-elf -std=c99 -fsyntax-only` and the same for `riscv32`: 20 errors on master, none on this branch (compile only). Not run: the protected configs `rv-virt:pnsh` and `pnsh64`. `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]
