Sarthak-Pandey opened a new pull request, #20825: URL: https://github.com/apache/nuttx/pull/20825
## Summary Resolves #20823. Commit 321105a changed the prototype of `main()` in `crt0.c` to `int main(int argc, char *argv[], char *envp[])`. When `CONFIG_INIT_ENTRYPOINT="main"` (the default in `sched/Kconfig`), `include/sys/types.h` declared `int main(int argc, FAR char *argv[])`, causing a compilation failure in `crt0.c`: ``text error: conflicting types for 'main'; have 'int(int, char **, char **)' note: previous declaration of 'main' with type 'int(int, char **)' `` Furthermore, `<sys/types.h>` is a POSIX type header and should not declare application entry points, which causes global namespace pollution. This PR removes the `CONFIG_INIT_ENTRYPOINT` declaration from `include/sys/types.h` and places it in `sched/init/nx_bringup.c` (under `#ifndef CONFIG_BUILD_PROTECTED`), where `task_spawn(CONFIG_INIT_ENTRYNAME, CONFIG_INIT_ENTRYPOINT, ...)` is actually called. ## Impact - **Bug fix**: Resolves compilation errors for `crt0.c` across architectures when `CONFIG_INIT_ENTRYPOINT="main"`. - **POSIX compliance**: Cleans up `<sys/types.h>` and prevents leaking `main()` declarations across all translation units. - **Compatibility**: Fully backwards-compatible with existing entry points (e.g. `nsh_main`, custom names). ## Testing - Verified `tools/nxstyle` passes cleanly on both modified files. - Verified compilation of `crt0.c` with `CONFIG_INIT_ENTRYPOINT="main"`: previously failed with conflicting types error, now compiles cleanly. - Verified `nx_bringup.c` correctly receives the `CONFIG_INIT_ENTRYPOINT` prototype. -- 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]
