[clang] [Sema] Allow -Wno-main to suppress the arg wrong error (PR #85494)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 05:55:53 PDT 2024


AaronBallman wrote:

> There is a use case to pass customized arguments to main without using -ffreestanding.

This is not motivating for C++ because that's not actually valid to do (https://eel.is/c++draft/basic.start.main#3.sentence-1), and it's only barely motivating for C (you can call `main` like a typical function, but I don't know that "we're baremetal but don't want to be freestanding" is something we have an explicit stance on supporting). C has constraints on what the signature of `main` can be if it's provided in a hosted environment, and not passing `-ffreestanding` means you're in a hosted environment, so I'm not certain what the value is of allowing this particular diagnostic to be downgradable but not doing the same for the other error diagnostics related to `main` like `err_main_returns_nonint`.

https://github.com/llvm/llvm-project/pull/85494


More information about the cfe-commits mailing list