[libc-commits] [libc] libc: Remove `extern "C"` from main declarations (PR #102825)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Mon Aug 12 13:00:39 PDT 2024
jhuber6 wrote:
> > > Yeah - beats me. Hopefulyl someone on libc can look into this, turn off the warning, or whatnot.
> > > Maybe one of these files puts "main" in a namespace by accident and the `extern "C"` works around this?
> >
> >
> > It's because we compile everything with `-ffreestanding`.
>
> Ah, so maybe all the `main` rules shouldn't apply when building with that mode? it looks like at least `-Wreturn-type` does this (it warns on main-without-return-statement when compiling with `-ffreestanding` but doesn't warn without that flag, so all makes sense)
I think it's because we build the tests in two configurations. One is with `-ffreestanding` during the "full build" mode, the other is a standard hosted C++ compilation for the "overlay" mode. The warning is likely only printed for the latter.
https://github.com/llvm/llvm-project/pull/102825
More information about the libc-commits
mailing list